Extcommand script limit?

Hi, i´ve 2 printers with remote power supply and light switching programmed and implemented via extcommand.xml calling a Python script...nothing special. Everything is going well and working.
I´ve been trying to implement another bigger Python script, trying to run Telegram via Python, but it aborts the script and it was all properly implemented.
Out of this my question. Is there a watchdog or some restriction on this implementation?

Anyway i´m starting to program a bot running in a docker on my server using the API to reduce the load on the RPi server.
Regards and thanks for some information on this.

Comments

  • No there is no limit on time as far as I know. The commands in menu are started non blocking so we do not even wait for them to finish. If it does not work that is normally because they are run as user repetierserver. So for testing try running the command like
    sudo -u repetierserver command

    then you also see feedback from errors e.g. permission problems.
  • Ok, I've tried it without getting a positive result.
    The funny part is, if I run the script on the RPi it's working. Even if I add the code to the working script,which switches Relais, the hole script doesn't work again. No relais are switched anymore.
    Both scripts run on Python 3. Any other suggestion?
    Is there a possibility to debug external scripts or maybe use the Python log mechanisms?
  • Does it work with sudo -u repetierserver command ? That was not clear from your comments.

    I'm no python programmer so can't say much about what you can do in python. Can it be that your new script needs some environment it does not get? E.g. is the work directory important to the script which is not set here.
  • No. Ok, i try to explain.
    I have script 1 which switches via Python 3 a few relais. This one is working.
    I´ve tried to add script 2. Also running via Python 3 to send messages via telegram. This one does nothing, when i try to run it via a button (extcommand - > sending only a fixed message). Even not with sudo -u. I don´t think it´s a user right problem. The script itself runs on the Raspberry, when i run it via ssh.

    Now i´ve implemented the code to the script which switches the relais. If i try to switch a relais it is not working anymore. So, for me it seems to be a different topic than user rights.

  • > Even not with sudo -u. I don´t think it´s a user right problem. The script itself runs on the Raspberry, when i run it via ssh.

    If it doe snot run with sudo -u which is the same as server does it is a user problem. Not necessarily a permission problem. Maybe just a problem that user "repetierserver" is not allowed to send to your account because you perhaps just configured it for user pi in some config files stored in home directory and repetierserver home directory is /var/lib/Repetier-Server. 
  • Really strange to me now. I´ve sudoed the python application. Both python files have the same owner and the same rwx settings. One is working. The otherone not.
    So, as i told you. I´ve added the code of the not working script to the working script. The script failed when i added the code.
    I´ve run this 2 in 1 script also via the ssh. There it was working fine. When i deleted the code again and i had only the relais things in the script, everything was fine again. So, same file, same everything...only some different code...and it wasn´t working anymore. 
    It doesn´t look to me, that i have any user right issues.
  • Well if someone says adding a code makes it not work I always assume the problem comes from the code added. I'm not a python programmer so can not say much about what breaks a python code. But can you add parts of it instead of all and check when it stops failing. Then you know the operation making the script fail and can think about requirements for that line like environment variables or default path etc which are surely different with repetierserver user then with pi user. repetierserver does not even have a login shell set so it is not able to login.
  • ok, thanks for your support. I´m going with the Web API. I have already some part of my bot running, like states of all printers and the extcommand part.
    Have a nice sunday...
Sign In or Register to comment.