0

このコードを使用して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

私はどこでもグーグルで検索しましたが、何が起こっているのかわかりません...誰か助けてもらえますか?

ありがとうございました!

4

1 に答える 1

1

コメントでagfが示唆しているように、名前空間は互いに足を踏み入れている可能性が高いため、名前は思ったとおりProcessではありません。Processこれを修正するには、インポートProcessする方法をより明確に変更します。

import multiprocessing

# ...all your other code...

p = multiprocessing.Process(target=app.run) # starts the web.py server
于 2014-09-18T20:01:20.047 に答える