Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError in /pdoc/extract.py #680

Open
pnjun opened this issue Apr 10, 2024 · 2 comments
Open

TypeError in /pdoc/extract.py #680

pnjun opened this issue Apr 10, 2024 · 2 comments
Labels

Comments

@pnjun
Copy link

pnjun commented Apr 10, 2024

Problem Description

When running pdoc, i get a TypeError. I cannot figure out if this is a bug in pdoc or if it is a problem with my project, since the traceback is completely internal to pdoc files and does not show any file from my module, so i would not even know where to start looking for errors.

If the problem is with my package and not pdoc itself, i suppose a better error message would be appropriate.
Does anyone have insights in what could cause the issue?

Thanks

Traceback (most recent call last):
  File "/home/leverfab/.conda/envs/fabdev/bin//pdoc", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/leverfab/.conda/envs/fabdev/lib/python3.11/site-packages/pdoc/__main__.py", line 199, in cli
    pdoc.pdoc(
  File "/home/leverfab/.conda/envs/fabdev/lib/python3.11/site-packages/pdoc/__init__.py", line 509, in pdoc
    for module_name in extract.walk_specs(modules):
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/leverfab/.conda/envs/fabdev/lib/python3.11/site-packages/pdoc/extract.py", line 74, in walk_specs
    for m in walk_packages2([mod_info]):
  File "/home/leverfab/.conda/envs/fabdev/lib/python3.11/site-packages/pdoc/extract.py", line 306, in walk_packages2
    yield from walk_packages2(submodules.values())
  File "/home/leverfab/.conda/envs/fabdev/lib/python3.11/site-packages/pdoc/extract.py", line 305, in walk_packages2
    submodules = iter_modules2(module)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/home/leverfab/.conda/envs/fabdev/lib/python3.11/site-packages/pdoc/extract.py", line 257, in iter_modules2
    member = getattr(module, name, None)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: attribute name must be string, not 'type'

Steps to reproduce the behavior:

run PDOC_ALLOW_EXEC=1 pdoc ./mypackage docformat google -o ./somefolder

System Information

pdoc: 14.4.0
Python: 3.11.0
Platform: Linux-3.10.0-1160.80.1.el7.x86_64-x86_64-with-glibc2.17

@pnjun pnjun added the bug label Apr 10, 2024
@mhils
Copy link
Member

mhils commented Apr 10, 2024

The problem here is that dir(module) returns a non-str object in your module. We should catch that in pdoc and ignore it.

@pnjun
Copy link
Author

pnjun commented Apr 11, 2024

Thanks a lot! I will try to figure out where i return that object and see how to deal with it on my end. I have never contributed to an open source project before, but if I manage to get on to it i will try to make a pull request and fix in pdoc if it's alright with you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants