praiskup / argparse-manpage

Automatically build man-pages for your Python project
Apache License 2.0
40 stars 21 forks source link

How to set PYTHONPATH to allow this tool to read designated python file #106

Closed scastria closed 5 months ago

scastria commented 6 months ago

My python file that contains the ArgumentParser config has imports at the top that will not work unless the PYTHONPATH is configured correctly. It may reference other modules are reference:

from . import XXX

which fails with:

ImportError: attempted relative import with no known parent package

Any suggestions?

praiskup commented 5 months ago

Sorry I missed this question.

I am more comfortable with absolute imports, to be honest. If foo.baz module imports .bar, I tend to rather do import foo.bar. PYTHON path needs to point to the directory containing foo.

Otherwise, it should work with relative imports. There's no more info to provide better help.