Robert <kxrobe...@gmail.com> added the comment:
# `__main__` of the source code directory: `/tmp/rebound/rebound`. # differentiate `__main__` of my target source code to read from the built-in `__main__`? In other words, how do I read the module `__main__` of the codebase: rebound? => when __main__.py is inside a package, use the full dotted module name - and an appropriate search path below that directory: pyclbr.readmodule_ex('rebound.__main__') pyclbr.readmodule_ex('lib2to3.__main__') When __main__.py is intended as a top level module / script, I think such a name collision with an internal module name is a bad idea at all. (For a special local purposes you could use a symlink or so?) (I experience a bug with pyclbr (in py3.10 at least) when it traverses an "import __main__" statement. It causes also "ValueError: __main__.__spec__ is None" or "ValueError: {}.__spec__ is not set". But this seems to be an actual bug w/o bug report so far: #43299 ) ---------- nosy: +kxrob _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43247> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com