You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Latex compilation writes several times to the PDF file, which causes an watchdog update each time. The result is a ZeroDivisionError with an empty document:
2015-06-11 12:17:06 - Calculating average word length ...
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/local/lib/python2.7/dist-packages/watchdog/observers/api.py", line 199, in run
self.dispatch_events(self.event_queue, self.timeout)
File "/usr/local/lib/python2.7/dist-packages/watchdog/observers/api.py", line 368, in dispatch_events
handler.dispatch(event)
File "/usr/local/lib/python2.7/dist-packages/watchdog/events.py", line 330, in dispatch
_method_map[event_type](event)
File "tracker.py", line 58, in on_modified
self.analyze_file_event(event)
File "tracker.py", line 67, in analyze_file_event
self.analyze_paper()
File "tracker.py", line 71, in analyze_paper
self.calculate_statistics()
File "tracker.py", line 220, in calculate_statistics
avg_len = float(self.total_word_len) / float(self.num_words)
ZeroDivisionError: float division by zero
I see 3 possible solutions:
Delay parsing of file for some seconds
Group changes, i.e. changes in a certain window, say 30 seconds, are considered as one change
Abort parsing of file if the number of words is 0 but was more before
The text was updated successfully, but these errors were encountered:
I think number 3 will be the best solution if we can catch this by checking number of words != 0. Go ahead and create a pull-request if you can test this and eliminate this error. I won't be able to test it with my Latex compiler (Texpax).
Well, I found out that one compilation results in ~20 changes... I solved it waiting for 10 seconds after the first change and omitting all changes in the following 20 seconds. I'll file a pull request later.
Latex compilation writes several times to the PDF file, which causes an watchdog update each time. The result is a
ZeroDivisionError
with an empty document:I see 3 possible solutions:
The text was updated successfully, but these errors were encountered: