Ubuntu – How to create a desktop entry to launch a Python script

desktop

I made my little Python app, but I can't launch the app using the desktop entry I created:

[Desktop Entry]
Name=MyApp
Version=0.1
Exec=/usr/share/MyApp/MyApp.py
Icon=/usr/share/MyApp/img/MyApp.png
Comment=Description......
Type=Application
Terminal=false
StartupNotify=false
Categories=Video;GTK;GNOME

The /usr/share/MyApp folder I made as root and the MyApp.py has executable properties.

Every time I double Click the MyApp.desktop the MyApp.py launch, display a systray icon, but it closes and make Ubuntu display a error message.

If I run the MyApp.py from terminal or double click on the .py file it runs normally, no crashes.

Best Answer

Try following text in your .desktop file.

[Desktop Entry]
Version=1.0
Name=ProgramName
Comment=This is my comment
Exec=/usr/share/MyApp/MyApp.py
Icon=/usr/share/MyApp/MyApp.py
Path=/usr/share/MyApp/
Terminal=false
Type=Application
Categories=Utility;Application;
Related Question