write()

manuhack manuhack at gmail.com
Thu Jul 27 12:12:28 EDT 2006


Then is there any way to create a directory under XP using Python?

Rick Zantow wrote:
> "manuhack" <manuhack at gmail.com> wrote in news:1153981114.837884.232610
> @p79g2000cwp.googlegroups.com:
>
> > I copied the lines
> >
> > f=open('/tmp/workfile', 'w')
> > print f
> > f.close()
> >
> > from Python 2.4 Documentation 7.2.  But it said IOerror No such file or
> > directory" '/tmp/workfile'
> >
> > Is it something about the os?  I'm using Python 2.4 under WinXP.
> > Thanks.  Without / I can open it.
> >
>
> The problem is probably that you don't have a '/tmp' directory. WinXP
> doesn't create a directory structure to match a file path specification. If
> you first create the '/tmp' directory (which is a directory off the root of
> your hard drive on WinXP, so that if your current directory is on a D:
> drive it would be D:\tmp), then your code would work.
> 
> -- 
> rzed




More information about the Python-list mailing list