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

submodule not showing #57

Closed
hyukim17 opened this issue Jul 14, 2015 · 6 comments

Comments

Projects
None yet
2 participants
@hyukim17
Copy link

commented Jul 14, 2015

I have a directory structure

folder_a
-- folder_b/
---- file_a.py
---- file_b.py

The page for folder_b shows only file_a as a sub module. Any ideas why this may be the case? Everything imports correctly, as I checked in a terminal.

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Jul 14, 2015

First, please do consult the docs. The first section describes how pdoc determines the public interface of a module: http://pdoc.burntsushi.net/pdoc

Second, the directory structure is largely irrelevant.

Third, your directory structure has no __init__.py files. I would expect there to at least be a __init__.py in your folder_b.

Fourth, as per the docs, the items that pdoc shows in the documentation are largely determined by inspecting the module itself. In order to debug problems, I need to be able to see your source so that I can reproduce your problem.

@hyukim17

This comment has been minimized.

Copy link
Author

commented Jul 14, 2015

Sure. It actually has an init.py file, but I forgot to include it. It's baffling because there's really no difference between file_a and file_b structurally. I'll debug it for more info.

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Jul 14, 2015

Presumably pdoc is documenting folder_b as a module. So it looks in __init__.py. What is in __init__.py? If you only import file_a and not file_b, then pdoc will only show file_a.

@hyukim17

This comment has been minimized.

Copy link
Author

commented Jul 14, 2015

Found the problem.
It was because when pdoc imports modules, something in the environment causes colorama to not work.

In particular,

import sys

from colorama import init

init(strip=not sys.stdout.isatty())

fails.

Going forward, it would be nice to have a log that would write down errors that are raised.

@BurntSushi

This comment has been minimized.

Copy link
Contributor

commented Jul 14, 2015

Yes, I agree a log would be nice. By default, it's hidden because it's amazing how much garbage modules spit out when they're imported: https://github.com/BurntSushi/pdoc/blob/master/pdoc/__init__.py#L368 (And yes, some even block on stdin... sigh)

@hyukim17 hyukim17 closed this Jul 14, 2015

@hyukim17

This comment has been minimized.

Copy link
Author

commented Jul 14, 2015

As it stands, it seems that monkey-patching the source to capture stdout and stderr on a case-by-case basis is the best way to debug import errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.