gornostal / Modific

Highlight lines changed since the last commit (supports Git, SVN, Bazaar, Mercurial and TFS) / ST2(3) plugin
614 stars 44 forks source link

UnicodeDecodeError when file isn't under any VCS #78

Closed mrliptontea closed 9 years ago

mrliptontea commented 9 years ago

I noticed that, while opening or saving some file, that is not under any version control, this exception appears in console:

Exception in thread Thread-37:
Traceback (most recent call last):
  File "./threading.py", line 901, in _bootstrap_inner
  File "./threading.py", line 858, in run
  File "./subprocess.py", line 1177, in _readerthread
  File "./encodings/cp1250.py", line 23, in decode
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 29: character maps to <undefined>

It doesn't point to any modific files, but I checked - if I uninstall modific exception isn't thrown.

Can something be done about that? I use ST3, Windows 8.1 x64

PS Thanks for really helpful package ;)

gornostal commented 9 years ago

Are you sure it's Modific? Could you provide a file that causes this exception?

mrliptontea commented 9 years ago

I moved all my packages to temp folder and I was restoring them one by one (except Package Control, to avoid auto-reinstalling all missing ones) and exception appears if modific is present.

It can be really any file, I can reproduce this every time, whatever the file's type is. I just checked on some file that's in repository, it was OK (no exceptions), then copied it to another, new folder, outside of repo's working copy, opened in Sublime by double click, and exception was thrown.

New log on exception appears every time I open, switch to the tab with such file, or save it. It does not seem to break anything, though.

gornostal commented 9 years ago

Hi @mrliptontea,

I pushed a fix to issue-78 branch. Could you try to checkout that branch and tell if it fixed the bug? I can do it myself, but I don't know when I'll be able to try it on Windows 8.

Thanks.

mrliptontea commented 9 years ago

Hi @gornostal,

I finally found time to check it out. Sorry, but no luck with this fix.

Just to be sure, steps I did:

  1. Removed Modific && shutdown Sublime
  2. Git clone && checkout branch issue-78 to Sublime Packages folder
  3. Started Sublime && opened console panel
  4. Opened non-vcs file -> exception
  5. Moved modific outside packages folder (removed from ST)
  6. 3 && 4 again -> no errors whatsoever
mrliptontea commented 9 years ago

Hey @gornostal again,

Good news! You were right about the cause, it just wasn't fixed everywhere it can occur. In Modific.py#L59 changing touniversal_newlines=False did it.

Since I don't see any more uses of Popen, issue is about to be fixed :wink:

gornostal commented 9 years ago

It's good to hear the fix works. I set universal_newlines=False everywhere and pushed to the master branch.