Skip to content

Commit

Permalink
[IMPR] Add a hint to import missing module in wrapper.py
Browse files Browse the repository at this point in the history
Change-Id: I4286cd234be63787a7988d9152a940f3bfdf070e
  • Loading branch information
xqt committed Aug 9, 2024
1 parent c23b572 commit d77a6d0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pywikibot/scripts/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,10 @@ def check_modules(script: str | None = None) -> bool:
# we need to re-start the entire process. Ask the user to do so.
print('Now, you have to re-execute the command to start your script.')
sys.exit(1)
except ImportError as e: # raised in textlib or backports
sys.exit(e)
except ModuleNotFoundError as module: # raised in textlib or backports
print(f'\n{module.msg}\nPlease install it with\n\n'
f' pip install {module.name}')
sys.exit()


def find_alternates(filename, script_paths):
Expand Down

0 comments on commit d77a6d0

Please sign in to comment.