Re: Python Integration

38 views
Skip to first unread message

Amr Ragaey

unread,
Jul 30, 2016, 8:49:39 AM7/30/16
to Alex Hiam, Jason Kridner, beaglebo...@googlegroups.com
Hi Alex, any updates ?

On 28 July 2016 at 18:11, Amr Ragaey <amra...@gmail.com> wrote:
Hi Alex,

I'm currently working on BBUI, but as not to be late if the BBUI took more time, I would like to start the python integration phase ASAP. I just need for now starting points (branch name/ files), I'll have a look to the old functions and prepare functions prototype.
I have the three functions in my mind now as follows: 'to create a file for python code', 'to execute the code on bb', and 'to kill process/ remove the file after execution'.

Best Regards,
Amr Ragaey


Alex Hiam

unread,
Jul 30, 2016, 2:12:31 PM7/30/16
to Amr Ragaey, Jason Kridner, N:
Hey, sorry, work's been crazy here.

So I imagine you'll write a file to the server when the user presses Run, which is just a matter of sending the text to your node.js server. Then to run it you'll need to kick off a process from your server, then when the user presses stop you'll need to send a signal to the process to kill it.

The Cloud9 IDE already does the running and stopping of Python programs, so you could more or less just mimic the way it's doing that. The one thing I would recommend changing is how the process is stopped - Cloud9 just kills the terminal that's running the process, which gives the program no chance to exit happily. It would be nice for the server to first send a SIGINT signal, then it could force kill the terminal after a second or so to make sure it exits.

I'd say get the starting and stopping working, then you'll also want to pipe stdout and stderr back to the browser and display it in a window. You might want that pipe to go both ways as well in case a program needs user input from stdin.

I've still yet to get a chance to port PyBBIO to 4.x kernels, so if you want to test with PyBBIO you'll have to use a 3.8 kernel. There's no need for PyBBIO at this point though, you can get everything in place to run Python programs without it (just write some text to a file for your initial testing).

-Alex

Jason Kridner

unread,
Jul 30, 2016, 11:46:50 PM7/30/16
to Alex Hiam, Amr Ragaey, N:
There is already a daemon that will run any Python scripts put in /var/lib/cloud9/autorun (with .py extension) if that is of any help. 

al...@graycat.io

unread,
Jul 31, 2016, 2:47:13 PM7/31/16
to Jason Kridner, Amr Ragaey, N:

Right, using that makes sense. And you could add the SIGINT signal to it, which would be an improvement to Cloud9 as well.

Jason Kridner

unread,
Jul 31, 2016, 2:52:49 PM7/31/16
to al...@graycat.io, Amr Ragaey, N:
Removing the file will generate a SIGINT. 

Amr Ragaey

unread,
Aug 1, 2016, 9:55:46 AM8/1/16
to Jason Kridner, Alex Hiam, N:
Thanks Alex and Jason for support.

My kernel version is 3.8.13-bone79, and I can run PyBBIO examples now in terminal even if not in " /var/lib/cloud9/autorun" and I notice output on board LEDs, Is there a reason to be specifically in this location?

SIGINT is something like "ctrl-c" per my search, so killing process/ or removing file will do the job if I got it right.

Do you like me to prepare an offline code for a python code example with start and reset button, or to write in bone101?

Amr Ragaey

unread,
Aug 5, 2016, 9:52:34 AM8/5/16
to BeagleBoard GSoC, jkri...@gmail.com, al...@graycat.io
I want to know how the examples would be used in browser. Will users have to run it from http://192.168.7.2/bone101/Support/bone101/ or they can fork the repo on their machines running Jekyll server and still run python examples if the board is connected.
The first case, I'll treat the created python file directly on the server, and call it back from some directory on the server when the user click on 'run' or 'reset'., but the second case I'll have to create the file on the beaglebone server using remote call with ssh and call the file again through some ssh command if the beaglebone is already connected. So which case I have to go with ?

Thanks,

Amr Ragaey

unread,
Aug 6, 2016, 8:08:01 AM8/6/16
to BeagleBoard GSoC, jkri...@gmail.com, al...@graycat.io
any updates?

I created "python-integration" branch on bone101 and started writing the UI code, I need an answer please to go to the next steps.

Alex Hiam

unread,
Aug 6, 2016, 1:57:07 PM8/6/16
to Amr Ragaey, BeagleBoard GSoC, Jason Kridner
I'm not sure what you mean about forking or where Jekyll fits in, but this should have the same functionality as the Bonescript code does, i.e. you should be able to run code on the local bone101 that your BeagleBone serves up as well as from beagleboard.org. There's no need for ssh, the code can just be passed over socket.io to the server that's already in place, you'll just need to add some new Python functionality to it.

Amr Ragaey

unread,
Aug 7, 2016, 4:50:26 PM8/7/16
to BeagleBoard GSoC, amra...@gmail.com, jkri...@gmail.com
I think this requires me to write my functions in bonescript and push the python code and running through it, this somehow different to the idea I was thinking of, I'll try both cases and see.

But I have a problem now, my beaglebone isn't connecting, http://i.imgur.com/a7tlSzK.png when I toggle off bar it keeps loading to connect and disconnect at end!, and sometime I get this status message "Unmanaged" http://i.imgur.com/7QD5P6x.png. Is there a solution for this problem?!  

Jason Kridner

unread,
Aug 7, 2016, 7:44:20 PM8/7/16
to Amr Ragaey, BeagleBoard GSoC
Do you have an Ethernet connection to the Internet?

Jason Kridner

unread,
Aug 10, 2016, 7:20:19 PM8/10/16
to Amr Ragaey, BeagleBoard GSoC


On Aug 10, 2016, at 6:53 PM, Amr Ragaey <amra...@gmail.com> wrote:

how do I run/test a function added in index.js of bonescript on my local beaglebone? should I edit in the file directly which lies in /usr/local/lib/node_modules/bonescript/src ?

Yes, if you want to see it live. You can also check out the git repo and do 'npm install -g' from the top directory with package.json. 

Amr Ragaey

unread,
Aug 11, 2016, 9:42:36 AM8/11/16
to BeagleBoard GSoC, amra...@gmail.com
after editing index.js, the 'bonescript' package disappeared, and wasn't able to reinstall it using 'npm install..' . I recreated the image on sd card, now I don't know where and how to add new function and test it!

Amr Ragaey

unread,
Aug 12, 2016, 7:21:13 AM8/12/16
to BeagleBoard GSoC, amra...@gmail.com
When I tried to edit the index.js file, I found the URL 192.168.7.2 not working, but the ssh and  cloud9 is working fine. I doubt there's something need to start bone101 server again or debug any errors that blocking me from see the homepage.

when I tried to install bonescript by npm i got this error: 
Inline images 1

up till now I'm not able to write anything, please I need some help just to start writing my functions into bonescript and test it.

Amr Ragaey

unread,
Aug 12, 2016, 7:23:35 AM8/12/16
to BeagleBoard GSoC, amra...@gmail.com

the image again:

Amr Ragaey

unread,
Aug 13, 2016, 9:40:56 AM8/13/16
to BeagleBoard GSoC, amra...@gmail.com
 I'm not able to test/run any functions now. I'm saving time by writing offline version for my code to run on local machine that will do the same maths for beaglebone. and will add it to bonescript after finishing. expecting to finish by Sunday or Monday.
Reply all
Reply to author
Forward
0 new messages