popen exit status

david me at here.com
Mon Jan 28 11:32:45 EST 2002


the documentation says that popen returns the error code, or 'None', of the 
shell process. this code however always returns '1' even though the command 
operates fine.

        f=os.popen("ls /dev/loop*")
        loopdevices = f.read()
        if not f.close() == 'None':         #fails on <>0: also
            raise Exception, "couldn't find any loop devices."



More information about the Python-list mailing list