如何从另一个python脚本执行python脚本? [英] How to execute a python script from another python script?
问题描述
我在python中有一个测试环境。它在命令提示符下由以下命令执行。
1)首先我必须转到.py文件所在的目录
2)然后我只需执行python filename.py和GUI出现
现在我必须创建一个可以打开GUI的脚本...即执行命令python filename.py从内部来看..我尝试了系统。在我的脚本中命令,但GUI没有出现。我试过
system(" python filename.py")但屏幕上什么也没出现
Plz帮助。
I have a test environment in python. it is executed by the following command on the command prompt.
1) First i have to go to the dir where the .py file is
2) then i simply execute python filename.py and the GUI appears
Now i have to create a script which could open the GUI...i.e execute the command "python filename.py" from inside itself.. I tried the "system" command inside my script but the GUI did not appear.i.e i tried
system("python filename.py") but nothing appeared on the screen
Plz help.
推荐答案
请原谅我,如果这看起来太基础了,但没有完整的代码或输出来检查我在伸展,你是否导入了os?例如,如果test.py包含
Forgive me if this seems too elementary, but without full code or output to examine I am stretching, did you import os? For example if test.py contains
如果这看起来过于简单,请原谅我但没有完整的代码或输出来检查我伸展,你导入操作系统?例如,如果test.py包含
Forgive me if this seems too elementary, but without full code or output to examine I am stretching, did you import os? For example if test.py contains
如果这看起来过于简单,请原谅我但没有完整的代码或输出来检查我伸展,你导入操作系统?例如,如果test.py包含
Forgive me if this seems too elementary, but without full code or output to examine I am stretching, did you import os? For example if test.py contains
这篇关于如何从另一个python脚本执行python脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!