python 2.5 - f=open('a_file.txt','w') gives [Errno 2]

dirkheld dirkheld at gmail.com
Mon Dec 3 10:00:50 EST 2007


On 3 dec, 14:54, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> dirkheld wrote:
> > Hi,
>
> > I upgraded my system from tiger to leopard. With leopard came a new
> > version of python 2.5
>
> > Now I trying to run some python code that previously worked on tiger
> > (which included an older version of python).
>
> > This is the error I'm receiving :
>
> > Traceback (most recent call last):
> >   File "test.py", line 18, in print_total
> >     f=open('a_file.txt','w')
> > IOError: [Errno 2] No such file or directory: 'a_file.txt'
>
> > Is this a bug in python? This code worked on my old system
>
> The obvious question is: do you have 'a_file.txt' on your new system? There
> are many happy python programmers on leopard, and this is one heck of a
> basic functionality - I really doubt it's broken in such obvious way (if
> any at all).
>
> Diez

I don't have a file called 'a_file.txt'
I want to create that file and write some data to it. (http://
docs.python.org/tut/node9.html#SECTION009200000000000000000)
The strange thing is that it worked under tiger with an older vesion
of python without any problem....



More information about the Python-list mailing list