xterm -e python /path/to/script.py, without the quotes, instead.
" quotes aren't behaving the way you want.
xterm -e is trying to run
/path/to/script.py" as its argument, instead of
/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 run
xterm -e nano foo, that opens
nano in an XTerm window. As
man xterm says:
-e program [ arguments ... ]
This option specifies the program (and its command line
arguments) to be run in the xterm window. It also sets the
window title and icon name to be the basename of the program
being executed if neither -T nor -n are given on the command
line. This must be the last option on the command line.
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:
xterm -e python /path/to/script.py
Two other caveats come to mind:
- When the script finishes,
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 runs
python /path/to/script.py and then waits for user interaction.
- XTerm works fine in Lubuntu but the default GUI terminal emulator is LXTerminal. In case you would prefer to use that, you can use
lxterminal instead of
lxterminal command accepts
-e and treats it the same way as
xterm, so this would look like
lxterminal -e python /path/to/script/py. As with XTerm, LXTerminal will quit when the command is finished running.