简体   繁体   中英

Run python script from bash into Terminal not running

I'm trying to run the following bash script on my raspberry pi:

#!/bin/bash

python Testing.py

It gives me two options: "Execute" and "Execute in Terminal". Execute works no problem, it produces a CSV that I'm testing. When I use "Execute in Terminal" though, the script doesn't run (I also have some print statements in there that don't print). The terminal window is titled "LXTerminal".

Am I missing something? My goal is to launch the script in a terminal window so it can produce print statements etc.

Thanks!

This works for me:

xterm -e 'python /path/to/my/script.py'

or if xfce

xfce4-terminal -e '/path/to/my/script.py'

I just can't figure out how to keep terminal open when the scipt is complete.

Terminal is closed after script run.

尝试chmod 755 "file path/filename 。我认为这应该会有所帮助,因为它用于更改文件权限。

I ran into the same issue and the problem was that my python command was an alias to the executable. When I replaced it with python3, it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM