[PyQt] Problem with QFileSystemWatcher

NARCISO, Rui RUI.NARCISO at airbus.com
Mon Dec 13 12:17:20 GMT 2010


Thanks Pete for both suggestions.

However, redirecting the stderr to a file is a bit too much !!!
Having looked into the code, the message seems to originate from a qDebug but I don't understand why that one gets shown ... and how to disable it ...

-----Message d'origine-----
De : Hans-Peter Jansen [mailto:hpj at urpla.net] 
Envoyé : lundi 13 décembre 2010 12:21
À : NARCISO, Rui
Cc : Baz Walter; pyqt at riverbankcomputing.com
Objet : Re: [PyQt] Problem with QFileSystemWatcher

On Monday 13 December 2010, 11:50:05 NARCISO, Rui wrote:
> Brilliant guys.
> This indeed solved my problem:
>       
> self.watchdog.setObjectName(QString("_qt_autotest_force_engine_poller
>"))

Yes, pretty cool finding, Baz. That way, it even works if the watched 
file is changed from another system in the network (with some delay of 
course).

Rui, leave out QString, (that's getting converted to a char * from sip 
anyway).

> The only inconvenient is that I have a message printed to the screen:
> QFileSystemWatcher: skipping native engine, using only polling engine
>
> That I can't seem to get rid of ...  oh well ...

Wonna get dirty?

import os
import sys
os.close(sys.stderr.fileno())
redirfd = open("xxx", "w")
os.dup2(redirfd.fileno(), sys.stderr.fileno())

from PyQt4 import QtCore, QtGui

> Cheers and thank you all of your help.

You're welcome.

Pete


> -----Message d'origine-----
> De : pyqt-bounces at riverbankcomputing.com
> [mailto:pyqt-bounces at riverbankcomputing.com] De la part de Baz Walter
> Envoyé : vendredi 10 décembre 2010 19:43
> À : Hans-Peter Jansen
> Cc : pyqt at riverbankcomputing.com
> Objet : Re: [PyQt] Problem with QFileSystemWatcher
>
> On 10/12/10 18:10, Hans-Peter Jansen wrote:
> > Dear Rui,
> >
> > On Friday 10 December 2010, 11:08:50 NARCISO, Rui wrote:
> >> When I use absolute paths (os.path.abspath) or real paths
> >> (os.path.realpath) or even relative paths (../../toto) it doesn't
> >> work. It only works when I use only the file name.
> >
> > Works fine here with absolute paths. Consequently, it triggers all
> > four connected signals, if I touch the watched file in my home.
> >
> > Guys, if you rely on some special file argument, why can't you
> > provide a global variable or even better, a command line parameter.
> >
> >> I don't think permissions are the problem because I tried the with
> >> the same file in the current folder and then in the parent folder
> >> and it works for the first and it doesn't for the latter...
> >>
> >> I'm on a Linux workstation accessing hard drives physically stored
> >> in a data center elsewhere. Can this be the problem ? I would
> >> think not because if it works for a file in the current folder it
> >> should work for the parent folder as well since both are in the
> >> same hard drive/filer ...
> >
> > My home is NFS, too. If I remember correctly, Qt uses simple timer
> > based polling for the file system watcher since being
> > multi-platform they cannot rely on any special OS kernel/filesystem
> > feature.
> >
> >> Any insight anyone ?
> >
> > Yes, you're using ancient versions of everything. This is most
> > probably,  what does harm in your case.
>
> the problem appears to be the one detailed in this thread:
>
>     
> http://lists.trolltech.com/qt-interest/2008-02/thread00553-0.html
>
> there is a 'workaround' suggested there, but it is somewhat hackish,
> and may not be available in the version of qt the op is using.
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
> This mail has originated outside your organization, either from an
> external partner or the Global Internet. Keep this in mind if you
> answer this message.
>
>
>
> The information in this e-mail is confidential. The contents may not
> be disclosed or used by anyone other than the addressee. Access to
> this e-mail by anyone else is unauthorised. If you are not the
> intended recipient, please notify Airbus immediately and delete this
> e-mail. Airbus cannot accept any responsibility for the accuracy or
> completeness of this e-mail as it has been sent over public networks.
> If you have any concerns over the content of this message or its
> Accuracy or Integrity, please contact Airbus immediately. All
> outgoing e-mails from Airbus are checked using regularly updated
> virus scanning software but you should take whatever measures you
> deem to be appropriate to ensure that this message and any
> attachments are virus free.



This mail has originated outside your organization, either from an external partner or the Global Internet.
Keep this in mind if you answer this message.



The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other than the addressee. Access to this e-mail by anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent over public networks. If you have any concerns over the content of this message or its Accuracy or Integrity, please contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you should take whatever measures you deem to be appropriate to ensure that this message and any attachments are virus free.



More information about the PyQt mailing list