Is os.popen() thread safe?

nobody nobody at nowhere.near.here
Mon Feb 3 14:10:25 EST 2003


I am having following code:

class find_files(threading.Thread):
    def __init__(self, form):
        threading.Thread.__init__(self)
        self._form = form
    def run(self):
        self._form.textCtrl1.Clear()
        f = os.popen("dir /b /s " +
os.path.join(self._form.textCtrl3.GetValue(), "*.zip"))
        zip_file = f.readline()
        while len(zip_file) > 0:
            self._form.textCtrl1.AppendText(zip_file)
            zip_file = f.readline()
        f.close()

The problem is that it finishes way before all .zip files are found.






More information about the Python-list mailing list