473,326 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Calling Python from Javascript?

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
Apr 11 '07 #1
3 2167
On Apr 11, 1:50 am, Kenneth McDonald
<kenneth.m.mcdon...@sbcglobal.netwrote:
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.

Apr 11 '07 #2
Kenneth McDonald <ke****************@sbcglobal.netwrites:
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
Apr 11 '07 #3
jj*@pobox.com (John J. Lee) writes:
Kenneth McDonald <ke****************@sbcglobal.netwrites:
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.
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
Apr 11 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes...
47
by: Kenneth McDonald | last post by:
Is there any emerging consensus on the "best" UI for toolkit. Tk never quite made it but from what I can see, both qt and wxWin are both doing fairly well in general. I'm already aware of the...
10
by: Finger.Octopus | last post by:
Hello, I have been trying to call the super constructor from my derived class but its not working as expected. See the code: class HTMLMain: def __init__(self): self.text = "<HTML><BODY>";...
16
by: Jaco Naude | last post by:
Hi there, This is my first post over here and I hope someone can give me some guidance. I'm trying to embed Python into a Visual C++ 2008 application and I'm getting linker problems. I've...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.