CPython on the Web

azakai alonmozilla at gmail.com
Sun Jan 2 17:53:47 EST 2011


On Jan 2, 1:01 pm, Gerry Reno <gr... at verizon.net> wrote:
>
> Ok, visiting this page:
>
> http://syntensity.com/static/python.html
>
> I do not see anything happen when I click 'execute' button.  I'm running
> Firefox 3.6.3.
>

I've only tested with Firefox 4. I'm surprised though that it wouldn't
work on 3.6.3. Can you see what errors appear in the error console
(control-shift-J)?

If no errors appear, it might be a failure due to limited script stack
space (which is fixed in FF4, and I guess is a problem in earlier
versions).

>
> So what is happening is that the whole Python interpreter has been
> converted to Javascript and is running the browser, is that correct?

Yes.

>
> Ok, but the usual browser 'sandbox' constraints would still apply would
> they not?

Yes, the JavaScript is limited in the usual ways. So Python is running
in a sandboxed manner.

>
> And what is the build toolchain that you need if you want to convert
> your modules to be importable with this "CPython on the Web"?
>

Note that loading modules isn't implemented yet, but I'll work on it
soon.

The toolchain will be to use your normal makefiles and such, but
replacing gcc with llvm-gcc or clang, so it generates LLVM bytecode
instead of a normal binary. Then one would run the generated LLVM
bytecode through Emscripten, which compiles it to JavaScript. So, the
process should be fairly simple.

- azakai



More information about the Python-list mailing list