简体   繁体   English

脚本无法像在PyScripter中那样在命令提示符下运行

[英]Script does not run on command prompt as in PyScripter

I'm developing a script in PyScripter. 我正在PyScripter中开发脚本。 When I run it in PyScripter it runs fairly well. 当我在PyScripter中运行它时,它运行得很好。 However, the script contains two separate threads (one Thread object, and the main flow of the script). 但是,该脚本包含两个单独的线程(一个Thread对象,以及脚本的主要流程)。 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. 它没有给人留下执行主进程的印象,并且永无止境,就像我在PyScripter中运行它一样。 What should I do? 我该怎么办?

In your code, use timeout in join() to put time constrain on the thread. 在您的代码中,在join()使用timeout将时间限制放在线程上。 For instance 例如

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

Instructions of multithreading checks here . 多线程检查的说明在这里 Hope it helps you. 希望对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 任务计划程序打开命令提示符但不运行 python 脚本 - Task Scheduler opens command prompt but does not run python script 为什么 python 脚本在 pycharm 中运行和在命令提示符下运行时的行为不同? - Why does a python script behaves differently when it is run in pycharm and when it is run from a command prompt? 无法在命令提示符下运行 .py 脚本 - Unable to Run .py script in command prompt 使用python脚本在命令提示符下运行命令 - Run commands in command prompt using python script 为什么这在Python IDLE shell中有效,但在我从命令提示符下作为Python脚本运行时却没有? - Why does this work in the Python IDLE shell but not when I run it as a Python script from the command prompt? IDLE 找不到我的模块,但是当我从命令提示符运行脚本时它确实找到了 - IDLE can't find my modules but when I run script from command prompt it does 如何打开命令提示符以及使用python脚本运行的命令? - How to open a command prompt along with a command to run using a python script? 在PyScripter中清除屏幕的命令? - Command to clean screen in PyScripter? 为什么它不能在 Jupyter 笔记本上运行而在命令提示符下运行? - Why it does not run on Jupyter notebook while does work on command prompt? 在 Anaconda 命令提示符中运行 Python 脚本的 Windows 快捷方式 - Windows Shortcut to Run Python Script in Anaconda Command Prompt
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM