Search code examples
javascriptpythoniotpyv8

Run python from javascript


I have implemented an accelerometer Reader in python and I want to execute a function in a javascript file when a new value is read that will:
1 - update the value in a database
2 - broadcast the new value to all connected client ( via Socket.io)

I was wondering how to do it? I checked PyV8 but it seems not maintained and only working with Python 2.7. My files structure looks like

--JScode
----MyJSCode
--PythonCode
----MyPythonCode

Solution

  • I managed to execute a python script from the javascript file using PythonShell (link to the npm page)