Filling in Degrees in a Circle (Astronomy)

drobinow at gmail.com drobinow at gmail.com
Sun Aug 24 20:07:45 EDT 2008


On Aug 23, 10:11 am, Scott David Daniels <Scott.Dani... at Acm.Org>
wrote:
> 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.Dani... at Acm.Org

Avoid backslashes whenever possible.
 junkfile = open('c:/tmp/junkpythonfile','w')



More information about the Python-list mailing list