(yes there's a \n in the string ..see the def check_modules_installed() above)
here's commands.getoutput that's executing the dpkg-query. So somehow the pipe is closing before it's being told to by pipe.close?
def getoutput(cmd):
"""Return output (stdout or stderr) of executing cmd in a shell."""
return getstatusoutput(cmd)[1]
# Ditto but preserving the exit status.
# Returns a pair (sts, output)
#
def getstatusoutput(cmd):
"""Return (status, output) of executing cmd in a shell."""
import os
pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
text = pipe.read()
sts = pipe.close()
if sts is None: sts = 0
if text[-1:] == '\n': text = text[:-1]
return sts, text
I put a print in lsb_release.py to see what the dpkg-query command is
then did check_modules_ installed( )
ipython
import lsb_release
lsb_release.
the print says:
dpkg-query -f '${Version} ${Provides}
' -W lsb-core lsb-cxx lsb-graphics lsb-desktop lsb-qt4 lsb-languages lsb-multimedia lsb-printing 2>/dev/null
(yes there's a \n in the string ..see the def check_modules_ installed( ) above)
here's commands.getoutput that's executing the dpkg-query. So somehow the pipe is closing before it's being told to by pipe.close?
def getoutput(cmd): (cmd)[1]
"""Return output (stdout or stderr) of executing cmd in a shell."""
return getstatusoutput
# Ditto but preserving the exit status. (cmd):
# Returns a pair (sts, output)
#
def getstatusoutput
"""Return (status, output) of executing cmd in a shell."""
import os
pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
text = pipe.read()
sts = pipe.close()
if sts is None: sts = 0
if text[-1:] == '\n': text = text[:-1]
return sts, text