I've got watchdog and pyaudio playing together so if either of two directories is modified I hear a sound.
Now I'm trying to get a different sound for each directory. Watchdog can print the path that triggered it, so I'm trying to use that difference to fire each sound.
def on_modified(self, event,):
x = event.src_path
print(x)
if x == 'c:/WATCHDOGTEST\x.csv':
pyaudio_01.PLAY_SOUND()
if x == 'c:/WATCHDOGTEST2\x.csv':
pyaudio_02.PLAY_SOUND()
The print(x) works fine:
c:/WATCHDOGTEST2\x.csv
however - the if statement won't work - I get:
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 16-17: truncated \xXX escape
Any ideas appreciated!