Message206252
| Author |
sbt |
| Recipients |
Olivier.Grisel, brett.cannon, eric.snow, larry, ncoghlan, pitrou, python-dev, sbt |
| Date |
2013年12月15日.20:11:08 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1387138268.34.0.239760945398.issue19946@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> I appear to be somehow getting child processes where __main__.__file__ is
> set, but __main__.__spec__ is not.
That seems to be true for the __main__ module even when multiprocessing is not involved. Running a file /tmp/foo.py containing
import sys
print(sys.modules['__main__'].__spec__, sys.modules['__main__'].__file__)
I get output
None /tmp/foo.py
I am confused by why you would ever want to load by module name rather than file name. What problem would that fix? If the idea is just to support importing a main module without a .py extension, isn't __file__ good enough? |
|