I'm using Lubuntu with the ODROID C0. There is a Python script which needs to be autostarted. I navigated to
[start menu]>preferences>Default applications for LXSession
, then navigated to the autostart tab and added xterm -e "python /path/to/script.py"
. The xterm autostart works but reads the error
xterm: Can't execvp "python: No such file or directory
Any ideas about how I can properly configure the autostart of this Python script?
Thanks.
Use
xterm -e python /path/to/script.py
, without the quotes, instead.Your
"
quotes aren't behaving the way you want.xterm -e
is trying to run"python
with/path/to/script.py"
as its argument, instead ofpython
with/path/to/script
as its argument. In this case you can simply omit the quotes.In a shell script or when you run a shell interactively, quotes are treated specially and quote removal is performed. But this does not happen with commands you specify in LXSession configuration → Autostart → Manual autostarted applications.
Fortunately, even though
xterm -e
in Ubuntu will perform word splitting on one argument to treat it as a command, it also accepts multiple arguments. That's why-e
has to be the last option--everything else is interpreted as being part of the command. For example, if you runxterm -e nano foo
, that opensfoo
innano
in an XTerm window. Asman xterm
says:Assuming you're not trying to run a script whose path has spaces in its name, all you have to do is remove the quotes:
Two other caveats come to mind:
python
quits, and then the XTerm window will quit too. If you don't want this then you can add code to the Python script that waits for user interaction, or you can write a wrapper shell script (or any kind of wrapper script) that runspython /path/to/script.py
and then waits for user interaction.lxterminal
instead ofxterm
. Thelxterminal
command accepts-e
and treats it the same way asxterm
, so this would look likelxterminal -e python /path/to/script/py
. As with XTerm, LXTerminal will quit when the command is finished running.