Python Forum
ModuleNotFoundError after publishing project - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: ModuleNotFoundError after publishing project (/thread-34851.html)



ModuleNotFoundError after publishing project - mattshu - Sep-07-2021

So I'm pretty sure I followed the PyPI tutorial to a T. I have the entry point set for the __main__.py script's main method. The build process (setup.py sdist bdist_wheel) finished without errors. It even shows the 'missing modules' during the build. Yet when I install the module, it tells me

PS C:\Users\shu\Projects\bayscrape> bayscrape
Traceback (most recent call last):
  File "C:\Users\shu\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\shu\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\shu\AppData\Local\Programs\Python\Python39\Scripts\bayscrape.exe\__main__.py", line 4, in <module>
  File "C:\Users\shu\AppData\Local\Programs\Python\Python39\lib\site-packages\bayscr\__main__.py", line 5, in <module>
    from bsutils import get_input, output
ModuleNotFoundError: No module named 'bsutils'
The first line of code in __main__.py is from bsutils import get_input, output. Why isn't the bsutils module found when it's included during the setup process? I'm missing something small aren't I?


RE: ModuleNotFoundError after publishing project - mattshu - Sep-07-2021

SO I learned I had to reference the project name for each import in each file Dance so from bayscrape.bsutils import ... did the trick

topic can be closed thank you anyway!


RE: ModuleNotFoundError after publishing project - jefsummers - Sep-07-2021

Thank you for sharing once you got the solution. Not everyone does so...