1

I am creating an GTK3 python application for Ubuntu. At the moment the application installs in the following locations.

In /opt/NSTrain folder where NSTrain is the name of my application. The NSTrain folder has the executable .py files, its icons, gui files and other library files. It also installs a .desktop file to /usr/share/applications folder.

Here are the contents of my .desktop file,

[Desktop Entry]
Name=NSTrain
X-GNOME-FullName=NSTrain
Comment=Train Scheduler Application
Categories=GNOME;Utility;
Exec=/opt/NSTrain/nstrain.py
Icon=/opt/NSTrain/app-icon.png
Terminal=false
Type=Application

I see my application in the application lens with the appropriate icon. However when I click it, nothing happens. The nstrain.py file is executable and works fine when I execute it from the terminal using ./nstrain.py command.

What is the issue here?

1 Answer 1

4

Does your application assume you are starting it from the folder /opt/NSTrain/? If so add the line

Path=/opt/NSTrain/

to your .desktop file. That tells Unity (or Gnome Shell or from whatever program you are using to start your application) to start your program in the given folder.

Without that line your application gets started from the current working folder of Unity (or whatever), which usually is your home folder. That will break your application if it assumes it is started from /opt/NSTrain/ and hence tries to open a file like /opt/NSTrain/somefile.dat just as somefile.dat.

If that doesn't help please start your application in a Terminal from your home folder using /opt/NSTrain/nstrain.py and post any error messages you get.

2
  • Thank you very much adding Path to the desktop file fixes the issue. May I ask if you can may be expand the answer to why Path is required in this case? It might help future users.
    – nik90
    May 21, 2012 at 22:50
  • Ok, did that. Hope that helps :-) May 21, 2012 at 23:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .