Re: python question

The io module was introduced in Python 2.6 and is defined here.
http://www.python.org/dev/peps/pep-3116/

Nick Stockton
----- Original Message ----- From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Tuesday, December 16, 2008 8:20 PM
Subject: RE: python question



You should not need to do io.open  The following works

Log=open("test.log","w")
Log.write("one line\n")
Log.close()

I couldn't even import io so maybe it's just it thinks io is a library and
you're not getting the error.

Ken

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Tyler
Littlefield
Sent: Tuesday, December 16, 2008 6:04 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: python question

I'm not sure if this is a python bug, or if I'm doing something wrong.
I've opened a file with io.open, and it seems to work:
 log=io.open("TDLynk.log","w")
then I write something with:
log.write("Hello world!")
I get this error:
File "C:\code\tdLynk\logger.py", line 12, in WriteLog
log.write(input)
File "C:\Python26\lib\io.py", line 1487, in write
s.__class__.__name__)
TypeError: can't write str to text stream
..why not?


Thanks,
Tyler Littlefield
email: tyler@xxxxxxxxxxxxx
web: tysdomain-com
Visit for quality software and web design.
skype: st8amnd2005

__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind


__________ Information from ESET Smart Security, version of virus signature database 3694 (20081215) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________
View the list's information and change your settings at http://www.freelists.org/list/programmingblind

Other related posts: