代码从IDLE运行,但不是双击* .py [英] Code run from IDLE but not via double-clicking on its *.py

查看:65
本文介绍了代码从IDLE运行,但不是双击* .py的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我双击some.py时文件控制台窗口只出现在

时刻,之后就关闭了。如果这个脚本是从IDLE(F5键)里面的

开始的,那么它就应该执行(例如

执行所有的打印语句)。


有什么想法吗?操作系统:Windows; Python 2.3.4。谢谢。

When I double-click on "some.py" file console window appears just for a
moment and right after that it''s closed. If this script is started from
inside of IDLE (F5 key) then it executes as it should be (e.g.
executing all its print statements).

Any ideas? OS: Windows; Python 2.3.4. Thanks.

推荐答案

" n00m" < N0 ** @ narod.ru>写在

新闻:11 ********************* @ g47g2000cwa.googlegro ups.com:
"n00m" <n0**@narod.ru> wrote in
news:11*********************@g47g2000cwa.googlegro ups.com:
当我双击some.py时文件控制台窗口暂时显示
,然后关闭。如果这个脚本是从IDLE(F5键)内部启动的,那么它就应该执行(例如执行所有的打印语句)。

任何想法?操作系统:Windows; Python 2.3.4。谢谢。
When I double-click on "some.py" file console window appears just
for a moment and right after that it''s closed. If this script is
started from inside of IDLE (F5 key) then it executes as it
should be (e.g. executing all its print statements).

Any ideas? OS: Windows; Python 2.3.4. Thanks.




这是一个windows的东西。 shell窗口打开以运行脚本在脚本完成时关闭

.


尝试打开shell(开始 - >运行:cmd.exe在NT / 2k / XP或开始 - >运行:

command.com on 95/98)然后输入脚本的完整路径

或导航到然后执行它。


max



It''s a windows thing. The shell windows opens to run the script in is
closing when the script finishes.

Try opening a shell (Start->Run: cmd.exe on NT/2k/XP or Start->Run:
command.com on 95/98) and then either type the full path to the script
or navigate to it and execute it.

max




n00m写道:

n00m wrote:
当我双击some.py时文件控制台窗口仅在
时刻出现,之后就关闭了。如果这个脚本是从IDLE(F5键)内部启动的,那么它就应该执行(例如执行所有打印语句)。

任何想法?操作系统:Windows; Python 2.3.4。谢谢。
When I double-click on "some.py" file console window appears just for a
moment and right after that it''s closed. If this script is started from
inside of IDLE (F5 key) then it executes as it should be (e.g.
executing all its print statements).

Any ideas? OS: Windows; Python 2.3.4. Thanks.




当程序终止时,你的控制台窗口会关闭。

不,你不一定会看到你的任何打印声明
窗口关闭前
。它们被缓冲并且窗口

在它们显示之前关闭。


手动启动控制台窗口。从命令提示符,

类型


some.py





python some.py



Your console window closes when the program terminates.
And no, you won''t necessarily see any of your print statements
before the window closed. They were buffered and the window
closed before they could be displayed.

Start a console window manually. From the command prompt,
type

some.py

or

python some.py


谢谢大家的回复!


现在呢有效!

Thank you, guys, for your replies!

Now it works!


这篇关于代码从IDLE运行,但不是双击* .py的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆