Results 1 to 7 of 7

Thread: Write to datbase in a spawn python call

  1. #1

    Write to datbase in a spawn python call

    Hi,

    I am using spawn to execute many python background processes. How do I include the Lianja modules in the python script so that it can write back to the tables?

    Thanks

    Herb

    ps - my environment variable is set to c:\lianja\scriptinglanguages\ptyhon. So it is using the Lianja install of Python.

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    Hi Herb,

    You can run.

    lianjaruntime filename.ext

    where ext can be .dbo, .py, .php or .js.

    So you should spawn the runtime which has python embedded.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  3. #3
    Hi Barry,

    This works for me when spawning just the python call.
    python.exe c:\lianja\apps\matchbackmain\generate_file.py D:\\buffys2ep20\\test36\\jpg\
    But I am not sure how to call the runtime properly to get it to work. I am calling it like this
    lianjaruntime.exe c:\lianja\apps\matchbackmain\generate_file.py D:\\buffys2ep20\\test36\\jpg\
    I have also tried like this.
    lianjaruntime.exe --kiosk c:\lianja\apps\matchbackmain\generate_file.py --args D:\\buffys2ep20\\test36\\jpg\
    I think I am missing something.

    Thanks

    Herb

  4. #4
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    Hi Herb

    https://www.lianja.com/doc/index.php..._Line_Switches

    You may need to use

    lianjaruntime —file filename.ext
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  5. #5
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    Hi Herb,

    When you spawn the python interpreter how are you referencing the args?
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  6. #6
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,165
    Blog Entries
    22
    In Lianja 4.1.2 this now all works as expected.

    lianja --file c:\lianja\apps\matchbackmain\generate_file.py --args "'D:\\buffys2ep20\\test36\\jpg\'"
    or
    lianjaruntime --file c:\lianja\apps\matchbackmain\generate_file.py --args "'D:\\buffys2ep20\\test36\\jpg\'"

    Here is an example:

    lianja --file barry.py --args "'hello\sthere',1234,'bye'"

    and the file barry.py:

    Code:
    if __name__ == "__main__":
        print sys.argv
    The output is:

    ['barry.py', 'hello there', 1234, 'bye']

    Note that spaces in the --args list need to be escaped as \s or  
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  7. #7
    Thanks Barry!

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us