0
(Python)I click on script.py but only opens in leaf pad.
Hello all, I’m using Kali Linux on virtualbox and am having trouble with getting terminal to open when I click on my script. However if I’m in terminal and type out root@kali# ~/Desktop/Folder/Script.py It will run on terminal just fine. I changed the permissions to execute as program and also tried the shebang at the top I can’t get it to run as a program :(
3 Réponses
+ 2
This isn't really a Python issue in the Kali context because...(just skim to get the idea):
https://unix.meta.stackexchange.com/questions/4640/what-should-we-do-about-kali-linux-questions
https://unix.stackexchange.com/questions/399626/why-is-kali-linux-so-hard-to-set-up-why-wont-people-help-me
That said, while I don't like enabling script-launch-from-GUI as a single action, I'd search for linux "default file associations" or "Open with..." and also explore anything under right-click-the-file.
Other than that, I'd have to poke at my copy/search on my environment, the same as you :/
+ 1
Running Python from Ubuntu Desktop...
Right click and create a text file on the desktop--contents:
[Desktop Entry]
Version=1.0
Name=My Script Name
Comment=
Exec=python /path/to/your.py
Icon=python
Path=/whatever/your/script/expects
Terminal=true
Type=Application
Categories=Utility;Application;
Save the file.
Rename it to "foo.desktop" (the first part doesn't matter, as soon as you mark it executable the name will change)
Right-click, Properties, [Permissions]
[X] Allow executing file as program
The icon should change to python, and the name will change to the Name value.
It should now run scripts in a Terminal.
Notes:
Set Terminal=false to run non-interactively.
If you made a mistake, clear the 'Allow executing...' checkbox to get the file back as an editable text file again.
If you still can't easily edit the file, drag the icon into an open gedit window.
* Kali is almost the same steps but no right-click to create file, you have to trust it for execution, ...
0
So even on just linux ubuntu i am still only getting notepad to open when i click on my script.py.