I run into a problem in opening a file in Python

Justin Park hp6 at rice.edu
Fri Jun 18 16:26:14 EDT 2010


The problem is simple.
I have 50taxa2HGT_1.txt in the current directory,
and I can open it using any text editor (which indicates there actually
is.)

And I can read it in Python using
>>> fd=open("./50taxa2HGT_1.txt", "r")
, and it actually got opened, because I can do
>>> for line in fd:
...     print line

But when I change the file access mode into "a",
it returns an error message of "IOError: [Errno 9] Bad file descriptor. "

What have I done wrong?

Thanks in advance,






More information about the Python-list mailing list