Results 1 to 9 of 9

Thread: LUA - io.popen not supported

  1. #1

    Default LUA - io.popen not supported

    I was trying to write a LUA script that needs to get the output from an executed program and found that instead of os.execute I would need io.popen. But in the Girder LUA Console I get "'popen' not supported". Is this intentional?

    What I was hoping to do was to access my Google Calendar with the 'gcalcli' command and use the output to determine if I should trigger events or not. Being new to Girder and LUA there might be other ways to achieve this that I am unaware of?

    And this is Girder 6 on Raspberry PI.

  2. #2
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,550

    Default

    The Lua docs state "This function is system dependent and is not available on all platforms." So I'm guessing Linux is one of the missing ones. What I tend to do is use pipes to redirect into a temporary file and then read that file io.open
    Ron
    No support through PM

  3. #3

    Default

    No, it's there. At least it's working fine in Lua from the command line:

    Code:
    pi@raspberrypi ~ $ lua
    Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio
    > file = assert(io.popen("/bin/ls","r"))
    > output = file:read('*all')
    > print(output)
    Desktop
    easter.lua
    local
    ocr_pi.png
    python_games
    
    > file:close()
    >

  4. #4
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,550

    Default

    Girder is running Lua 5.1. Though maybe I can backport the io.popen from 5.2
    Ron
    No support through PM

  5. #5

    Default

    It's in 5.1 on my Raspberry:

    Code:
    Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
    > file = assert(io.popen("/bin/ls","r"))
    > output = file:read('*all')
    > print(output)
    Desktop
    easter.lua
    local
    ocr_pi.png
    python_games
    
    > file:close()
    While redirecting to a file and then reading it back in again does work, having popen would make things much simpler and more elegant.

  6. #6
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,550

    Default

    Yeah I saw the code is available, for whatever reason it's not being compiled at this point. I will turn it on for the next RPI release.
    Ron
    No support through PM

  7. #7
    Join Date
    Dec 2015
    Posts
    1

    Default

    Quote Originally Posted by andersh View Post
    I was trying to write a LUA script that needs to get the output from an executed program and found that instead of os.execute I would need io.popen. But in the Girder LUA Console I get "'popen' not supported". Is this intentional?

    What I was hoping to do was to access my Google Calendar with the 'gcalcli' command and use the output to determine if I should trigger events or not. Has anyone had a look at this site as it talks about Phen375. Being new to Girder and LUA there might be other ways to achieve this that I am unaware of?

    And this is Girder 6 on Raspberry PI.
    It's not being compiled for me either. Is there a way to fix this if the code is there it should work right?
    Last edited by ArvinHill; March 19th, 2016 at 12:23 PM.

  8. #8
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,550

    Default

    I've enabled io.popen. 6.0.15.x is building...
    Ron
    No support through PM

  9. #9
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,550

    Default

    The release has been uploaded for both RPI and amd64.
    Ron
    No support through PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •