[Tutor] Python and Javascript

Mike Hall michael.hall at critterpixstudios.com
Fri Mar 25 22:12:08 CET 2005

On Mar 25, 2005, at 1:00 PM, Ryan Davis wrote:

> Ok, that explains a lot, but I don't know of any easy way to do have 
> javascript talk to python.
> I can think of some horrible ways to do it, though.
> 1. Make a python web service running locally, and build up SOAP calls 
> or HTTP posts to it. (same as I suggested earlier)
> 2. Use XUL and pyXPCOM to make a firefox extension that talks to 
> python.  This is probably much more of a pain in the ass than you
> want to do, but that's the only way I know of to directly call python 
> functions from javascript.
> 3. Look into web framework Zope, that might have some of this plumbing 
> done already.
> 4. Check out Sajax, http://www.modernmethod.com/sajax/, a framework to 
> automate javascript calling your server-side functions.  It
> was made for PHP, but looks to have a python version as well.
> All of those but #2 require you to set up some kind of server.  Is 
> there a reason it has to be an HTML page?
> If not, making a GUI might be an alternative that sidesteps this 
> altogether.

Yikes, that sounds pretty hairy. Maybe this kind of thing is not as 
straight forward as anticipated. Why HTML you say? Well I've been 
intrigued by Dashboard, which will be in the next OSX release. It 
allows you to create "widgets" which are essentially little html pages 
that do things. This got me thinking how I'd like to tie a small Python 
script I wrote into an html front end (ideally becoming a widget). It's 
looking like this may be trickier than anticipated. In any case, 


More information about the Tutor mailing list