Message387524
# `__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 ) |
|
Date |
User |
Action |
Args |
2021-02-22 18:14:03 | kxrob | set | recipients:
+ kxrob, kebab-mai-haddi |
2021-02-22 18:14:03 | kxrob | set | messageid: <1614017643.61.0.333526769124.issue43247@roundup.psfhosted.org> |
2021-02-22 18:14:03 | kxrob | link | issue43247 messages |
2021-02-22 18:14:03 | kxrob | create | |
|