Filling in Degrees in a Circle (Astronomy)

Scott David Daniels Scott.Daniels at Acm.Org
Sat Aug 23 16:11:59 CEST 2008


W. eWatson wrote:
> ...
> I'm working on this now, but my knowledge of python needs refreshing. 
> Right now I have a file of all the az,el data I've collected, and I'd 
> like to open it with Python for XP. However, Python doesn't like this:
> 
> junkfile = open('c:\tmp\junkpythonfile','w')
> 
> I get
>     junkfile = open('c:\tmp\junkpythonfile','w')
> IOError: [Errno 2] No such file or directory: 'c:\tmp\\junkpythonfile'
> 
> This problematic segment is just a hack of a similar statement which has 
> the same problem and a much longer path. I suspect the problem is with 
> the back slash.
> 

A standard windows error. note that '\t' is a tab, and I doubt you have
a directory named <tab> <m> <p>.  Get in the habit of _always_ using:
    junkfile = open(r'c:\tmp\junkpythonfile','w')
or
    junkfile = open('c:\\tmp\\junkpythonfile','w')
for file names.

--Scott David Daniels
Scott.Daniels at Acm.Org




More information about the Python-list mailing list