开发者

Odd TypeError with Multi Process Python Module

I'm trying to start a web.py server using this code:

if __name__ == "__main__":
    p = Process(target=app.run) #starts the web.py server
    p.start()
    main() #starts a main listening loop for errors, testing and logging
    p.join()

where

app = web.application(urls, globals()) #part of the web.py framework... starts the REST server

But I get this exception:

Traceback (most recent call last):
File "apitest.py", line 90, i开发者_运维百科n <module>
p = Process(target=app.run)
TypeError: this constructor takes no arguments

I've googled everwhere but i can't find what's going on... can anybody help?

Thank you!


As suggested by agf in the comments, your namespaces are likely stepping on each other, so the name Process isn't the Process that you think it is. To fix this, change the way you're importing Process to be more explicit:

import multiprocessing

# ...all your other code...

p = multiprocessing.Process(target=app.run) # starts the web.py server
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜