Search code examples
pythonwxpythoncx-freezedpkg

Running a packaged Python program in Ubuntu


I have written a python program and cx_freeze it so that it can be moved to other Linux machine to execute, everything went fine, except the following

After freezing all my python code, I then dpkg build it and marked /usr/bin/myProgram as my installation directory, everything went fine, I can build and install the program to the designated directory but I can only change the directory and ./myProgram to start my program, if I do not do so, I will be told the error of missing my settings.xml which is an external file sitting beside my main program which also resides in /usr/bin/myProgram.

I want to make a desktop shortcut, and I assume full path is needed to execute the program without changing the directory to my program's directory first, is there anything I can do to make this happen?

Message shows that I am missing a setting.xml file when I use full path to run the program, but when I first change to that directory and ./myProgram, it works fine

enter image description here

Thanks very much for the help.


Solution

  • A workaround would be to create a simple script to cd to the directory and run the executable with ./myProgram, and then call that script with full path with desktop launcher.

    Another way: There's a Path key available in desktop launcher. You can set it like:

    Path=working_directory_path
    

    in the .desktop file