Python with Ecmascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jiri.zahradil@gmail.com

    Python with Ecmascript

    Hello,

    for my Python application (Windows platform) to be standards
    compliant, I need to embbed Ecmascript(Java script) interpreter - I
    need to execute plugins written in this language. Which engine is
    suitable for Python, I have found bunch of them. Any recomendations
    are welcome.

    To be more specific, I think that plugins will be pretty simple, they
    will be used to manipulate my class-based datamodel, no special
    libraries dependencies ... therefore I prefer some rather simple
    solution ...

    Jiri

  • Phil Thompson

    #2
    Re: Python with Ecmascript

    On Sat, 5 Jul 2008 06:28:42 -0700 (PDT), "jiri.zahradil@ gmail.com"
    <jiri.zahradil@ gmail.comwrote:
    Hello,
    >
    for my Python application (Windows platform) to be standards
    compliant, I need to embbed Ecmascript(Java script) interpreter - I
    need to execute plugins written in this language. Which engine is
    suitable for Python, I have found bunch of them. Any recomendations
    are welcome.
    >
    To be more specific, I think that plugins will be pretty simple, they
    will be used to manipulate my class-based datamodel, no special
    libraries dependencies ... therefore I prefer some rather simple
    solution ...
    PyQt includes a Javascript interpreter. You can expose Python objects and
    properties as Javascript objects and properties.

    Phil

    Comment

    • Méta-MCI \(MVP\)

      #3
      Re: Python with Ecmascript

      Hi!

      Ecmascript (Jscript) is Active-Scripting compliant.
      With PyWin32, you can :
      - call JScript functions (with parameters)
      - define pieces of code (& run it)

      Another way, is to drive Internet-Explorer (via COM). You can set the
      IE-Windows as invisible, and connect the motor of execution (of
      JScript). Then, you can :
      - call JScript functions, with parameters et return ; variables, but
      also array (<=lists)
      - connect to JScripts's objects (for read/write)
      - write new functions in JScript
      - etc.

      @-salutations

      Michel Claveau




      Comment

      • Daniel Fetchinson

        #4
        Re: Python with Ecmascript

        Ecmascript (Jscript) is Active-Scripting compliant.
        With PyWin32, you can :
        - call JScript functions (with parameters)
        - define pieces of code (& run it)
        >
        Another way, is to drive Internet-Explorer (via COM). You can set the
        IE-Windows as invisible, and connect the motor of execution (of
        JScript). Then, you can :
        - call JScript functions, with parameters et return ; variables, but
        also array (<=lists)
        - connect to JScripts's objects (for read/write)
        - write new functions in JScript
        - etc.
        Is there a way to do similar things on linux?

        Cheers,
        Daniel
        --
        Psss, psss, put it down! - http://www.cafepress.com/putitdown

        Comment

        • Tim Roberts

          #5
          Re: Python with Ecmascript

          "jiri.zahradil@ gmail.com" <jiri.zahradil@ gmail.comwrote:
          >
          >for my Python application (Windows platform) to be standards
          >compliant, I need to embbed Ecmascript(Java script) interpreter - I
          >need to execute plugins written in this language.
          What standard are you hoping to comply with? I mean, what kind of a
          program is this?
          --
          Tim Roberts, timr@probo.com
          Providenza & Boekelheide, Inc.

          Comment

          • Méta-MCI \(MVP\)

            #6
            Re: Python with Ecmascript

            Hi!
            Is there a way to do similar things on linux?
            I think no. Because these tech use COM. And COM don't exist under xxnux.
            But:
            - look if XPCOM, or dBus) can help you
            - search with the word "MOZLAB", who work a solution (plugin) for
            drive Firefox, from an external software.

            Good luck!
            --
            Michel Claveau



            Comment

            • Daniel Fetchinson

              #7
              Re: Python with Ecmascript

              >Is there a way to do similar things on linux?
              >
              I think no. Because these tech use COM. And COM don't exist under xxnux.
              But:
              - look if XPCOM, or dBus) can help you
              - search with the word "MOZLAB", who work a solution (plugin) for
              drive Firefox, from an external software.
              Wow, mozlab is amazing!

              Thanks,
              Daniel
              --
              Psss, psss, put it down! - http://www.cafepress.com/putitdown

              Comment

              • jiri.zahradil@gmail.com

                #8
                Re: Python with Ecmascript

                On 6 Èec, 07:02, Tim Roberts <t...@probo.com wrote:
                "jiri.zahra...@ gmail.com" <jiri.zahra...@ gmail.comwrote:
                >
                for my Python application (Windows platform) to be standards
                compliant, I need to embbed Ecmascript(Java script) interpreter - I
                need to execute plugins written in this language.
                >
                What standard are you hoping to comply with? I mean, what kind of a
                program is this?
                --
                Tim Roberts, t...@probo.com
                Providenza & Boekelheide, Inc.
                Thats for our speech recognition server - it should executed "tags"
                with Javascript code embbeded in some XML grammar format.

                I personally does not like COM solution. I prefer some simple library
                but may be it is just a hope. I will look to PyQT library and to
                Mozilla scripting engine, but I think that this one can get
                unnecessarily difficult.

                Does anyone work or use something similar?

                Jiri

                Comment

                • alex23

                  #9
                  Re: Python with Ecmascript

                  On Jul 7, 12:31 am, "jiri.zahra...@ gmail.com"
                  <jiri.zahra...@ gmail.comwrote:
                  I personally does not like COM solution. I prefer some simple library
                  but may be it is just a hope.
                  Have you looked at the module 'python-spidermonkey'? It apparently
                  "allows for the implementation of Javascript classes, objects and
                  functions in Python, as well as the evaluation and calling of
                  Javascript scripts and functions".


                  Comment

                  • jiri.zahradil@gmail.com

                    #10
                    Re: Python with Ecmascript

                    On 7 Èec, 08:21, alex23 <wuwe...@gmail. comwrote:
                    On Jul 7, 12:31 am, "jiri.zahra...@ gmail.com"
                    >
                    <jiri.zahra...@ gmail.comwrote:
                    I personally does not like COM solution. I prefer some simple library
                    but may be it is just a hope.
                    >
                    Have you looked at the module 'python-spidermonkey'? It apparently
                    "allows for the implementation of Javascript classes, objects and
                    functions in Python, as well as the evaluation and calling of
                    Javascript scripts and functions".
                    >
                    http://code.google.com/p/python-spidermonkey/
                    I have looked at it. It seems to be not fully working version, but I
                    have not check it properly because the project homepage says "windows
                    version is forthcoming".

                    At this time I am considering using some command line interpreter
                    (maybe jsdb, http://www.jsdb.org/, based on spidermonkey) Idea is to
                    save script code to file and let it run by interpreter and then parse
                    the results. Problem is that this approach has very limited access to
                    variables and objects exposed to javascript (they needs to be
                    serialized before script run, script cannot call python functions etc)
                    and also retrieving results is not straigtforward.

                    Still looking for better solution ...

                    JZ

                    Comment

                    • sysprv

                      #11
                      Re: Python with Ecmascript

                      On Jul 7, 9:23 am, "jiri.zahra...@ gmail.com" <jiri.zahra...@ gmail.com>
                      wrote:
                      On 7 Èec, 08:21, alex23 <wuwe...@gmail. comwrote:
                      >
                      On Jul 7, 12:31 am, "jiri.zahra...@ gmail.com"
                      >
                      <jiri.zahra...@ gmail.comwrote:
                      I personally does not like COM solution. I prefer some simple library
                      but may be it is just a hope.
                      >
                      >
                      Still looking for better solution ...
                      >
                      JZ
                      How about using Jython and Rhino [http://www.mozilla.org/rhino/] ?
                      Could be worth your while, if you could live with coding for an older
                      version of the Python spec.

                      /sysprv

                      Comment

                      • Alan Isaac

                        #12
                        Re: Python with Ecmascript

                        Daniel Fetchinson wrote:
                        Is there a way to do similar things on linux?
                        NJSModule?


                        Alan Isaac

                        Comment

                        • Daniel Fetchinson

                          #13
                          Re: Python with Ecmascript

                          >Is there a way to do similar things on linux?This seems to be very good indeed. Just downloaded njs but the only
                          njsmodule version I could find was for python 2.1. Does anyone have a
                          recent copy?

                          Cheers,
                          Daniel
                          --
                          Psss, psss, put it down! - http://www.cafepress.com/putitdown

                          Comment

                          • Alan Isaac

                            #14
                            Re: Python with Ecmascript

                            >>NJSModule?
                            Daniel Fetchinson wrote:
                            This seems to be very good indeed. Just downloaded njs but the only
                            njsmodule version I could find was for python 2.1. Does anyone have a
                            recent copy?
                            1. You might ask here:


                            2. Did you try to compile it?
                            Is there anything obviously 2.5 incompatible?

                            Cheers,
                            Alan Isaac

                            Comment

                            • Daniel Fetchinson

                              #15
                              Re: Python with Ecmascript

                              >>>NJSModule?
                              >
                              >This seems to be very good indeed. Just downloaded njs but the only
                              >njsmodule version I could find was for python 2.1. Does anyone have a
                              >recent copy?
                              >
                              1. You might ask here:

                              >
                              2. Did you try to compile it?
                              Is there anything obviously 2.5 incompatible?
                              Well, so far I couldn't even compile njs (./configure complains about
                              HOST setting or some such) so haven't looked at njsmodule yet.

                              Thanks for the suggestions!
                              Daniel
                              --
                              Psss, psss, put it down! - http://www.cafepress.com/putitdown

                              Comment

                              Working...