Calling Python from Javascript?

K

Kenneth McDonald

I know that there's some work out there to let Python make use of
Javascript (Spidermonkey) via (I assume) some sort of bridging C/C++
code. Anyone know of efforts to allow the reverse? I'd really like to
make use of Python when doing Mozilla DOM programming, and I can never
get a clear idea of when PyXPCOM might be available to those of us who
don't know the ins and outs of compiling Mozilla, and its XPCOM
structures. So if there was an easy way to simply and quickly pass even
just strings back and forth between Python and Moz Javascript, that
would make certain things a heck of a lot easier.

Thanks,
Ken
 
7

7stud

I know that there's some work out there to let Python make use of
Javascript (Spidermonkey) via (I assume) some sort of bridging C/C++
code. Anyone know of efforts to allow the reverse? I'd really like to
make use of Python when doing Mozilla DOM programming, and I can never
get a clear idea of when PyXPCOM might be available to those of us who
don't know the ins and outs of compiling Mozilla, and its XPCOM
structures. So if there was an easy way to simply and quickly pass even
just strings back and forth between Python and Moz Javascript, that
would make certain things a heck of a lot easier.

Thanks,
Ken

Javascript can make requests to the server, and far as I know python
can be used with either cgi or apache to respond to server requests.
Therefore, javascript can easily pass strings to a server side python
script, and it can easily handle data sent back that is formatted as a
string, XML, or JSON. I'm not sure what PyXPCOM is or why it's
relevant.
 
J

John J. Lee

Kenneth McDonald said:
I know that there's some work out there to let Python make use of
Javascript (Spidermonkey) via (I assume) some sort of bridging C/C++
code. Anyone know of efforts to allow the reverse? I'd really like to
make use of Python when doing Mozilla DOM programming, and I can never
get a clear idea of when PyXPCOM might be available to those of us who
don't know the ins and outs of compiling Mozilla, and its XPCOM
structures. So if there was an easy way to simply and quickly pass
even just strings back and forth between Python and Moz Javascript,
that would make certain things a heck of a lot easier.

I too wonder what happened to Mark Hammond's work on the
DOM_AGNOSTIC_2 branch a year or so back. Might be nice to be able to
write Firefox extensions in Python.

Practically, I know that e.g. the firefox htmltidy extension (I forget
the name) contains binaries built from C code, not just JS, so I guess
you could write a Firefox extension that embeds CPython in a similar
way.


John
 
J

John J. Lee

I too wonder what happened to Mark Hammond's work on the
DOM_AGNOSTIC_2 branch a year or so back. Might be nice to be able to
write Firefox extensions in Python.

Practically, I know that e.g. the firefox htmltidy extension (I forget
the name) contains binaries built from C code, not just JS, so I guess
you could write a Firefox extension that embeds CPython in a similar
way.

There are also some compilers for generating JS from Python (or
Python-like) source. The pyjamas project has one (pyjamas is
currently a port of GWT to Python), and I believe PyPy has a JS
backend too. Both of those are serious work but experimental.


John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top