__file__ vs __FILE__

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Sat Nov 3 12:18:24 CET 2007


Jeff McNeil wrote:

> I've used the 'os.path.realpath(os.path.pardir)' construct in a
> couple of scripts myself.

In Windows? Using Linux, this gives me "..".

I use os.path.dirname(os.path.abspath(__file__))

> That ought to work within the interactive interpreter.

Why do you also enter that code in the interpreter? If it is in a
module, you should always be able to use __file__.

Regards,


Björn

-- 
BOFH excuse #238:

You did wha... oh _dear_....




More information about the Python-list mailing list