Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to get a launcher working for the WikidPad (python) program.
I already have a python program, so I looked into the file /usr/share/applications/taskcoach.desktop. The exec line was simply taskcoach.py.

But I cannot start WikidPad just typing "WikidPad.py", I have to write python WikidPad.py, then it starts correctly from the command line.

So I made the .desktop file for wikidpad, in the exec line I wrote python /home/abc/wikidpad/WikidPad.py.

But it seems that you have to be in the same directory in order to get correct results, otherwise there is the error No module named pwiki.Enum.

So I changed the exec line into cd /home/abc/wikidpad;python WikidPad.py.

But that did also not work, the error message was cd could not be executed, file or directory not found.

If I want to execute a Linux command in a bash script and I get an error "command/file not found", I adjust the PATH variable or write the full path of the command. That normally helps.

But in this case, cd is a built in bash command, and I cannot write whereis cd in order to get the full path of the command.

I do not have any idea to get this going.

share|improve this question

2 Answers 2

The Exec key in a .desktop file accepts only one executable name (+ arguments):

The Exec key must contain a command line. A command line consists of an executable program optionally followed by one or more arguments.

So, you either:

  • invoke the shell with an explicit sh -c "command_string" (where command_string = your actual commands):

    Exec=sh -c "cd /home/abc/wikidpad; python WikidPad.py"
    

or

  • put your commands in a script (somewhere in your $PATH), make it executable and have the .desktop file execute the script:

    Exec=my_script
    

    (or Exec=/full/path/to/my_script if the script is not in your $PATH).

share|improve this answer

It depends a bit on where the pwiki directory is (or a pwiki.py file), but assuming it is in /home/abc/wikidpad/ you can add the following to /home/abc/wikidpad/WikidPad.py before the the import of pwiki.Enum:

import sys
sys.path.insert(0, '/home/abc/wikidpad')

(Replacing the directory with the directory where you found pwiki)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.