简体   繁体   中英

How can I execute a Python script from Javascript?

I have written a module in python which performs some function.

I then created a Google Chrome extension which makes use of JSON and javascript.

Now when I click on the extension I want it to execute the python program which is stored on my hard disk and display the output on the browser again.

Is there a way in which I can do this??

Repeated :

Calling Python from JavaScript

Here you have some answers, Pyjamas is probably the best option in your case

可能是一个迟到的回复,但可能的解决方案是让你的python脚本充当服务器,让浏览器插件与之交互。

forgive me if i'm incorrect on infinite proportions.

I believe that JavaScript is executed in a sandboxed/ isolated environment. Therefore you cannot invoke a python interpreter* or any other executable residing on the system.

*unless the interpreter itself were written in javascript.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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