write()
Rick Zantow
rzantow at gmail.com
Thu Jul 27 09:29:16 EDT 2006
"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