Closed jwoehr closed 3 years ago
If this by itself works:
>>> import importlib
>>> importlib.import_module('qis_job')
then it's got to be something in our sys.path
munging:
https://github.com/pdoc3/pdoc/blob/aef1917a668ca9f3cd26373d1d69bcb5001108cc/pdoc/__init__.py#L204-L217
I think isdir(module)
or isfile(module)
matches, and then god knows what happens.
Can you try to run it from a different directory?
If this by itself works:
>>> import importlib >>> importlib.import_module('qis_job')
$ import importlib import-im6.q16: attempt to perform an operation not allowed by the security policy `PS' @ error/constitute.c/IsCoderAuthorized/408.
Can you try to run it from a different directory?
Yes, it is the same from any directory.
$ import importlib import-im6.q16: attempt to perform an operation not allowed by the security policy `PS' @ error/constitute.c/IsCoderAuthorized/408.
In the python prompt, not shell.
Can you try to run it from a different directory?
Yes, it is the same from any directory.
I mean pdoc, like cd /tmp; pdoc3 qis_job
, doesn't work?
Oh, goodness ... that was silly of me!
(qiskit_dev_venv6)$ python
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import importlib
>>> importlib.import_module('qis_job')
<frozen importlib._bootstrap>:219: UserWarning: QuantumInspire not installed.
<frozen importlib._bootstrap>:219: UserWarning: Rigetti Forest not installed.
<frozen importlib._bootstrap>:219: UserWarning: qiskit-jku-provider not installed.
<module 'qis_job' from '/home/jax/work/QISKit/qiskit_dev_venv6/lib/python3.8/site-packages/qis_job-3.4-py3.8-linux-x86_64.egg/qis_job/__init__.py'>
>>>
Those "not installed" messages are warnings built into my code, btw
I mean pdoc, like
cd /tmp; pdoc3 qis_job
, doesn't work?
Yes, tried that before I ever posted the issue:
(qiskit_dev_venv6) $ cd /tmp
(qiskit_dev_venv6) $ pdoc3 qis_job
/usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat
Traceback (most recent call last):
File "/home/jax/.local/lib/python3.8/site-packages/pdoc/__init__.py", line 225, in import_module
module = importlib.import_module(module_path)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'qis_job'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jax/.local/bin/pdoc3", line 8, in <module>
sys.exit(main())
File "/home/jax/.local/lib/python3.8/site-packages/pdoc/cli.py", line 532, in main
modules = [pdoc.Module(module, docfilter=docfilter,
File "/home/jax/.local/lib/python3.8/site-packages/pdoc/cli.py", line 532, in <listcomp>
modules = [pdoc.Module(module, docfilter=docfilter,
File "/home/jax/.local/lib/python3.8/site-packages/pdoc/__init__.py", line 609, in __init__
module = import_module(module)
File "/home/jax/.local/lib/python3.8/site-packages/pdoc/__init__.py", line 227, in import_module
raise ImportError('Error importing {!r}: {}: {}'
ImportError: Error importing 'qis_job': ModuleNotFoundError: No module named 'qis_job'
Not sure if relevant, but additional (prior) munging of sys.path
happens here:
https://github.com/pdoc3/pdoc/blob/72e41dbf91646a39bc900ca6f875e5f75660e6a4/pdoc/cli.py#L482-L498
Can you post the value of sys.path
at this point:
https://github.com/pdoc3/pdoc/blob/72e41dbf91646a39bc900ca6f875e5f75660e6a4/pdoc/__init__.py#L224
Or make a simple, minimal reproducible example for someone to examine. Thanks!
The experiment of making it print out sys.path
clarified that it was PEBKAC.
Apologies, bash hash -r
got things sorted out :-/
Expected Behavior
generate documentation for extant module
Actual Behavior
throws error
Steps to Reproduce
Additional info