Closed djkemmet closed 1 year ago
Are you sure this error happened in Linux
too?
As I understand from this log, we had a problem with collecting models in Windows
but it was fixed in v2.1.2, Please upgrade your Panther
to the latest (2.4.0) version and see if this error still happens!
Same Issue on windows - going to focus on windows troubleshooting since that's what my organization will require me to use
Desktop (please complete the following information):
OS: Windows 10 Enterprise (10.0.19045 N/A Build 19045) Python Version: Python 3.11.4 Panther Version: 2.4.0
PS C:\repos\MaxGraph-API\MaxGraph-API> panther run
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Scripts\panther.exe\__main__.py", line 7, in <module>
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\site-packages\panther\cli\main.py", line 31, in start
run(args)
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\site-packages\panther\cli\run_command.py", line 55, in run
uvicorn.run('main:app', **command)
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\site-packages\uvicorn\main.py", line 587, in run
server.run()
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\site-packages\uvicorn\server.py", line 61, in run
return asyncio.run(self.serve(sockets=sockets))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\site-packages\uvicorn\server.py", line 68, in serve
config.load()
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\site-packages\uvicorn\config.py", line 467, in load
self.loaded_app = import_from_string(self.app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\site-packages\uvicorn\importer.py", line 24, in import_from_string
raise exc from None
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\site-packages\uvicorn\importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\repos\MaxGraph-API\MaxGraph-API\main.py", line 3, in <module>
app = Panther(__name__)
^^^^^^^^^^^^^^^^^
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\site-packages\panther\main.py", line 30, in __init__
self.load_configs()
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\site-packages\panther\main.py", line 52, in load_configs
config['models'] = collect_all_models()
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\site-packages\panther\_load_configs.py", line 122, in collect_all_models
klass = import_class(f'{class_path}.models.{n.name}')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\site-packages\panther\_utils.py", line 71, in import_class
module = importlib.import_module(path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<REDACTED>\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'C:\\repos\\MaxGraph-API\\MaxGraph-API\\app'
PS C:\repos\MaxGraph-API\MaxGraph-API> pip show panther
Name: panther
Version: 2.4.0
Summary: Fast & Friendly, Web Framework For Building Async APIs
Home-page: https://github.com/alirn76/panther
Author: Ali RajabNezhad
Author-email: alirn76@yahoo.com
License: MIT
Location: <REDACTED>\AppData\Local\Programs\Python\Python311\Lib\site-packages
Requires: bpython, bson, greenlet, httptools, pantherdb, pydantic, python-jose, redis, rich, uvicorn, watchfiles
Required-by:
PS C:\repos\MaxGraph-API\MaxGraph-API>
The contents of my files remain the same and my idea indicates no errors in the code. I recreated the project fresh with panther 4.2.0 and then copy and pasted the contents from the opening issue into my various files.
Ok, then, thank you for the issue, I'm going to track this issue in Windows ASAP 👍
Fixed in 2.4.1
, Please upgrade your Panther version again.
Describe the bug Panther suddenly throws ModuleNotFoundError in the middle of development. Project structure hasn't changed only contents per the documentation and my idea and my IDE reports no errors with the project.
Expected behavior I expect the app module to be found
Desktop (please complete the following information):
Additional context I have tested on windows, linux, vs code, pycharm, vnev and out and basically when I start making substantive changes to the API project the app module suddenly become unfind-able:
main.py
urls.py
serializers.py
main.py
IDE Error
The error seems to come from main.py which literally hasn't even been touched.