Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm using Gnome 2.32.0 in Ubuntu 10.10 and I need to execute a Python script via Gnome custom application launcher. I added an application launcher to the panel and pointed the relevant Python script, but every time I try to run it, I get an error message along these lines:

There was an error creating the child process for this terminal
Failed to execute child process "/home/dananjaya/xkcd_viewer/xkcd_gui.py" (Permission denied)

What is the correct way of adding a Python script to the application launcher? What is wrong in this case? Thank you in advance.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

It seems like you don't have permissions to execute the script. There are two possible solutions:

  1. Prefix the command with python, e. g. python /path/to/myscript.py instead of /path/to/myscript.py. That way, the python interpreter will read your script instead of the executed script calling the python interpreter, and the permissions on the script may stay the same.

  2. Enable execution-permissions for the script. Right-click the script in the file manager, choose properties and tick the execution permission under the permissions tab. This solution implies that your script can be identified by the shell as a python-script. To do this, you must place #!/usr/bin/env python on the first line of the file.

share|improve this answer
    
Thank you for you suggestions and I tried both of them. I enabled the execution-permission. also did prefix the command with 'python'. Now it doesn't give the aforementioned error but does nothing at all. I looked at all the processes running and the script does not run. –  Dananjaya Apr 22 '11 at 14:21
    
It sound like you have other bugs. It might be caused by the script running with another working directory instead of its main directory. Try running the exact same command as the launcher in a terminal and see if you get any exceptions. –  Egil Apr 22 '11 at 15:31
    
No exceptions occur. Script runs okay in the terminal. –  Dananjaya Apr 22 '11 at 16:04
1  
I cloned your repository and got gnome-terminal -e "python /home/egil/src/xkcd_viewer/xkcd_gui.py" to work as launcher. However, I cannot understand why executing the script directly yields a cross-hair. –  Egil Apr 22 '11 at 19:58
1  
Of course, you lack the shebang at the start of your script. The first line should read #!/usr/bin/env python. The crosshair comes from the import command that gets executed because your script gets read as a batch of commands as it lacks the shebang that explains that it must be executed with python. –  Egil Apr 23 '11 at 8:45
show 7 more comments

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.