Execute python code inside browser without Jython

2020-02-23 06:50发布

Is there a way to execute python code in a browser, other than using Jython and an applet?

The execution does not have to deal with anything related to graphics. For example, just sum all the digits of a binary 1Gb file (chosen by the browser user) and then return the result to the server.

I am aware that python can be executed remotely outside a browser, but my requirement is to be done inside a browser.

For sure, I take for granted the user will keep the right to execute or not, and will be asked to do so, and all this security stuff... but that is not my question.

10条回答
家丑人穷心不美
2楼-- · 2020-02-23 07:14

nosklo's answer is wrong: pyxpcomext for firefox adds language="python" support to script tags. yes it's a whopping 10mb plugin, but that's life. i think it's best if you refer to http://wiki.python.org/moin/WebBrowserProgramming because that is where all known documented links between python and web browser technology are recorded: you can take your pick, there.

查看更多
唯我独甜
3楼-- · 2020-02-23 07:16

On my travels, I came across Skulpt, a project which seems to offer Python directly in the browser without plugins. It's licensed under MIT.

Skulpt Homepage

Skulpt @ Github

查看更多
疯言疯语
4楼-- · 2020-02-23 07:19

I put together a table comparing many Python-In-Browser technologies not long ago: http://stromberg.dnsalias.org/~strombrg/pybrowser/python-browser.html

查看更多
你好瞎i
5楼-- · 2020-02-23 07:20

By accident I was listening to Hanselminutes where he mentioned about Gestalt project. This is a solution to integrate a languages as IronRuby and IronPython in browser via Silverlight.

So I think the answer is no if you don't have any special plugins.

查看更多
相关推荐>>
6楼-- · 2020-02-23 07:21

http://repl.it/ - Python interpreter in JavaScript running on client side. There are many other languages too. Source is available under MIT license, which is awesome.

查看更多
时光不老,我们不散
7楼-- · 2020-02-23 07:22

The Pyjamas project has a compiler called pyjs which turns Python code into Javascript.

查看更多
登录 后发表回答