简体   繁体   中英

Script does not run on command prompt as in PyScripter

I'm developing a script in PyScripter. When I run it in PyScripter it runs fairly well. However, the script contains two separate threads (one Thread object, and the main flow of the script). When I run the script from the Command prompt it gets stuck in the Thread. It gives no impression of executeing the main process, and it never ends, which it does when I run it inside PyScripter. What should I do?

In your code, use timeout in join() to put time constrain on the thread. For instance

....
yourThread = threading.Thread()
yourThread.start()
yourThread.join(10.0)
....

Instructions of multithreading checks here . Hope it helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM