NiklasRosenstein / pydoc-markdown

Create Python API documentation in Markdown format.
http://niklasrosenstein.github.io/pydoc-markdown/
Other
460 stars 105 forks source link

ModuleNotFoundError: No module named 'python_debug_tools' #30

Closed evandrocoan closed 6 years ago

evandrocoan commented 6 years ago

This is the module: https://github.com/evandrocoan/PythonDebugTools/tree/master/all/python_debug_tools

F:\PythonDebugTools\all>ls
python_debug_tools

F:\PythonDebugTools\all>python --version
Python 3.6.3 :: Anaconda, Inc.

F:\PythonDebugTools\all>sh
sh-4.4$ tree
.
└── python_debug_tools
    ├── __init__.py
    ├── logger.py
    └── utilities.py

1 directory, 3 files

F:\PythonDebugTools\all>pydocmd simple python_debug_tools+
Building index...
Traceback (most recent call last):
  File "f:\python\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "f:\python\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "F:\Python\Scripts\pydocmd.exe\__main__.py", line 9, in <module>
  File "f:\python\lib\site-packages\pydocmd\__main__.py", line 197, in main
    add_sections(doc, args.subargs)
  File "f:\python\lib\site-packages\pydocmd\__main__.py", line 170, in add_sections
    [add_sections(doc, x, depth) for x in object_names]
  File "f:\python\lib\site-packages\pydocmd\__main__.py", line 170, in <listcomp>
    [add_sections(doc, x, depth) for x in object_names]
  File "f:\python\lib\site-packages\pydocmd\__main__.py", line 189, in add_sections
    create_sections(object_names, 0)
  File "f:\python\lib\site-packages\pydocmd\__main__.py", line 185, in create_sections
    for sub in dir_object(name):
  File "f:\python\lib\site-packages\pydocmd\imp.py", line 82, in dir_object
    obj = import_object(name)
  File "f:\python\lib\site-packages\pydocmd\imp.py", line 43, in import_object
    return import_object_with_scope(name)[0]
  File "f:\python\lib\site-packages\pydocmd\imp.py", line 63, in import_object_with_scope
    obj = import_module(current_name)
  File "f:\python\lib\site-packages\pydocmd\imp.py", line 35, in import_module
    return __import__(name, fromlist=[''])
ModuleNotFoundError: No module named 'python_debug_tools'
  1. Why this error?
  2. It is because my module is not on the python sys.path?
  3. It is possible to run it without adding it to the sys.path?

Here are some more error messages with different commands:

``` F:\PythonDebugTools\all>pydocmd simple python_debug_tools+ python_debug_tools.logger+ Building index... Traceback (most recent call last): File "f:\python\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "f:\python\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "F:\Python\Scripts\pydocmd.exe\__main__.py", line 9, in File "f:\python\lib\site-packages\pydocmd\__main__.py", line 197, in main add_sections(doc, args.subargs) File "f:\python\lib\site-packages\pydocmd\__main__.py", line 170, in add_sections [add_sections(doc, x, depth) for x in object_names] File "f:\python\lib\site-packages\pydocmd\__main__.py", line 170, in [add_sections(doc, x, depth) for x in object_names] File "f:\python\lib\site-packages\pydocmd\__main__.py", line 189, in add_sections create_sections(object_names, 0) File "f:\python\lib\site-packages\pydocmd\__main__.py", line 185, in create_sections for sub in dir_object(name): File "f:\python\lib\site-packages\pydocmd\imp.py", line 82, in dir_object obj = import_object(name) File "f:\python\lib\site-packages\pydocmd\imp.py", line 43, in import_object return import_object_with_scope(name)[0] File "f:\python\lib\site-packages\pydocmd\imp.py", line 63, in import_object_with_scope obj = import_module(current_name) File "f:\python\lib\site-packages\pydocmd\imp.py", line 35, in import_module return __import__(name, fromlist=['']) ModuleNotFoundError: No module named 'python_debug_tools' F:\PythonDebugTools\all>pydocmd simple .python_debug_tools+ .python_debug_tools.logger+ Building index... Traceback (most recent call last): File "f:\python\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "f:\python\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "F:\Python\Scripts\pydocmd.exe\__main__.py", line 9, in File "f:\python\lib\site-packages\pydocmd\__main__.py", line 197, in main add_sections(doc, args.subargs) File "f:\python\lib\site-packages\pydocmd\__main__.py", line 170, in add_sections [add_sections(doc, x, depth) for x in object_names] File "f:\python\lib\site-packages\pydocmd\__main__.py", line 170, in [add_sections(doc, x, depth) for x in object_names] File "f:\python\lib\site-packages\pydocmd\__main__.py", line 189, in add_sections create_sections(object_names, 0) File "f:\python\lib\site-packages\pydocmd\__main__.py", line 185, in create_sections for sub in dir_object(name): File "f:\python\lib\site-packages\pydocmd\imp.py", line 82, in dir_object obj = import_object(name) File "f:\python\lib\site-packages\pydocmd\imp.py", line 43, in import_object return import_object_with_scope(name)[0] File "f:\python\lib\site-packages\pydocmd\imp.py", line 63, in import_object_with_scope obj = import_module(current_name) File "f:\python\lib\site-packages\pydocmd\imp.py", line 35, in import_module return __import__(name, fromlist=['']) ValueError: Empty module name F:\PythonDebugTools\all>pydocmd simple .python_debug_tools+ Building index... Traceback (most recent call last): File "f:\python\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "f:\python\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "F:\Python\Scripts\pydocmd.exe\__main__.py", line 9, in File "f:\python\lib\site-packages\pydocmd\__main__.py", line 197, in main add_sections(doc, args.subargs) File "f:\python\lib\site-packages\pydocmd\__main__.py", line 170, in add_sections [add_sections(doc, x, depth) for x in object_names] File "f:\python\lib\site-packages\pydocmd\__main__.py", line 170, in [add_sections(doc, x, depth) for x in object_names] File "f:\python\lib\site-packages\pydocmd\__main__.py", line 189, in add_sections create_sections(object_names, 0) File "f:\python\lib\site-packages\pydocmd\__main__.py", line 185, in create_sections for sub in dir_object(name): File "f:\python\lib\site-packages\pydocmd\imp.py", line 82, in dir_object obj = import_object(name) File "f:\python\lib\site-packages\pydocmd\imp.py", line 43, in import_object return import_object_with_scope(name)[0] File "f:\python\lib\site-packages\pydocmd\imp.py", line 63, in import_object_with_scope obj = import_module(current_name) File "f:\python\lib\site-packages\pydocmd\imp.py", line 35, in import_module return __import__(name, fromlist=['']) ValueError: Empty module name F:\PythonDebugTools\all>pydocmd simple .python_debug_tools+ .python_debug_tools.logger++ Building index... Traceback (most recent call last): File "f:\python\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "f:\python\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "F:\Python\Scripts\pydocmd.exe\__main__.py", line 9, in File "f:\python\lib\site-packages\pydocmd\__main__.py", line 197, in main add_sections(doc, args.subargs) File "f:\python\lib\site-packages\pydocmd\__main__.py", line 170, in add_sections [add_sections(doc, x, depth) for x in object_names] File "f:\python\lib\site-packages\pydocmd\__main__.py", line 170, in [add_sections(doc, x, depth) for x in object_names] File "f:\python\lib\site-packages\pydocmd\__main__.py", line 189, in add_sections create_sections(object_names, 0) File "f:\python\lib\site-packages\pydocmd\__main__.py", line 185, in create_sections for sub in dir_object(name): File "f:\python\lib\site-packages\pydocmd\imp.py", line 82, in dir_object obj = import_object(name) File "f:\python\lib\site-packages\pydocmd\imp.py", line 43, in import_object return import_object_with_scope(name)[0] File "f:\python\lib\site-packages\pydocmd\imp.py", line 63, in import_object_with_scope obj = import_module(current_name) File "f:\python\lib\site-packages\pydocmd\imp.py", line 35, in import_module return __import__(name, fromlist=['']) ValueError: Empty module name F:\PythonDebugTools\all>pydocmd simple python_debug_tools++ Building index... Traceback (most recent call last): File "f:\python\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "f:\python\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "F:\Python\Scripts\pydocmd.exe\__main__.py", line 9, in File "f:\python\lib\site-packages\pydocmd\__main__.py", line 197, in main add_sections(doc, args.subargs) File "f:\python\lib\site-packages\pydocmd\__main__.py", line 170, in add_sections [add_sections(doc, x, depth) for x in object_names] File "f:\python\lib\site-packages\pydocmd\__main__.py", line 170, in [add_sections(doc, x, depth) for x in object_names] File "f:\python\lib\site-packages\pydocmd\__main__.py", line 189, in add_sections create_sections(object_names, 0) File "f:\python\lib\site-packages\pydocmd\__main__.py", line 185, in create_sections for sub in dir_object(name): File "f:\python\lib\site-packages\pydocmd\imp.py", line 82, in dir_object obj = import_object(name) File "f:\python\lib\site-packages\pydocmd\imp.py", line 43, in import_object return import_object_with_scope(name)[0] File "f:\python\lib\site-packages\pydocmd\imp.py", line 63, in import_object_with_scope obj = import_module(current_name) File "f:\python\lib\site-packages\pydocmd\imp.py", line 35, in import_module return __import__(name, fromlist=['']) ModuleNotFoundError: No module named 'python_debug_tools' F:\PythonDebugTools\all>pydocmd simple python_debug_tools+ python_debug_tools.logger++ Building index... Traceback (most recent call last): File "f:\python\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "f:\python\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "F:\Python\Scripts\pydocmd.exe\__main__.py", line 9, in File "f:\python\lib\site-packages\pydocmd\__main__.py", line 197, in main add_sections(doc, args.subargs) File "f:\python\lib\site-packages\pydocmd\__main__.py", line 170, in add_sections [add_sections(doc, x, depth) for x in object_names] File "f:\python\lib\site-packages\pydocmd\__main__.py", line 170, in [add_sections(doc, x, depth) for x in object_names] File "f:\python\lib\site-packages\pydocmd\__main__.py", line 189, in add_sections create_sections(object_names, 0) File "f:\python\lib\site-packages\pydocmd\__main__.py", line 185, in create_sections for sub in dir_object(name): File "f:\python\lib\site-packages\pydocmd\imp.py", line 82, in dir_object obj = import_object(name) File "f:\python\lib\site-packages\pydocmd\imp.py", line 43, in import_object return import_object_with_scope(name)[0] File "f:\python\lib\site-packages\pydocmd\imp.py", line 63, in import_object_with_scope obj = import_module(current_name) File "f:\python\lib\site-packages\pydocmd\imp.py", line 35, in import_module return __import__(name, fromlist=['']) ModuleNotFoundError: No module named 'python_debug_tools' F:\PythonDebugTools\all> ```


NiklasRosenstein commented 6 years ago

I can reproduce your issue, and a quick workaround is to use PYTHONPATH=. before the command, as in

$ PYTHONPATH=. pydoc-markdown simple python_debug_tools.logger+

So yes, it's because pydoc-markdown doesn't add the current working directory to sys.path. I suppose this would be a sensible behaviour, though.