[英]Execute python file in a new terminal?
well, i'm trying to execute a python file in a new terminal. 好吧,我正在尝试在新终端中执行python文件。 I've tried several thing, no result. 我尝试了几件事,没有结果。 I read this Execute terminal command from python in new terminal window? 我在新的终端窗口中从python中读取了此Execute terminal命令吗? So i tried 所以我尝试了
subprocess.call(['gnome-terminal', '-x', 'python /root/Desktop/Script/website/bb.py'])
it opens me a new terminal but it says me "no such file or directory". 它为我打开了一个新的终端,但显示“没有此类文件或目录”。 i've tried differents paths without results. 我尝试了不同的路径,但没有结果。
What i'm doing wrong ? 我做错了什么?
Thanks i 谢谢我
it seems the warning because unproper path writing as you expected therefore you have to take care if these notes 似乎是警告,因为不正确的路径写入如您所预期,因此如果这些注意事项,您必须要小心
\\
, Linux&Mac use slash /
Windows使用反斜杠\\
,Linux&Mac使用斜杠/
C:\\\\Users\\[username]\\Desktop
, on linux /home/[username]/Desktop
在Windows中,桌面文件夹位于C:\\\\Users\\[username]\\Desktop
,在Linux /home/[username]/Desktop
os.path.join
您可以使用os.path包来处理路径os.path.join
Tip drag the script file into your terminal to get the absolute path located on your file system 提示将脚本文件拖到终端中,以获取文件系统上的绝对路径
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.