jskinner / DefaultPackages

Old bug tracker for Sublime Text's "Default Packages", e.g. bad syntax highlighting
http://web.archive.org/web/20150524043750/https://www.sublimetext.com/forum/viewtopic.php?f=2&t=12095
26 stars 2 forks source link

Uncaught error when running diff_changes on a view whose file doesn't exist #96

Closed FichteFoll closed 7 years ago

FichteFoll commented 9 years ago

Can easily be recreated by opening the default settings/key bindings.

The straigt forward traceback is the following:

Unable to open /C/Users/Fichte/AppData/Roaming/Sublime Text 3/Packages/Diff/diff.py
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 549, in run_
    return self.run(edit)
  File "diff in C:\Program Files\Sublime Text 3\Packages\Diff.sublime-package", line 44, in run
  File "./codecs.py", line 885, in open

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Fichte\\AppData\\Roaming\\Sublime Text 3\\Packages\\Diff\\diff.py'

Also, the code is likely bleeding file leaks (never used codecs module) and should be using

with codecs.open(fname, "r", "utf-8") as f:
    a = f.read().splitlines()

instead.

keith-hall commented 7 years ago

As diff.py is now PR-able at https://github.com/sublimehq/Packages/tree/master/Diff, one could submit a PR to fix this