Re: Newbie questions on import & cmd line run

2012-05-18 Thread gwhite
On May 16, 9:54 pm, alex23 wrote: > On May 17, 11:45 am, gwhite wrote: > > > 1.  If running from the system command line, or the Sypder "run" > > button, "__name__" is "__main__" rather than "newbie00", as seen > > above. > > > So, how would I get the file name newbie00.py in these two noted > >

Re: Newbie questions on import & cmd line run

2012-05-18 Thread gwhite
On May 16, 9:33 pm, Steven D'Aprano wrote: > On Wed, 16 May 2012 18:45:39 -0700, gwhite wrote: > > #! > > # Filename: newbie00.py > > "Supposed to"? Nothing -- it is completely optional. > > #! ("hash-bang") lines currently do nothing on Windows machines, they are > just comments. However, on Uni

Re: Newbie questions on import & cmd line run

2012-05-17 Thread Ross Ridge
Steven D'Aprano wrote: >#! ("hash-bang") lines currently do nothing on Windows machines, they are >just comments. However, on Unix and Linux machines (and Macintosh?) they >are interpreted by the shell (equivalent to cmd.exe or command.com), in >order to tell the shell what interpreter to use

Re: Newbie questions on import & cmd line run

2012-05-17 Thread Mark Lawrence
On 17/05/2012 05:29, Chris Rebert wrote: On Wed, May 16, 2012 at 6:45 PM, gwhite wrote: #! That's a shebang line. See http://en.wikipedia.org/wiki/Shebang_(Unix) It's doesn't matter at all since you're on Windows. On Unix-like systems, one typically writes: #!/usr/bin/env python # File

Re: Newbie questions on import & cmd line run

2012-05-17 Thread Dave Angel
On 05/17/2012 12:54 AM, alex23 wrote: > On May 17, 11:45 am, gwhite wrote: > > I don't think that only-one-import is true for scripts that are run > from the command line, though. They can exist as both '__main__' and > their actual name in the module table. (Someone please correct me if > this

Re: Newbie questions on import & cmd line run

2012-05-16 Thread alex23
On May 17, 11:45 am, gwhite wrote: > 1.  If running from the system command line, or the Sypder "run" > button, "__name__" is "__main__" rather than "newbie00", as seen > above. > > So, how would I get the file name newbie00.py in these two noted > cases? You can get it from the file name: i

Re: Newbie questions on import & cmd line run

2012-05-16 Thread Steven D'Aprano
On Wed, 16 May 2012 18:45:39 -0700, gwhite wrote: > #! > # Filename: newbie00.py "Supposed to"? Nothing -- it is completely optional. #! ("hash-bang") lines currently do nothing on Windows machines, they are just comments. However, on Unix and Linux machines (and Macintosh?) they are interpre

Re: Newbie questions on import & cmd line run

2012-05-16 Thread Chris Rebert
On Wed, May 16, 2012 at 6:45 PM, gwhite wrote: > Hi, > > I am a newbie running the latest pythonxy (2.7.2.1) & spyder and > python 2.7.2.   I suspect my questions are mostly basic to python, and > not specific to Spyder or iPython. > > Note: Up until now, I mainly used MATLAB, and thus need to de-

Re: Newbie questions on import & cmd line run

2012-05-16 Thread Terry Reedy
On 5/16/2012 9:45 PM, gwhite wrote: Hi, I am a newbie running the latest pythonxy (2.7.2.1)& spyder and python 2.7.2. I suspect my questions are mostly basic to python, and not specific to Spyder or iPython. Note: Up until now, I mainly used MATLAB, and thus need to de-program myself appropr

Newbie questions on import & cmd line run

2012-05-16 Thread gwhite
Hi, I am a newbie running the latest pythonxy (2.7.2.1) & spyder and python 2.7.2. I suspect my questions are mostly basic to python, and not specific to Spyder or iPython. Note: Up until now, I mainly used MATLAB, and thus need to de-program myself appropriately. I use Win7-64. I wrote the f