File write() problem

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Wed Dec 27 03:57:07 EST 2006


In <1167207703.803035.277720 at 42g2000cwt.googlegroups.com>, apriebe47
wrote:

> configfile = file('config.txt', 'w')
> serverPassword = configfile.readline()

Here you open a file for writing and try to read a line.  This raises an
exception:

In [1]: configfile = file('test.txt', 'w')

In [2]: configfile.readline()
---------------------------------------------------------------------------
exceptions.IOError                        Traceback (most recent call last)

/home/marc/<ipython console>

IOError: [Errno 9] Bad file descriptor


Please post the exact code you have trouble with.  Don't retype it -- copy
and paste it.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list