(Phoenix) wx.FileSystemWatcher Path/NewPath

I’m trying to utilize the wx.FileSystemWatcher class, however the wx.FileSystemWatcherEvent class seems to be providing next to no information. I’m almost certain this is not the intentional behavior, though I could be wrong.

The event has the properties (Path, NewPath) with accessors (GetPath, GetNewPath) which should reference the file events that take place in the monitored directories. However, these aren’t very helpful. For example, suppose you are watching the directory ‘spam’ which contains 10 files. You rename 1 file, ‘hamspam.py’ to ‘spamham.py’ and receive an associated wx.FileSystemWatcherEvent with the ChangeType as wx.FSW_EVENT_RENAME. You then should expect that Path would be ‘spam/hamspam.py’ and NewPath would be ‘spam/spamham.py’. However, both attributes simply come as ‘spam’ and I see no reference to either ‘hamspam.py’ nor ‘spamham.py’ (old vs. new values).

I’ll attach a short SSCE program which demonstrates this. It sets up a FSW on the directory of the script, so if you add/delete/rename files in that directory you will see printouts of the associated events and their Path/NewPath values. The result of my print wx.version() is ‘2.9.5.81-r74107 msw (phoenix)’ and I am using 32-bit Windows 7, Python 2.7.

If I’m using this class incorrectly and I could determine the changed values via other properties, please let me know. Thanks!

fswatcher.py (1.01 KB)

Please use Phoenix r74113.

The exact same problem is present in r74113.

···

On Thursday, June 6, 2013 4:53:30 PM UTC-4, Boštjan Mejak wrote:

Please use Phoenix r74113.

Zac Stringham wrote:

I'm trying to utilize the wx.FileSystemWatcher class, however the
wx.FileSystemWatcherEvent class seems to be providing next to no
information. I'm almost certain this is not the intentional behavior,
though I could be wrong.

The event has the properties (Path, NewPath) with accessors (GetPath,
GetNewPath) which should reference the file events that take place in
the monitored directories. However, these aren't very helpful. For
example, suppose you are watching the directory 'spam' which contains 10
files. You rename 1 file, 'hamspam.py' to 'spamham.py' and receive an
associated wx.FileSystemWatcherEvent with the ChangeType as
wx.FSW_EVENT_RENAME. You then should expect that Path would be
'spam/hamspam.py' and NewPath would be 'spam/spamham.py'. However, both
attributes simply come as 'spam' and I see no reference to either
'hamspam.py' nor 'spamham.py' (old vs. new values).

This is probably a bug in the MSW implementation, on OSX it provides the path names including the affected files. Please create a ticket for this at trac.wxwidgets.org.

···

--
Robin Dunn
Software Craftsman