Re: I run into a problem in opening a file in Python

2010-06-18 Thread Terry Reedy
On 6/18/2010 4:26 PM, Justin Park wrote: 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, beca

Re: I run into a problem in opening a file in Python

2010-06-18 Thread D'Arcy J.M. Cain
On Fri, 18 Jun 2010 17:22:00 -0400 "D'Arcy J.M. Cain" wrote: > By the way, your email address doesn't work. I get a "relay access > denied" message. Ignore that. It was a local problem that I fixed before sending but forgot to remove this paragraph. -- D'Arcy J.M. Cain | Democracy i

Re: I run into a problem in opening a file in Python

2010-06-18 Thread D'Arcy J.M. Cain
On Fri, 18 Jun 2010 15:26:14 -0500 Justin Park wrote: > But when I change the file access mode into "a", > it returns an error message of "IOError: [Errno 9] Bad file descriptor. " Exact test script and traceback please. I would like to see what line gives you the error. Are you trying to read

Re: I run into a problem in opening a file in Python

2010-06-18 Thread MRAB
Justin Park wrote: 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

Re: I run into a problem in opening a file in Python

2010-06-18 Thread Ian Kelly
On Fri, Jun 18, 2010 at 2:26 PM, Justin Park wrote: > 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? "a" is for appending only. You can't read from a file opened in that mode. If you want t

I run into a problem in opening a file in Python

2010-06-18 Thread Justin Park
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: ...