P
P
PaGrom2012-01-30 23:35:32
Python
PaGrom, 2012-01-30 23:35:32

Trouble with autoloading python script?

There is a script working with COM-port. I added it to autoload by creating a file with the launch command in /etc/init.d/ After rebooting, top sees the Python process, but the script itself does not react to interacting with the port. It is worth running the script manually, as everything works fine. What could be the reason?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
4
4dmonster, 2012-01-30
@4dmonster

1. is this your script? Script only in /etc/init.d/? then the command is also required update-rc.d scriptname defaults 80 to create symlinks in /etc/rc?.d
2. do you start the script as root when checking manually? if not, maybe the environment is not configured, try sudo -H -u UsernameFromWhich works
3. look - what are the errors from this script.

S
simplecode, 2012-01-30
@simplecode

maybe the script is run by different users?

@
@ntkt, 2012-01-30
_

And the rights to the port file-device would be checked too.
And with top, use lsof / fuser /… to see if the port is actually open.
Well, the conclusion from the script itself is a harsh, proven tool.

A
alz, 2012-01-31
@alz

Maybe it is necessary to look towards XAUTHORITY?

A
alexandris, 2012-01-31
@alexandris

You need to log not only the print output, but also errors. To do this, the launch line should be like this.
/usr/bin/python /path/to/script.py >>/tmp/pyscript.log 2>&1
The problem is most likely really in the launch of xrandr. This utility requires xx to be running and the DISPLAY environment variable set. Try to run as:
DISPLAY=:0.0 xrandr -o left
Although it is possible that the script starts xrandr even before the x itself starts.
As an option, you can put the script into autoload (after the start of the Xs) gdm, window manager or .xinitrc

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question