sveetch/boussole

Watch mode bug on uncomment process

Closed this issue · 1 comments

During compile with watch mode, it seems we have an encoding bug:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, 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 446, in dispatch
    self.on_any_event(event)
  File "/usr/local/lib/python2.7/dist-packages/boussole/watcher.py", line 173, in on_any_event
    self.index()
  File "/usr/local/lib/python2.7/dist-packages/boussole/watcher.py", line 91, in index
    library_paths=self.settings.LIBRARY_PATHS
  File "/usr/local/lib/python2.7/dist-packages/boussole/inspector.py", line 106, in inspect
    self.look_source(sourcepath, library_paths=library_paths)
  File "/usr/local/lib/python2.7/dist-packages/boussole/inspector.py", line 79, in look_source
    self.look_source(path, library_paths=library_paths)
  File "/usr/local/lib/python2.7/dist-packages/boussole/inspector.py", line 63, in look_source
    finded_paths = self.parse(fp.read())
  File "/usr/local/lib/python2.7/dist-packages/boussole/parser.py", line 134, in parse
    self.remove_comments(content)
  File "/usr/local/lib/python2.7/dist-packages/boussole/parser.py", line 83, in remove_comments
    return self.REGEX_COMMENTS.sub("", content)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 102: ordinal not in range(128)

This happens on the first change, even if the file is empty without any comment. Maybe i introduced the bug during porting to Python3 ?

Duplicate of #17