1212import winreg
1313from . import utils
1414from argparse import ArgumentParser
15+ import shutil
1516
1617def get_special_folder_path (path_name ):
1718 """Return special folder path."""
@@ -37,7 +38,7 @@ def remove_winpython_start_menu_folder(current=True):
3738 path = get_winpython_start_menu_folder (current = current )
3839 if Path (path ).is_dir ():
3940 try :
40- shutil .rmtree (path , onexc = onerror )
41+ shutil .rmtree (path )
4142 except WindowsError :
4243 print (f"Directory { path } could not be removed" , file = sys .stderr )
4344
@@ -46,7 +47,7 @@ def create_winpython_start_menu_folder(current=True):
4647 path = get_winpython_start_menu_folder (current = current )
4748 if Path (path ).is_dir ():
4849 try :
49- shutil .rmtree (path , onexc = onerror )
50+ shutil .rmtree (path )
5051 except WindowsError :
5152 print (f"Directory { path } could not be removed" , file = sys .stderr )
5253 Path (path ).mkdir (parents = True , exist_ok = True )
@@ -239,7 +240,7 @@ def register(target, current=True, reg_type=winreg.REG_SZ, verbose=True):
239240 # Create start menu entries
240241 if has_pywin32 :
241242 if verbose :
242- print (f'Creating WinPython menu for all icons in { target .parent } ' )
243+ print (f'Creating WinPython menu for all icons in { Path ( target ) .parent } ' )
243244 for path , desc , fname in _get_shortcut_data (target , current = current , has_pywin32 = True ):
244245 try :
245246 create_shortcut (path , desc , fname , verbose = verbose )
@@ -268,7 +269,7 @@ def unregister(target, current=True, verbose=True):
268269 # Remove start menu shortcuts
269270 if has_pywin32 :
270271 if verbose :
271- print (f'Removing WinPython menu for all icons in { target .parent } ' )
272+ print (f'Removing WinPython menu for all icons in { Path ( target ) .parent } ' )
272273 _remove_start_menu_folder (target , current = current , has_pywin32 = True )
273274 # The original code had commented out code to delete .lnk files individually.
274275 else :
0 commit comments