Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Jul 2020
    Posts
    300

    PCP 8 Python script in startup stopped working

    Wonder if anyone can help me, because I ran out of options. Since I upgraded to PCP8 my Pyhton script that is running at startup stopped working.

    I have a python script that checks "pcp mode" and then turns on a slow flashing led in a button. When you press the button it plays or pauses ("pcp play" or "pcp stop"). The script is started from a shell script, that I added to "user commands" under "tweaks".

    When I upgraded to PCP8 it stopped working. It doesn't flash when playing and doesn't pause/play. Checking 'top", I can see that the script is running (and it responds to button press and lights the led, so it can read and write GPIOs), but it seems to not be able to read the "pcp mode" status, or write "pcp play" or "pcp stop" anymore.

    The related part of the script is:
    Code:
        state = subprocess.getoutput("pcp mode")
        if state == "play":
            os.system('pcp stop')
        else:
            os.system('pcp play')
    When I start it manually from the terminal like this:
    Code:
    sudo nohup python3 button.py &
    it runs perfectly fine.

    Anybody have any suggestions? There doesn't seem to be any logfiles I can check either..

  2. #2
    Senior Member Greg Erskine's Avatar
    Join Date
    Sep 2006
    Location
    Sydney, Australia
    Posts
    2,417
    What is the "User command" you are trying to run?

    Note that the "&" is an illegal character.

  3. #3
    Senior Member
    Join Date
    Jul 2020
    Posts
    300
    Quote Originally Posted by Greg Erskine View Post
    What is the "User command" you are trying to run?
    Code:
    /home/tc/startup.sh
    It's a shell script that contains, amongst other things
    Code:
    /usr/local/bin/python3 /home/tc/button.py &
    Note that the .py script starts and runs (at least I can see it when I do top). It just doesn't work.

    When I kill the process and start it manually it works fine....
    (oh, and it all worked fine before I updated to pcp8)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •