Skip to content

TypeError on namespace package while working in server mode #461

Description

@USSX-Hares

Steps to Reproduce

  1. Recreate the following structure (creating namespace package):
    extendable_service/
       extensions/# <--- no __init__.py here!
          core/
             __init__.py
             some_code.py
       __init__.py
    
  2. Run pdoc's server:
    pdoc3 ./extendable_service --http localhost:8080
    
  3. Navigate to extendable_service.extensions

Expected:

  • List of submodules is displayed

Actual:

  • Page returns stacktrace
  • Status code is 404
  • Server still working
Stacktrace here
Error importing module pdoc_issues.extensions:

Traceback (most recent call last):
  File "D:\Projects\test\.venv-312\Lib\site-packages\pdoc\cli.py", line 236, in do_GET
    out = self.html()
          ^^^^^^^^^^^
  File "D:\Projects\test\.venv-312\Lib\site-packages\pdoc\cli.py", line 268, in html
    return pdoc.html(self.import_path_from_req_url,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Projects\test\.venv-312\Lib\site-packages\pdoc\__init__.py", line 178, in html
    return mod.html(**kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "D:\Projects\test\.venv-312\Lib\site-packages\pdoc\__init__.py", line 905, in html
    html = _render_template('/html.mako', module=self, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Projects\test\.venv-312\Lib\site-packages\pdoc\__init__.py", line 157, in _render_template
    return t.render(**config).strip()
           ^^^^^^^^^^^^^^^^^^
  File "D:\Projects\test\.venv-312\Lib\site-packages\mako\template.py", line 434, in render
    return runtime._render(self, self.callable_, args, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Projects\test\.venv-312\Lib\site-packages\mako\runtime.py", line 874, in _render
    _render_context(
  File "D:\Projects\test\.venv-312\Lib\site-packages\mako\runtime.py", line 916, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "D:\Projects\test\.venv-312\Lib\site-packages\mako\runtime.py", line 943, in _exec_template
    callable_(context, *args, **kwargs)
  File "_html_mako", line 156, in render_body
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

Meta

  • pdoc version: 0.11.6
  • OS: Windows 10 64bit: 19045.5965
  • Python version: 3.12.1, 3.13.5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions