Calling Python from Javascript?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kenneth McDonald

    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
  • 7stud

    #2
    Re: Calling Python from Javascript?

    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.

    Comment

    • John J. Lee

      #3
      Re: Calling Python from Javascript?

      Kenneth McDonald <kenneth.m.mcdo nald@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

      Comment

      • John J. Lee

        #4
        Re: Calling Python from Javascript?

        jjl@pobox.com (John J. Lee) writes:
        Kenneth McDonald <kenneth.m.mcdo nald@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

        Comment

        Working...