Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1""" 

2@file 

3@brief Some fixes for deprecated functions and not updated packages. 

4""" 

5import os 

6import sys 

7 

8 

9def fix_win32ctypes_core_cffi__advapi32_py(filename=None, fileout=None, fLOG=None): 

10 """ 

11 Fixes the following issue: 

12 

13 :: 

14 

15 File "C:\\Python37-x64\\lib\\site-packages\\win32ctypes\\pywin32\\__init__.py", line 21, in <module> 

16 from win32ctypes.pywin32 import win32api 

17 File "C:\\Python37-x64\\lib\\site-packages\\win32ctypes\\pywin32\\win32api.py", line 23, in <module> 

18 from win32ctypes.core import _common, _kernel32, _backend 

19 File "C:\\Python37-x64\\lib\\site-packages\\win32ctypes\\core\\__init__.py", line 39, in <module> 

20 from .cffi import _advapi32, _common, _kernel32 

21 File "C:\\Python37-x64\\lib\\site-packages\\win32ctypes\\core\\cffi\\_advapi32.py", line 198 

22 

23 ^ 

24 SyntaxError: invalid syntax 

25 Command exited with code 1 

26 

27 If that errors happens, you could add: 

28 

29 :: 

30 

31 python -c "from pymyinstall.fix import fix_win32ctypes_core_cffi__advapi32_py;fix_win32ctypes_core_cffi__advapi32_py(fLOG=print)" 

32 """ 

33 if sys.platform.startswith("win") and sys.version_info[:2] >= (3, 6): 

34 if filename is None: 

35 filename = os.path.join(os.path.dirname( 

36 sys.executable), "lib\\site-packages\\win32ctypes\\core\\cffi\\_advapi32.py") 

37 if not os.path.exists(filename): 

38 if fLOG: 

39 fLOG( 

40 "[fix_win32ctypes_core_cffi__advapi32_py] '{0}' not found".format(filename)) 

41 return 

42 if fileout is None: 

43 fileout = filename 

44 if fLOG: 

45 fLOG( 

46 "[fix_win32ctypes_core_cffi__advapi32_py] found '{0}'".format(filename)) 

47 with open(filename, "r", encoding="utf-8") as f: 

48 content = f.read() 

49 content = content.replace("\r", "\n").replace("\n\n", "\n") 

50 with open(fileout, "w", encoding="utf-8") as f: 

51 f.write(content) 

52 

53 

54if __name__ == "__main__": 

55 fix_win32ctypes_core_cffi__advapi32_py()