我正在尝试使用以下代码启动web.py服务器:
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()
,其中
app = web.application(urls, globals()) #part of the web.py framework... starts the REST server
但我得到了这个例外:
Traceback (most recent call last):
File "apitest.py", line 90, in <module>
p = Process(target=app.run)
TypeError: this constructor takes no arguments
我已经google了一下,但我找不到发生了什么......有人可以帮忙吗?
谢谢!
答案 0 :(得分:1)
正如agf在评论中所建议的,您的命名空间可能相互踩踏,因此名称Process
不是您认为的Process
。要解决此问题,请将您导入Process
的方式更改为更明确:
import multiprocessing
# ...all your other code...
p = multiprocessing.Process(target=app.run) # starts the web.py server