program path
Steven Taschuk
staschuk at telusplanet.net
Mon Jun 9 00:30:45 EDT 2003
Quoth Peter Hansen:
> Steven Taschuk wrote:
[...]
> > sys.modules['__main__'].__file__
> > [...] Does this alternative have any disadvantages I'm not seeing?
>
> Not available pre-2.3, as far as I know. Fails under 2.2 anyway.
Ah. Yes, that's quite a disadvantage.
(A little experimentation suggests it's just __main__ that has
this problem; modules imported under their normal names (assuming
they are importable thus) do have __file__, in 2.2.2. Still,
that's not much help for the original problem.)
--
Steven Taschuk Aral: "Confusion to the enemy, boy."
staschuk at telusplanet.net Mark: "Turn-about is fair play, sir."
-- _Mirror Dance_, Lois McMaster Bujold
More information about the Python-list
mailing list