Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: file.readlines() - gives me error (bad file descriptor)

Reply
Thread Tools

RE: file.readlines() - gives me error (bad file descriptor)

 
 
Vishnu
Guest
Posts: n/a
 
      01-06-2005
logfile = file(r'test.txt','w')
logfile.write('datetime')
logfile.close() # <- close the file

logfile = file(r'test.txt','r') # <- Open the file in read mode
test=logfile.readlines()


~Vishnu.

-----Original Message-----
From: python-list-bounces+vishnube=(E-Mail Removed)
[mailtoython-list-bounces+vishnube=(E-Mail Removed)] On Behalf Of
http://www.velocityreviews.com/forums/(E-Mail Removed)
Sent: Thursday, January 06, 2005 11:53 AM
To: (E-Mail Removed)
Subject: file.readlines() - gives me error (bad file descriptor)

Hey guys,

I can't figure this one out, why is this simple script giving me
problems?

logfile=file(r'test.txt','w')
logfile.write('datetime')
test=logfile.readlines()

When I run it I get the error message:
Traceback (most recent call last):
File "C:\Documents and Settings\Gregory\My Documents\Get New Great
Job\testfile.py", line 3, in ?
test=logfile.readlines()
IOError: [Errno 9] Bad file descriptor

I'm running Windows XP, Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC
v.1200 32 bit (Intel)] on win32
Any help would be greatly appricated.

Thanks,

Greg

--
http://mail.python.org/mailman/listinfo/python-list

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
compiler gives me error message " boost/smart_ptr.h: No such file ordirectory" Pallav singh C++ 4 04-29-2009 08:01 AM
Error using SOPC builder - "Custom SDRAM" with 8-bits gives error with Signal "az_be_n" sendthis@gmail.com VHDL 1 10-19-2007 06:56 PM
file download with WriteFile method gives an empty file ? =?Utf-8?B?RXJpYyBC?= ASP .Net 1 02-06-2006 11:33 AM
file.readlines() - gives me error (bad file descriptor) wordsender@gmail.com Python 9 01-06-2005 02:02 PM
Accessing ASP files gives 404 'File not Found' error Rohit Regonayak ASP General 0 11-10-2003 09:41 AM



Advertisments