Important: Please read the Qt Code of Conduct -

QThread locks process on folder

  • i'm trying to convert qt's QFileInfoGatherer to python the code below is a stripped version of it. The issue im running into is that when QFileSystemWatcher is inside of the Thread it locks the folder if a folder is in its children.

    so lets say you have the folders:

    you cant delete A from an os level because a process is latched on you can however delete A AFTER B is deleted.

    How can i fix this? or what am I missing?

    from PySide.QtCore import *
    from PySide.QtGui import *
    class FileGatherer(QThread):
        def __init__(self, parent=None):
            super(FileGatherer, self).__init__(parent)
            self.muteX = QMutex()
            self.condition = QWaitCondition()
            self.abort = False
            self.paths = []
            self.watcher = QFileSystemWatcher(self)
        def run(self):
            while True:
                locker = QMutexLocker(self.muteX)
                if self.abort:
                if not len(self.paths):
                    print "waiting"
                    print "running"

Log in to reply