You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pdoc crashes with the following error message if the code to document contains sys.stdout.reconfigure(encoding='utf-8').
$ pdoc foo.py -o docs
Traceback (most recent call last):
File "/home/stolzmann/miniconda3/lib/python3.12/site-packages/pdoc/extract.py", line 218, in load_module
return importlib.import_module(module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stolzmann/miniconda3/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/home/stolzmann/pdoc_bug/foo.py", line 2, in <module>
sys.stdout.reconfigure(encoding='utf-8')
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: '_io.StringIO' object has no attribute 'reconfigure'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/stolzmann/miniconda3/bin/pdoc", line 8, in <module>
sys.exit(cli())
^^^^^
File "/home/stolzmann/miniconda3/lib/python3.12/site-packages/pdoc/__main__.py", line 199, in cli
pdoc.pdoc(
File "/home/stolzmann/miniconda3/lib/python3.12/site-packages/pdoc/__init__.py", line 526, in pdoc
all_modules[module_name] = doc.Module.from_name(module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stolzmann/miniconda3/lib/python3.12/site-packages/pdoc/doc.py", line 406, in from_name
return cls(extract.load_module(name))
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stolzmann/miniconda3/lib/python3.12/contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/home/stolzmann/miniconda3/lib/python3.12/site-packages/pdoc/extract.py", line 220, in load_module
raise RuntimeError(f"Error importing {module}") from e
RuntimeError: Error importing foo
Steps to reproduce the behavior:
Create a file called foo.py with the following content:
Problem Description
pdoc crashes with the following error message if the code to document contains
sys.stdout.reconfigure(encoding='utf-8')
.Steps to reproduce the behavior:
foo.py
with the following content:pdoc foo.py -o docs
to try to render documentation for that file.System Information
The text was updated successfully, but these errors were encountered: