En Thu, 13 Mar 2008 02:25:12 -0200, David S <[EMAIL PROTECTED]>  
escribi�:

> I have an error occurring at
>     self.build_root = os.path.abspath(os.path.split(__file__)[0])
>
> The error states 'NameError: global name '__file__' is not defined'
>
> In Python 2.5 I ran my script as a module in IDLE gui. How does _file_  
> get
> defined?

If you type your code directly into IDLE (or the commmand line Python  
interpreter) __file__ doesn't even exist; it only has any sense when the  
code is read from an actual file.
Save your code on disk, let's say you name it example.py
Then you can execute it using
> python example.py
 from the command line; from inside IDLE, go to File | Open, locate  
example.py, press F5

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to