Hi Alex, any updates ?
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.
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.
Right, using that makes sense. And you could add the SIGINT signal to it, which would be an improvement to Cloud9 as well.
Removing the file will generate a SIGINT.
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?
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 ?
I created “python-integration” branch on bone101 and started writing the UI code, I need an answer please to go to the next steps.
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.
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?!
Do you have an Ethernet connection to the Internet?
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.
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!
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:
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.
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.