From b0e02c831ae788c1838fc7dc2aee8734ecb4a3bb Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Mon, 8 Oct 2018 11:20:45 -0500 Subject: [PATCH] Fix winpaths' call to wintypes in py3k --- src/fixes/fix_winpaths.py | 12 ++++++++++++ src/main.py | 4 ++++ 2 files changed, 16 insertions(+) create mode 100644 src/fixes/fix_winpaths.py diff --git a/src/fixes/fix_winpaths.py b/src/fixes/fix_winpaths.py new file mode 100644 index 0000000..fc5cbe0 --- /dev/null +++ b/src/fixes/fix_winpaths.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +import ctypes +import winpaths +from ctypes import wintypes + +def _get_path_buf(csidl): + path_buf = ctypes.create_unicode_buffer(wintypes.MAX_PATH) + result = winpaths._SHGetFolderPath(0, csidl, 0, 0, path_buf) + return path_buf.value + +def fix(): + winpaths._get_path_buf = _get_path_buf \ No newline at end of file diff --git a/src/main.py b/src/main.py index b14288c..b6299ee 100644 --- a/src/main.py +++ b/src/main.py @@ -1,5 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals # at top of module +# this is the first fix we have to import just before the paths module would. +# it changes a call from wintypes to ctypes. +from fixes import fix_winpaths +fix_winpaths.fix() import os import logging import storage