Skip to content

Commit

Permalink
Fix exceptions for pywin32 removal (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
isuruf authored Aug 15, 2022
1 parent 80c409b commit e6900f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions menuinst/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,13 @@ def install(path, remove=False, prefix=sys.prefix, recursing=False, root_prefix=
if isUserAdmin():
_install(path, remove, prefix, mode='system', root_prefix=root_prefix)
else:
from pywintypes import error
retcode = 1
try:
if not recursing:
retcode = runAsAdmin([join(root_prefix, 'python'), '-c',
"import menuinst; menuinst.install(%r, %r, %r, %r, %r)" % (
path, bool(remove), prefix, True, root_prefix)])
except error:
except WindowsError:
pass

if retcode != 0:
Expand Down
3 changes: 1 addition & 2 deletions menuinst/win32.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import logging
import os
from os.path import isdir, join, exists, split
import pywintypes
import sys
import locale

Expand Down Expand Up @@ -202,7 +201,7 @@ def __init__(self, name, prefix=unicode_root_prefix, env_name=u"", mode=None, ro
% (name, self.prefix, env_name, mode, used_mode, root_prefix))
try:
self.set_dir(name, self.prefix, env_name, used_mode, root_prefix)
except (WindowsError, pywintypes.error):
except WindowsError:
# We get here if we aren't elevated. This is different from
# permissions: a user can have permission, but elevation is still
# required. If the process isn't elevated, we get the
Expand Down

0 comments on commit e6900f7

Please sign in to comment.