将参数传递给executor.submit() - unicode对象不可调用

时间:2018-02-11 04:19:01

标签: python flask executor

我有一个处理后台进程的Flask视图,如下所示:

@app.route('/playlist')
def playlist(tracks):
    executor.submit(build_playlist,tracks=tracks)
    return 'Building playlist...'

并且此视图函数调用以下方法:

def build_playlist(tracks):
   (...process tracks...)

这是在应用程序中调用该进程的地方:

@app.route('/handle_playlists', methods=['POST'])
def handle_playlist():
    jukebox = ['track1', 'track2', 'track3']
    tracks = random.choice(jukebox)
    playlist(tracks) <------------------------

如果我致电playlist(),我会收到错误消息:

`'unicode' object is not callable`

但如果我直接致电build_playlist(tracks),它就会有用,所以我必须在executor.submit()犯一个愚蠢的错误。

我在这里错过了什么?

0 个答案:

没有答案