PDA

View Full Version : Qmutex/QThread PyQt problem



boom
1st September 2008, 11:42
Hello,

I have a problem with getting my thread to work correctly in pyqt. I also dont really understand mutex and where to use it correctly. I have attached my code.

The short:
I select a file that will get tailed.
Once I click start a QTimer is activated to check for new files every 5 seconds to handle rollovers. (If there is another way to do this pray tell!)

Anyways It works the first time that the program runs through but after that it complains about a RuntimeError: underlying C/C++ object has been deleted.

Any help would be extremely appreciated!! Even if someone could maybe just paste me some py
qt code that uses threads and mutexs' so I can get a general idea. There seems to be a very big void on google regarding the subject :-(

Regards!

wysota
1st September 2008, 11:57
Have you seen QFileSystemWatcher?

boom
1st September 2008, 12:10
Yes I have but can QFileSystemWatcher be timed down?

The files the application is tailing is appending constantly.

Is there maybe a way that I can implement this so that I get a signal when there is a new file created in the directory I am tailing the file in?

Basiccally just receiving a signal if there is a new file in the directory and not a modified file. As the files will be modified the entire time ...

-------------------------------------------------------------------------------------------------------

Decided on using QFileSystemWatcher. Is there a easy way to fond out what the file was that changed in a directory that you are monitoring?

wysota
1st September 2008, 12:49
The watcher will emit a signal which you can catch and interpret the way you want. It is you who decides how often react to changes.