Closed fabifont closed 3 years ago
Thanks for the excellent repro steps! I'd generally recommend to use pdoc buchino
over pdoc *.py
, but we certainly should not crash.
I have just pushed a fix to main. Could you please update and verify that it works for you?
pip install -U https://github.com/mitmproxy/pdoc/archive/main.zip
Thanks for the excellent repro steps! I'd generally recommend to use
pdoc buchino
overpdoc *.py
, but we certainly should not crash.I have just pushed a fix to main. Could you please update and verify that it works for you?
pip install -U https://github.com/mitmproxy/pdoc/archive/main.zip
Thanks for the reply. With your latest update now pdoc partially builds the documentation. I get that error:
/home/fabio/.local/lib/python3.9/site-packages/pdoc/doc.py:423: RuntimeWarning: Couldn't import buchino.booker:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 173, in load_module
return importlib.import_module(module)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/fabio/Projects/./buchino/booker.py", line 7, in <module>
import scraper as scraper
ModuleNotFoundError: No module named 'scraper'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/doc.py", line 421, in submodules
module = extract.load_module(mod.name)
File "/usr/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 175, in load_module
raise RuntimeError(f"Error importing {module}") from e
RuntimeError: Error importing buchino.booker
warnings.warn(
/home/fabio/.local/lib/python3.9/site-packages/pdoc/doc.py:423: RuntimeWarning: Couldn't import buchino.bot:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 173, in load_module
return importlib.import_module(module)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/fabio/Projects/./buchino/bot.py", line 11, in <module>
from db import controller as controller
ModuleNotFoundError: No module named 'db'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/doc.py", line 421, in submodules
module = extract.load_module(mod.name)
File "/usr/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 175, in load_module
raise RuntimeError(f"Error importing {module}") from e
RuntimeError: Error importing buchino.bot
warnings.warn(
/home/fabio/.local/lib/python3.9/site-packages/pdoc/doc.py:423: RuntimeWarning: Couldn't import buchino.main:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 173, in load_module
return importlib.import_module(module)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/fabio/Projects/./buchino/main.py", line 5, in <module>
import bot as bot
ModuleNotFoundError: No module named 'bot'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/doc.py", line 421, in submodules
module = extract.load_module(mod.name)
File "/usr/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 175, in load_module
raise RuntimeError(f"Error importing {module}") from e
RuntimeError: Error importing buchino.main
warnings.warn(
/home/fabio/.local/lib/python3.9/site-packages/pdoc/doc.py:423: RuntimeWarning: Couldn't import buchino.scraper:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 173, in load_module
return importlib.import_module(module)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/fabio/Projects/./buchino/scraper.py", line 12, in <module>
from db import controller as controller
ModuleNotFoundError: No module named 'db'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/doc.py", line 421, in submodules
module = extract.load_module(mod.name)
File "/usr/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 175, in load_module
raise RuntimeError(f"Error importing {module}") from e
RuntimeError: Error importing buchino.scraper
warnings.warn(
/home/fabio/.local/lib/python3.9/site-packages/pdoc/__init__.py:405: RuntimeWarning: Error importing buchino.booker:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 173, in load_module
return importlib.import_module(module)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/fabio/Projects/./buchino/booker.py", line 7, in <module>
import scraper as scraper
ModuleNotFoundError: No module named 'scraper'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/__init__.py", line 403, in pdoc
m = extract.load_module(module)
File "/usr/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 175, in load_module
raise RuntimeError(f"Error importing {module}") from e
RuntimeError: Error importing buchino.booker
warnings.warn(
/home/fabio/.local/lib/python3.9/site-packages/pdoc/__init__.py:405: RuntimeWarning: Error importing buchino.bot:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 173, in load_module
return importlib.import_module(module)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/fabio/Projects/./buchino/bot.py", line 11, in <module>
from db import controller as controller
ModuleNotFoundError: No module named 'db'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/__init__.py", line 403, in pdoc
m = extract.load_module(module)
File "/usr/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 175, in load_module
raise RuntimeError(f"Error importing {module}") from e
RuntimeError: Error importing buchino.bot
warnings.warn(
/home/fabio/.local/lib/python3.9/site-packages/pdoc/__init__.py:405: RuntimeWarning: Error importing buchino.main:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 173, in load_module
return importlib.import_module(module)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/fabio/Projects/./buchino/main.py", line 5, in <module>
import bot as bot
ModuleNotFoundError: No module named 'bot'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/__init__.py", line 403, in pdoc
m = extract.load_module(module)
File "/usr/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 175, in load_module
raise RuntimeError(f"Error importing {module}") from e
RuntimeError: Error importing buchino.main
warnings.warn(
/home/fabio/.local/lib/python3.9/site-packages/pdoc/__init__.py:405: RuntimeWarning: Error importing buchino.scraper:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 173, in load_module
return importlib.import_module(module)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/fabio/Projects/./buchino/scraper.py", line 12, in <module>
from db import controller as controller
ModuleNotFoundError: No module named 'db'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/__init__.py", line 403, in pdoc
m = extract.load_module(module)
File "/usr/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 175, in load_module
raise RuntimeError(f"Error importing {module}") from e
RuntimeError: Error importing buchino.scraper
warnings.warn(
Project structure is the same. I tried both http (pdoc -d google buchino
) and html (pdoc -d google buchino -o buchino/docs/
) mode but they give the same error.
I think the core problem is really is that you have a __init__.py
, which signals that your project is a module. However your imports do not match that: from db import controller as controller
states that you want to import the module db
, but if buchino
is a module that should either be buchino.db
or .db
. So you should kind of make up your mind what you want to do here. :)
There is always a problem:
__init__.py
it says module buchino not found
buchino.
in front of imports it builds better but:
python3 main.py
: ModuleNotFoundError: No module named 'buchino'
bot.py
:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 173, in load_module
return importlib.import_module(module)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/fabio/Projects/./buchino/bot.py", line 51, in <module>
bot = Bot(get_value("token"))
File "/home/fabio/Projects/./buchino/utils/config.py", line 18, in get_value
return config.get("Telegram", key)
File "/usr/lib/python3.9/configparser.py", line 781, in get
d = self._unify_values(section, vars)
File "/usr/lib/python3.9/configparser.py", line 1152, in _unify_values
raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'Telegram'
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/doc.py", line 421, in submodules module = extract.load_module(mod.name) File "/usr/lib/python3.9/contextlib.py", line 79, in inner return func(*args, **kwds) File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 175, in load_module raise RuntimeError(f"Error importing {module}") from e RuntimeError: Error importing buchino.bot
warnings.warn(
/home/fabio/.local/lib/python3.9/site-packages/pdoc/doc.py:423: RuntimeWarning: Couldn't import buchino.main:
Traceback (most recent call last):
File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 173, in load_module
return importlib.import_module(module)
File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/doc.py", line 421, in submodules module = extract.load_module(mod.name) File "/usr/lib/python3.9/contextlib.py", line 79, in inner return func(*args, **kwds) File "/home/fabio/.local/lib/python3.9/site-packages/pdoc/extract.py", line 175, in load_module raise RuntimeError(f"Error importing {module}") from e RuntimeError: Error importing buchino.main
warnings.warn(
Problem Description
I had a project with that structure:
and I could build the documentation with:
pdoc -d google *.py -o docs/
Then I decided to put some files into some folders and the last project structure is:But now when I try to build the documentation with the same command I get that error:
More info about the project structure: https://github.com/fabifont/buchino/pull/16#issuecomment-888171961
Steps to reproduce the behavior:
https://github.com/fabifont/buchino.git
cd buchino
git checkout dev
pdoc -d google *.py -o docs/
System Information