• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
TRIGGERcmd
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Tentando Executar um Script python no terminal LX com o TriggerCMD mas não estou conseguindo

Raspberry Pi
2
80
6.6k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    Russ @Antonio Francisco S.Santos
    last edited by Russ Feb 16, 2023, 11:01 PM Feb 16, 2023, 11:00 PM

    @Antonio-Francisco-S-Santos, you still haven't told me if you're getting something in the /tmp/Me-Siga.log file or not.

    Before we troubleshoot the script I need to know whether the command is running. If you get something in /tmp/Me-Siga.log then we'll know it is running.

    Please run this command and show me the result:

    cat /tmp/Me-Siga.log
    

    Russell VanderMey

    1 Reply Last reply Reply Quote 0
    • A
      Antonio Francisco S.Santos
      last edited by Feb 16, 2023, 11:46 PM

      @Russ said in Tentando Executar um Script python no terminal LX com o TriggerCMD mas não estou conseguindo:

      cat /tmp/Me-Siga.log

      Quando executo esse comando aparece essa resposta:
      cat: /tmp/Me-Siga.log: Arquivo ou diret▒rio inexistente

      Executei o comando no terminal shell

      R 1 Reply Last reply Feb 17, 2023, 12:05 AM Reply Quote 0
      • R
        Russ @Antonio Francisco S.Santos
        last edited by Feb 17, 2023, 12:05 AM

        @Antonio-Francisco-S-Santos, interresting. It doesn't seem to be running because you aren't getting anything in the log file.

        Will you please try running the script as root manually? I'm curious if that works.

        sudo su -
        /home/pi/TonyPi/Functions/Me-Siga.sh
        

        Also, please try adding this line to your Me-Siga.sh script:

        echo "Me-Siga.sh script ran." >> /tmp/Me-Siga.log
        

        Also, please confirm:

        You ran xhost + as pi.
        In your /root/.TRIGGERcmdData/commands.json file, ground = background.

        Russell VanderMey

        1 Reply Last reply Reply Quote 0
        • A
          Antonio Francisco S.Santos
          last edited by Feb 17, 2023, 12:53 AM

          @Russ said in Tentando Executar um Script python no terminal LX com o TriggerCMD mas não estou conseguindo:

          /home/pi/TonyPi/Functions/Me-Siga.sh

          já executei esse comando como root mas não funcionou: /home/pi/TonyPi/Functions/Me-Siga.sh
          também já tentei como comando echo mas não funcionou o Script não responde

          1 Reply Last reply Reply Quote 0
          • A
            Antonio Francisco S.Santos
            last edited by Feb 17, 2023, 12:56 AM

            @Russ said in Tentando Executar um Script python no terminal LX com o TriggerCMD mas não estou conseguindo:

            /root/.TRIGGERcmdData/commands.json, ground = background.

            não da permissão quando executo esse comando:
            /root/.TRIGGERcmdData/commands.json, ground = background.

            1 Reply Last reply Reply Quote 0
            • A
              Antonio Francisco S.Santos
              last edited by Feb 17, 2023, 1:01 AM

              @Russ said in Tentando Executar um Script python no terminal LX com o TriggerCMD mas não estou conseguindo:

              cat /tmp/Me-Siga.log

              Também quando executo esse comando: cat /tmp/Me-Siga.log recebo isso: Me-Siga.sh script ran.

              R 1 Reply Last reply Feb 17, 2023, 9:50 PM Reply Quote 0
              • R
                Russ @Antonio Francisco S.Santos
                last edited by Russ Feb 17, 2023, 9:51 PM Feb 17, 2023, 9:50 PM

                @Antonio-Francisco-S-Santos, good, so this line that you added to your script

                echo "Me-Siga.sh script ran." >> /tmp/Me-Siga.log
                

                Must have writen this to your /tmp/Me-Siga.log file:

                Me-Siga.sh script ran.
                

                Did it add that line when your ran the script manually as root? Or when you ran it via TRIGGERcmd? If you don't know, can you test that? Just cat the log before and after you run it.

                I just want to establish whether TRIGGERcmd is running your script or not before troubleshooting the content of your script.

                Russell VanderMey

                A 1 Reply Last reply Feb 22, 2023, 1:58 PM Reply Quote 0
                • A
                  Antonio Francisco S.Santos @Russ
                  last edited by Feb 22, 2023, 1:58 PM

                  @Russ Bom dia Professor, Ainda não conseguir resolver o Script com esse arquivo0 (Follow.py) Se os outros funcionam perfeitamente. Quando pego o Script que criei (Me-siga.sh) e modifico para outro arquivo no Trigger deixando assim: (/home/pi/TonyPi/Functions/Buzeer.py) ele funciona mas quando deixo assim: (/home/pi/TonyPi/Functions/Follow.py) não responde.
                  esse é o Arquivo Follow.py:
                  Follow.jpg

                  R 1 Reply Last reply Feb 23, 2023, 3:05 AM Reply Quote 0
                  • R
                    Russ @Antonio Francisco S.Santos
                    last edited by Russ Feb 23, 2023, 3:08 AM Feb 23, 2023, 3:05 AM

                    @Antonio-Francisco-S-Santos, I don't know why that particular python script won't work. I would have to see the output to troubleshoot it.

                    For some reason sending the output to a log didn't work, but if you run it manually, do you get any output you could send me?

                    Or is it the same error you got with the KickBall.py script?

                    Can't initialize GTK backend in function 'cvInitSystem'
                    

                    Russell VanderMey

                    A 1 Reply Last reply Feb 23, 2023, 10:52 AM Reply Quote 0
                    • A
                      Antonio Francisco S.Santos @Russ
                      last edited by Feb 23, 2023, 10:52 AM

                      @Russ Bom dia, O Script KickBall.py tinha um erro na visualização do vídeo e esse script não da nenhum retorno ao clicar no gatilho.
                      Me mostre como faço o script para ter um retorno de log?. Acho que o arquivo Follow deve ter algum comando na sua composição que impede que o Trigger funcione.

                      R 1 Reply Last reply Feb 23, 2023, 1:44 PM Reply Quote 0
                      • R
                        Russ @Antonio Francisco S.Santos
                        last edited by Feb 23, 2023, 1:44 PM

                        @Antonio-Francisco-S-Santos, to get the output, run this from a terminal window:

                        python3 /home/pi/TonyPi/Functions/Follow.py
                        

                        Or to capture the output to a log, run this command instead:

                        python3 /home/pi/TonyPi/Functions/Follow.py > /tmp/follow.log 2>&1
                        

                        Russell VanderMey

                        A 1 Reply Last reply Feb 23, 2023, 7:07 PM Reply Quote 0
                        • A
                          Antonio Francisco S.Santos @Russ
                          last edited by Feb 23, 2023, 7:07 PM

                          @Russ said in Tentando Executar um Script python no terminal LX com o TriggerCMD mas não estou conseguindo:

                          python3 /home/pi/TonyPi/Functions/Follow.py

                          Entçao, quando executo esse Script (python3 /home/pi/TonyPi/Functions/Follow.py )
                          ele funciona, e quando executo esse ( python3 /home/pi/TonyPi/Functions/Follow.py > /tmp/follow.log 2>&1 ) recebo esse Arquivo TMP: Follow-log.jpg
                          Me-siga-log.jpg

                          A 1 Reply Last reply Feb 23, 2023, 7:22 PM Reply Quote 0
                          • A
                            Antonio Francisco S.Santos @Antonio Francisco S.Santos
                            last edited by Feb 23, 2023, 7:22 PM

                            @Antonio-Francisco-S-Santos Também quando executo o Script pelo Trigger ( #!/bin/bash
                            export DISPLAY=:0.0
                            /usr/bin/python3 src/main.py --debug
                            python3 /home/pi/TonyPi/Functions/Follow.py > /tmp/follow.log 2>&1 ) no arquivo Bash recebo esse arquivo TMP:
                            Follow-LOG-Trigger.jpg

                            A 1 Reply Last reply Feb 23, 2023, 7:24 PM Reply Quote 0
                            • A
                              Antonio Francisco S.Santos @Antonio Francisco S.Santos
                              last edited by Feb 23, 2023, 7:24 PM

                              @Antonio-Francisco-S-Santos No caso o erro que esta acontecendo é esse aqui:
                              ( Traceback (most recent call last):
                              File "/home/pi/TonyPi/Functions/Follow.py", line 10, in <module>
                              import pandas as pd
                              ModuleNotFoundError: No module named 'pandas' )

                              R 1 Reply Last reply Feb 23, 2023, 9:56 PM Reply Quote 0
                              • R
                                Russ @Antonio Francisco S.Santos
                                last edited by Feb 23, 2023, 9:56 PM

                                @Antonio-Francisco-S-Santos, you need to install the pandas module with one of these commands. I'd try the first one first.

                                sudo pip3 install pandas
                                
                                sudo apt-get install python3-pandas
                                

                                Russell VanderMey

                                A 1 Reply Last reply Feb 24, 2023, 12:48 AM Reply Quote 0
                                • A
                                  Antonio Francisco S.Santos @Russ
                                  last edited by Feb 24, 2023, 12:48 AM

                                  @Russ Olá Professor, você é fera mesmo viu, deu certo funcionou o Script ( Follow ) Instalei o Pandas e deu certo muito obrigado você é o mestre mesmo.

                                  R 1 Reply Last reply Feb 24, 2023, 2:51 AM Reply Quote 0
                                  • R
                                    Russ @Antonio Francisco S.Santos
                                    last edited by Feb 24, 2023, 2:51 AM

                                    Awesome @Antonio-Francisco-S-Santos. I'm glad it's working now.

                                    Russell VanderMey

                                    A 1 Reply Last reply Feb 26, 2023, 2:39 AM Reply Quote 0
                                    • A
                                      Antonio Francisco S.Santos @Russ
                                      last edited by Feb 26, 2023, 2:39 AM

                                      @Russ Olá Professor, Como faço um script para fechar os script quando executado, Ex:
                                      {"trigger":"Sonar_barrier.py","command":"/home/pi/TonyPi/Extend/Caminhar.sh","ground":"background","voice":"Caminhar","allowParams": "false"}

                                      para fechar esse comando ( Sonar_barrier.py) quando estiver rodando?

                                      R 1 Reply Last reply Feb 27, 2023, 11:31 PM Reply Quote 0
                                      • R
                                        Russ @Antonio Francisco S.Santos
                                        last edited by Russ Feb 27, 2023, 11:33 PM Feb 27, 2023, 11:31 PM

                                        @Antonio-Francisco-S-Santos, if you don't mind killing all instances of python3, you could use this command:

                                        killall python3
                                        

                                        You could make that your "Off Command" so when you turn the virtual device off, it runs the killall command.

                                        {"trigger":"Sonar_barrier.py","command":"/home/pi/TonyPi/Extend/Caminhar.sh","offCommand":"killall python3","ground":"background","voice":"Caminhar","allowParams": "false"}
                                        

                                        Russell VanderMey

                                        A 1 Reply Last reply Feb 27, 2023, 11:59 PM Reply Quote 0
                                        • A
                                          Antonio Francisco S.Santos @Russ
                                          last edited by Feb 27, 2023, 11:59 PM

                                          @Russ Muito obrigado meu Amigo, ele funciona mas desliga o Robô após fechar o Script. kkkkk
                                          Na realidade estou querendo fechar só o Script que estar rodando no momento. No caso um outro Script que fecha os outros quando estiver rodando.

                                          1 Reply Last reply Reply Quote 0
                                          46 out of 80
                                          • First post
                                            46/80
                                            Last post