当前位置:   article > 正文

pythonw exe打不开_pythonw.exe还是python.exe?

pythonw.exe

- Unless run from an existing console window, `python.exe` **opens a new console window**.

- **Standard streams** `sys.stdin`, `sys.stdout` and `sys.stderr` are **connected to the console window**.

- Execution is **synchronous** when launched from a `cmd.exe` or PowerShell console window: See [eryksun](https://stackoverflow.com/users/205580/eryksun)'s 1st comment below.- If a new console window was created, it stays open until the script terminates.

- When invoked from an existing console window, the prompt is blocked until the script terminates.pythonw.exe是GUI应用程序用于启动GUI/无用户界面的所有脚本。...- **NO console window** is opened.

- Execution is **asynchronous**:

- When invoked from a console window, the script is merely _launched_ and the prompt returns right away, whether the script is still running or not.- **Standard streams** `sys.stdin`, `sys.stdout` and `sys.stderr` are **NOT available**.

- **Caution**: **Unless you take extra steps**, this has **potentially unexpected side effects**:

- **Unhandled exceptions** cause the script to **abort** _**silently**_.

- **In Python 2.x, simply trying to use** **`print()`** **can cause that to happen** (in 3.x, `print()` simply has no effect).

- To **prevent that from within your script**, and to learn more, see [this answer](https://stackoverflow.com/a/30310192/45375) of mine.

- **Ad-hoc**, you can use **output redirection**:Thanks, @handle.pythonw.exe yourScript.pyw 1>stdout.txt 2>stderr.txt(来自PowerShell:cmd /c pythonw.exe yourScript.pyw 1>stdout.txt 2>stderr.txt)捕获stdout和stderr输出档案...

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/51828
推荐阅读
相关标签
  

闽ICP备14008679号