Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check python version before import imp #30

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions utool/util_inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,15 @@ def rrr(verbose=True):
if not __RELOAD_OK__:
raise Exception('Reloading has been forced off')
try:
import imp
v = sys.version_info
if v.major >= 3 and v.minor >= 4:
import importlib
importlib.reload(module)
else:
import imp
imp.reload(module)
if verbose and not QUIET:
builtins.print('RELOAD: ' + str(module_prefix) + ' __name__=' + module_name)
imp.reload(module)
except Exception as ex:
print(ex)
print('%s Failed to reload' % module_prefix)
Expand Down
Loading