From 2920784f43bc24647d128dcac049bf6a2a0aad11 Mon Sep 17 00:00:00 2001 From: Matt Wilkie Date: Sat, 20 Jun 2015 22:09:08 -0700 Subject: [PATCH] don't ValueError fail wintypes import on non-Windows ...as per suggestion on Python.org bug tracker http://bugs.python.org/issue16396 Another run at #48 --- knownpaths.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/knownpaths.py b/knownpaths.py index 3de720e..8ebfa69 100644 --- a/knownpaths.py +++ b/knownpaths.py @@ -1,10 +1,17 @@ '''Python wrapper around the SHGetKnownFolderPath Windows Shell function knownpaths.py, from https://gist.github.com/mkropat/7550097 ''' -import ctypes, sys -from ctypes import windll, wintypes -from uuid import UUID +import sys +import ctypes +try: + + from ctypes import windll, wintypes +except ImportError, ValueError: + # catch ImportError and ValueError due to issue16396 + # http://bugs.python.org/issue16396 + pass +from uuid import UUID class GUID(ctypes.Structure): # [1] _fields_ = [ ("Data1", wintypes.DWORD),