4

I have a basic .desktop file for a .py:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Appy
Comment=some app
Exec=/home/me/Documents/py/cs/simi0op.py
Icon=/usr/share/icons/hicolor/48x48/apps/pic.jpeg
Terminal=true

When I double click the desktop icon I get a terminal err msg that the .ext isn't in path. But it is.

My err msg :

Failed to execute child process “path/to/file.py” (No such file or directory)

But I can cd via terminal and run via python3 without problem. The .py file does use an import or two but these work fine so they should work from the .desktop shortcut as well...no?

My Exec var is correctly set up, I think. Clicking on icon produces error, but file exists - and runs via python3 in terminal:

chmod problems

Martin Thornton
  • 5,996
  • 12
  • 32
  • 43
meyeti
  • 59

3 Answers3

4

Have you tried:

[Desktop Entry]
Version=1.0
Type=Application
Name=Appy
Comment=
Exec=/home/[username]/path/file.py
Icon=/usr/share/icons/hicolor/48x48/apps/pic.jpeg
Path=/home/[username]/path
Terminal=false
StartupNotify=false

Maybe try terminal=false .. I have a script that runs using this setup with terminal false and you may want to add the path line

John Orion
  • 2,871
1

The culprit for me was substituting my home directory absolute path i.e. /home/[username]/ with the shell reserved character tilde ~ that normally designates the home directory when working at the shell itself. If that's case, then revert back to the clear-cut path.

kqvanity
  • 135
1

Most likely you need to execute chmod +x /home/[username]/path/file.py, replacing [username] with your actual user name.

If that fails please copy/paste the exact contents of your .desktop file and the exact error message. Changing stuff to "path/to/file.py" can hide useful information and make it harder for us to help you.

sмurf
  • 4,750
  • 1
  • 26
  • 30