简体   繁体   English

从javascript运行python

[英]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: 我已经在python中实现了加速度计读取器,并且当读取新值时,我想在javascript文件中执行函数:
1 - update the value in a database 1-更新数据库中的值
2 - broadcast the new value to all connected client ( via Socket.io) 2-将新值广播到所有连接的客户端(通过Socket.io)

I was wondering how to do it? 我想知道怎么做? I checked PyV8 but it seems not maintained and only working with Python 2.7. 我检查了PyV8,但似乎没有维护,只能与Python 2.7一起使用。 My files structure looks like 我的文件结构看起来像

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

我设法使用PythonShell从javascript文件执行python脚本( 链接到npm页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM