473,775 Members | 2,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2192
On Apr 11, 1:50 am, Kenneth McDonald
<kenneth.m.mcdo n...@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
12699
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 state, the HTML page URL would change from default.html to default.html#stateA. example: http://pearstudios.com/javascript/locationHashAndFlash.html This has worked perfectly within HTML and javascript alone, however, when connecting Flash and...
47
3483
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 licensing issues surrounding qt (fwiw, I think their license fee for commercial use is eminently reasonable), so aside from that, I was wondering if there was any feedback readers could provide on the following: 1) Which plays best with Python?...
10
13306
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>"; print(self.text); def __del__(self): self.text = "</BODY></HTML>"; print(self.text);
16
3786
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 compiled a DLL of the Python source code using the pythoncode VC++ project in the PCbuild folder of the source download and this works 100% without any warnings etc. I've done this in Debug and Release mode without any problems.
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8939
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5358
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4014
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.