Reply to topic

launch python script without terminal?

tubbadu
Registered Member
Posts
7
Karma
0
Hi, how can I execute a python script doubleclicking on it? i tried to make it executable by typing
Code: Select all
chmod +x filename.py

I added
Code: Select all
#!/usr/bin/python3

at the beginning of the file (i tried also env python3, pithon, env python), but I still can't open it with a doubleclick... if i right click it and select 'open with' and search for python, no result appears. but python 3 is installed, and if in a terminal I type
Code: Select all
python3 filename.py

it works

i don't know what to do, please help me! :'(
thank you in advance!
User avatar thunder422
Registered Member
Posts
68
Karma
1
OS
The first time I tried this on a python script (that contained the line you mention, plus had the execute permission set), Dolphin asked if I wanted to execute the file. This dialog also contained an option if "Do not ask again". After selecting this, from then on, double-clicking the file ran the script (or any python script). Question, will your script run from the command line without first typing 'python3', in other words, just:
Code: Select all
filename.py
It does for me.


Currently using KDE Neon 5.20.5 and 5.19.4 (run Windows 10 in a VM); migrated from Linux Mint 17.3

 
Reply to topic

Bookmarks



Who is online

Registered users: andrewm, Baidu [Spider], Bing [Bot], Google [Bot], Merlimau, ssanderson, Yahoo [Bot]