def _windows_long_path_name(short_path):
 if (not isinstance(short_path, six.text_type)):
  short_path = short_path.decode(_fsencoding())
 import ctypes
 buf = ctypes.create_unicode_buffer(260)
 get_long_path_name_w = ctypes.windll.kernel32.GetLongPathNameW
 return_value = get_long_path_name_w(short_path, buf, 260)
 if ((return_value == 0) or (return_value > 260)):
  return short_path
 else:
  long_path = buf.value
  if ((len(long_path) > 1) and (long_path[1] == ':')):
   long_path = (long_path[0].upper() + long_path[1:])
  return long_path

def _windows_long_path_name ( short_path ) : if ( not isinstance ( short_path , six . text_type ) ) : short_path = short_path . decode ( _fsencoding ( ) ) import ctypes buf = ctypes . create_unicode_buffer ( 260 ) get_long_path_name_w = ctypes . windll . kernel32 . GetLongPathNameW return_value = get_long_path_name_w ( short_path , buf , 260 ) if ( ( return_value == 0 ) or ( return_value > 260 ) ) : return short_path else : long_path = buf . value if ( ( len ( long_path ) > 1 ) and ( long_path [ 1 ] == ':' ) ) : long_path = ( long_path [ 0 ] . upper ( ) + long_path [ 1 : ] ) return long_path
use windows getlongpathnamew via ctypes to get the canonical .