3 Replies Latest reply on Jan 21, 2014 7:23 PM by Clayton Hofrock

    Running a .py File

    JamesBond

      Hi Guys,

       

      Sorry for my obvious questions - I'm kind of a noob. Anyway, does anyone know a way to run a full python script without using a UART cable or telnet thru USB (I'm using the latter)? In other words, can I run a python script without a connection to anything except for a power source?

       

      Thank you so much for your help!

        • 1. Re: Running a .py File
          Clayton Hofrock

          Yes you can easily do this. First you will need to boot linux from the micro SD card. https://communities.intel.com/thread/48212

           

          That will allow you to modify what the Linux is doing and make it sticky. Next step is to modify the init so that your python script runs on startup. The Linux image used on Galileo is not Unbuntu, but I think this tutorial will still work.

          UbuntuBootupHowto - Community Ubuntu Documentation

           

          This method still requires you to log into the Linux at least once, and set everything up, but after it is setup, all you have to do is plug it in, and your python script should run.

          1 of 1 people found this helpful
          • 2. Re: Running a .py File
            JamesBond

            Thanks, chofrock.

            Could I modify init to the following:

            nohup python myRandomScript.py &

             

            and to view output

            tail -f nohup.out

             

            -------

            also, would I store the python script on the SD card and if so, how would I access it (in place of myRandomScript.py)?

            thx

            • 3. Re: Running a .py File
              Clayton Hofrock

              You can definately save it onto the SD card. If you put the file in the top directory of the SD card, the file would be located in this directory. In my case it is /media/mmcblk0p1    (multimediacard Block 0 Partition 1)


              You can use the nohup command. It does not close the session down, and it also would require you to connect first, but it does work.


              You also can just run the python script, and print the output and it will go to the console. Of course that makes it difficult to do anything else with the console...