|
1 | 1 | import os |
2 | 2 | import sys |
3 | | -from ctypes import (WINFUNCTYPE, windll, POINTER, byref, c_int, |
| 3 | +from ctypes import (windll, POINTER, byref, c_int, |
4 | 4 | create_unicode_buffer, c_wchar_p) |
5 | | -from ctypes.wintypes import LPWSTR, LPCWSTR |
6 | 5 |
|
7 | 6 |
|
8 | 7 | def fix_env_on_windows(): |
9 | 8 | def getEnvironmentVariable(name): |
10 | | - name= unicode(name) # make sure string argument is unicode |
11 | | - n= windll.kernel32.GetEnvironmentVariableW(name, None, 0) |
12 | | - if n==0: |
| 9 | + name = unicode(name) # make sure string argument is unicode |
| 10 | + n = windll.kernel32.GetEnvironmentVariableW(name, None, 0) |
| 11 | + if n == 0: |
13 | 12 | return None |
14 | | - buf= create_unicode_buffer(u'\0'*n) |
| 13 | + buf = create_unicode_buffer(u'\0'*n) |
15 | 14 | windll.kernel32.GetEnvironmentVariableW(name, buf, n) |
16 | 15 | return buf.value |
17 | 16 | for k in os.environ.keys(): |
@@ -43,8 +42,8 @@ def fix_argv_on_windows(): |
43 | 42 | break |
44 | 43 | argv = argv[1:] |
45 | 44 | if arg == '-m': |
46 | | - # sys.argv[0] should really be the absolute path of the module source, |
47 | | - # but never mind |
| 45 | + # sys.argv[0] should really be the absolute path of the module |
| 46 | + # source, but never mind |
48 | 47 | break |
49 | 48 | if arg == '-c': |
50 | 49 | argv[0] = '-c' |
|
0 commit comments