-
-
Notifications
You must be signed in to change notification settings - Fork 144
ImportError and ModuleNotFoundError While Trying to Generate HTML Documentation #137
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
Comments
There is |
Yes, |
Hmmm, |
The
However the error changes to not being able to find a section of an INI file. But again, the INI file exists and so does the section. (Also, Just to make sure, I tested the config info retrieval from a separate test file in the same directory as
|
UPDATE: I tried running pdoc inside lcms_nmr_script, going through each package and module within it, and it seems to work fine, except for a few UserWarnings like the ones in the previous post. However it would be better if one could run it for the entire package and access the documentation (sub-)sections from a common sidebar. |
I think the issues you're facing might stem from the imports you're using. Can you make sure you use either absolute imports (all import lines starting with |
Doesn't seem to change the result, I'm afraid. All the imports of custom modules are now of the form
(You can see the change in the UserWarnings.) The error occurs both with and without the change to
|
Another update: Traced the issue to the path supplied for the INI file (it wasn't the path from the root package directory). Once that was corrected, all the documentation was generated in one go. The documentation looks great on first glance, however a bunch of UserWarnings were thrown. Thanks for your help and patience. I have pasted the warnings for your reference. I will leave it up to you to decide whether or not this is a bug and if this issue can be closed. :)
|
If The same goes for other listed modules. They are either implicit and unavailable (as above), compiled to binaries, or otherwise unreadable by Lines 224 to 227 in 86eac27
Glad you have it working. 🥂 |
Hi, sorry about commenting on a past, closed issue, but I have exaclty the same as the original problem of @navneethc @kernc, is pdoc supposed to work with namespace packages (besides the warnings)? |
BTW, although I have the same problem that @navneethc originally had (module not found even though it is there and it is perfectly importable e.g. from within the python shell), I get a different warning upon invocation of pdoc:
python 3.8.2, pdoc 0.8.4 |
Have you tried following the recommended workaround? The issue is most likely related to process' current working directory and stated import paths.
@mfrigerio17 Can you post the full stack trace? Yours seem to be missing the crucial final lines ... The DeprecationWarning about imp module is mostly irrelevant. |
Thanks for the swift reply. I always use only absolute imports, so I guess that is not my problem (?) Full stack trace
Maybe I should mention I am working in a python virtual environment, and my |
... Importing from the shell, with activated venv, from arbitrary directory? ( cd /tmp; python -c 'import kgprim.motions as motions'; ) We do play around with import paths, but not in a way that shouldn't work ... I think. 🤔 Lines 183 to 191 in 04960e4
Note, isdir() and isfile() branches hit only if module is a literal filesystem path. This is really only relevant for the top referenced module.
|
Is pdoc run from the same venv (
This indicates it might not be the case. Maybe related: #44 (comment). |
Yes, indeed.
mhmm... indeed However I restarted my terminal and reactived the virtualenv, and it now works!! Thanks a lot!! So, for other users who may run into the same issue as me:
Thanks again |
I think I managed to reproduce the issue. It appears only when installing in development mode. Steps:
It should fail saying that Note that with a regular install (not development mode) I had no issue at all, and it wasn't even necessary to install pdoc in the virtual environment. The system-wide one worked fine |
Refs: 5ab5739 Refs: #137 (comment) Refs: davidhalter/jedi#532 Thanks @mfrigerio17
Environment:
Windows 10
Anaconda Environment
Python 3.7.5
pdoc3 0.7.2 (installed with pip from PyPI, inside the conda env.)
I currently have a package of Python scripts with some sub-packages and modules within it. When I try to generate HTML documentation, it quickly terminates with an error.
Expected Behavior
HTML documentation is generated.
Actual Behavior
Steps to Reproduce
pdoc --html <package directory>
Additional info
The text was updated successfully, but these errors were encountered: