gregghz / Watcher

Watcher is a daemon that watches specified files/folders for changes and fires commands in response to those changes. It is similar to incron, however, configuration uses a simpler to read yaml file instead of a plain text file. It's also written in Python, making it easier to hack.
MIT License
245 stars 128 forks source link

ValueError: No closing quotation #25

Open Just8Will opened 5 years ago

Just8Will commented 5 years ago

Hi,

Watcher fails with the following log file.

2019-10-16 18:55:25.665159 <open file '/home/will/.watcher/jobs.yml', mode 'r' at 0x7ff62c653f60> job1 Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/usr/lib/python2.7/dist-packages/pyinotify.py", line 1505, in run self.loop() File "/usr/lib/python2.7/dist-packages/pyinotify.py", line 1491, in loop self.process_events() File "/usr/lib/python2.7/dist-packages/pyinotify.py", line 1287, in process_events self._default_proc_fun(revent) File "/usr/lib/python2.7/dist-packages/pyinotify.py", line 924, in __call__ return _ProcessEvent.__call__(self, event) File "/usr/lib/python2.7/dist-packages/pyinotify.py", line 644, in __call__ return meth(event) File "/home/will/Watcher/watcher.py", line 268, in process_IN_MOVED_TO self.runCommand(event, False) File "/home/will/Watcher/watcher.py", line 212, in runCommand subprocess.call(shlex.split(command)) File "/usr/lib/python2.7/shlex.py", line 279, in split return list(lex) File "/usr/lib/python2.7/shlex.py", line 269, in next token = self.get_token() File "/usr/lib/python2.7/shlex.py", line 96, in get_token raw = self.read_token() File "/usr/lib/python2.7/shlex.py", line 172, in read_token raise ValueError, "No closing quotation" ValueError: No closing quotation Moved to: /mnt/IcyBox/Videos/RecordedTVShows/World's Deadliest Drivers (2019)/World's Deadliest Drivers (2019) - 2019-10-16 17 30 00 - World's Deadliest Drivers.ts

The jobs.yml file is as shown below:

job1: label: Rename Postprocessed Recorded TV Shows watch: /mnt/IcyBox/Videos/RecordedTVShows exclude: ['/mnt/IcyBox/Videos/RecordedTVShows/.grab', '/mnt/IcyBox/Videos/RecordedTVShows/.stignore'] events: ['create', 'move_to'] options: [] recursive: true command: echo $filename

As you can see All I was trying to do was echo the filename. I did this because the script I was running kept failing so I switched to echo as a debug. Anything you can do to help with this would be appreicated. Is my jobs.yml incorrect or is this a bug in watcher?

gregghz commented 2 years ago

try putting quotes around $filename:

command: echo "$filename"