Skip to content

Commit

Permalink
Fix unicode() issue for python3
Browse files Browse the repository at this point in the history
  • Loading branch information
dmpetrov committed May 5, 2017
1 parent f13b4cb commit 5cc2f0d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dvc/system.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ctypes
import os
import re
from builtins import str

if os.name == 'nt':
from ctypes import create_unicode_buffer, windll
Expand Down Expand Up @@ -85,7 +86,7 @@ def get_long_path(path):

buffer = create_unicode_buffer(System.LONG_PATH_BUFFER_SIZE)
get_long_path_name = windll.kernel32.GetLongPathNameW
result = get_long_path_name(unicode(path), buffer, System.LONG_PATH_BUFFER_SIZE)
result = get_long_path_name(u'%s' % str(path), buffer, System.LONG_PATH_BUFFER_SIZE)
if result == 0 or result > System.LONG_PATH_BUFFER_SIZE:
return path
return buffer.value
Expand Down

0 comments on commit 5cc2f0d

Please sign in to comment.