• Pn script rut run in Pi desktop terminal, but not by ssh terminal

    From Vincent Coen@2:250/1 to RobH on Tue Nov 10 23:42:01 2020
    Hello RobH!

    Tuesday November 10 2020 20:08, you wrote to me:

    Do a ssh into your Pi.
    Then do
    pwd
    ls -la

    Now do
    sudo -s
    pwd
    ls -la


    and report what you get

    Vince


    On 10/11/2020 06:05, Vincent Coen wrote:
    Hello RobH!

    Tuesday November 10 2020 17:40, you wrote to All:

    > I have a python script to run some leds, and I'm having a
    problem with
    > it! When I ssh into my pi zero, then sudo python3 python
    script.py, it
    > doesn't run, no leds are lit.
    > But if I open a terminal in the pi desktop and run the same
    command
    > line, it works and the leds light up.

    > Anyone know why this happens.

    Who owns the script.py and where is it ?


    Remember sudo takes root priv. and the directory so try :

    sudo python3 /home/pi/script.py or whater the user name is along
    with the correct python run command is.


    Vincent


    I ssh'd into my pi zero, then I created the script with : sudo nano script.py then copied some other python script into the new script.py.
    I then ran sudo python3 script.py from within the directory the said
    script is in, which is the Downloads directory.
    Nothing happens, no errors, no leds lit.

    If I open a terminal window on the pi desktop and run the exact same
    sudo python3 script.py, it runs and the leds light up



    Vincent

    --- Mageia Linux v7.1 X64/Mbse v1.0.7.17/GoldED+/LNX 1.1.5-b20180707
    * Origin: Air Applewood, The Linux Gateway to the UK & Eire (2:250/1)
  • From RobH@3:770/3 to Vincent Coen on Fri Nov 13 09:14:49 2020
    On 10/11/2020 10:42, Vincent Coen wrote:
    Hello RobH!

    Tuesday November 10 2020 20:08, you wrote to me:

    Do a ssh into your Pi.
    Then do
    pwd
    ls -la

    Now do
    sudo -s
    pwd
    ls -la


    and report what you get

    Vince


    > On 10/11/2020 06:05, Vincent Coen wrote:
    >> Hello RobH!
    >>
    >> Tuesday November 10 2020 17:40, you wrote to All:
    >>
    >> > I have a python script to run some leds, and I'm having a
    >> problem with
    >> > it! When I ssh into my pi zero, then sudo python3 python
    >> script.py, it
    >> > doesn't run, no leds are lit.
    >> > But if I open a terminal in the pi desktop and run the same
    >> command
    >> > line, it works and the leds light up.
    >>
    >> > Anyone know why this happens.
    >>
    >> Who owns the script.py and where is it ?
    >>
    >>
    >> Remember sudo takes root priv. and the directory so try :
    >>
    >> sudo python3 /home/pi/script.py or whater the user name is along
    >> with the correct python run command is.
    >>
    >>
    >> Vincent
    >>

    > I ssh'd into my pi zero, then I created the script with : sudo nano
    > script.py then copied some other python script into the new script.py.
    > I then ran sudo python3 script.py from within the directory the said
    > script is in, which is the Downloads directory.
    > Nothing happens, no errors, no leds lit.

    > If I open a terminal window on the pi desktop and run the exact same
    > sudo python3 script.py, it runs and the leds light up



    Vincent


    Apologies for late reply but here are the results of what you asked:

    pi@raspberrypi:~ $ pwd
    /home/pi
    pi@raspberrypi:~ $ ls -la
    total 92
    drwxrwxrwx 15 pi pi 4096 Nov 11 12:32 .
    drwxr-xr-x 3 root root 4096 Aug 20 11:31 ..
    -rw--w--w- 1 pi pi 671 Nov 10 20:11 .bash_history
    -rw-rw-rw- 1 pi pi 220 Aug 20 11:31 .bash_logout
    -rw-rw-rw- 1 pi pi 3523 Aug 20 11:31 .bashrc
    -rw-r--r-- 1 root root 364 Nov 8 17:22 blinkatest.py
    drwxrwxrwx 2 pi pi 4096 Aug 20 11:40 Bookshelf
    drwxrwxrwx 6 pi pi 4096 Nov 8 17:20 .cache
    drwx-w--w- 12 pi pi 4096 Nov 10 17:10 .config
    drwxrwxrwx 2 pi pi 4096 Nov 8 16:40 Desktop
    drwxrwxrwx 2 pi pi 4096 Nov 8 16:40 Documents
    drwxrwxrwx 6 pi pi 4096 Nov 10 20:40 Downloads
    drwx-w--w- 3 pi pi 4096 Aug 20 12:09 .gnupg
    drwxrwxrwx 5 pi pi 4096 Nov 8 17:20 .local
    drwxrwxrwx 2 pi pi 4096 Nov 8 16:40 Music
    drwxrwxrwx 2 pi pi 4096 Nov 8 16:40 Pictures
    -rw-rw-rw- 1 pi pi 807 Aug 20 11:31 .profile
    drwxrwxrwx 2 pi pi 4096 Nov 8 16:40 Public
    drwxrwxrwx 2 pi pi 4096 Nov 8 16:40 Templates
    drwxrwxrwx 2 pi pi 4096 Nov 8 16:40 Videos
    -rw--w--w- 1 pi pi 56 Nov 11 12:32 .Xauthority
    -rw------- 1 pi pi 2493 Nov 11 12:32 .xsession-errors
    -rw------- 1 pi pi 2493 Nov 11 09:17 .xsession-errors.old
    pi@raspberrypi:~ $ sudo -s
    root@raspberrypi:/home/pi# pwd
    /home/pi
    root@raspberrypi:/home/pi# ls -la
    total 92
    drwxrwxrwx 15 pi pi 4096 Nov 11 12:32 .
    drwxr-xr-x 3 root root 4096 Aug 20 11:31 ..
    -rw--w--w- 1 pi pi 671 Nov 10 20:11 .bash_history
    -rw-rw-rw- 1 pi pi 220 Aug 20 11:31 .bash_logout
    -rw-rw-rw- 1 pi pi 3523 Aug 20 11:31 .bashrc
    -rw-r--r-- 1 root root 364 Nov 8 17:22 blinkatest.py
    drwxrwxrwx 2 pi pi 4096 Aug 20 11:40 Bookshelf
    drwxrwxrwx 6 pi pi 4096 Nov 8 17:20 .cache
    drwx-w--w- 12 pi pi 4096 Nov 10 17:10 .config
    drwxrwxrwx 2 pi pi 4096 Nov 8 16:40 Desktop
    drwxrwxrwx 2 pi pi 4096 Nov 8 16:40 Documents
    drwxrwxrwx 6 pi pi 4096 Nov 10 20:40 Downloads
    drwx-w--w- 3 pi pi 4096 Aug 20 12:09 .gnupg
    drwxrwxrwx 5 pi pi 4096 Nov 8 17:20 .local
    drwxrwxrwx 2 pi pi 4096 Nov 8 16:40 Music
    drwxrwxrwx 2 pi pi 4096 Nov 8 16:40 Pictures
    -rw-rw-rw- 1 pi pi 807 Aug 20 11:31 .profile
    drwxrwxrwx 2 pi pi 4096 Nov 8 16:40 Public
    drwxrwxrwx 2 pi pi 4096 Nov 8 16:40 Templates
    drwxrwxrwx 2 pi pi 4096 Nov 8 16:40 Videos
    -rw--w--w- 1 pi pi 56 Nov 11 12:32 .Xauthority
    -rw------- 1 pi pi 2493 Nov 11 12:32 .xsession-errors
    -rw------- 1 pi pi 2493 Nov 11 09:17 .xsession-errors.old root@raspberrypi:/home/pi#


    Thanks

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)