<type 'exceptions.TypeError'>: an integer is required

Dave Angel davea at ieee.org
Tue Jun 16 00:06:13 EDT 2009

Ulrich Eckhardt wrote:
> open() doesn't take a string as second parameter, see 'help(open)'. Instead,
> it takes one of the integers which are defined as symbols in the os module,
> see 'dir(os)'.
Where'd you get that misinformation?  The second parameter to the 
builtin function open() is a string, such as 'r', 'wb', etc.

help(open) doesn't say much in 2.6, but in 3.1, it spells it out.  For 
2.6, look at the non-interactive documentation, such as the chm file in 

Now perhaps you're referring to open() in some other module, such as 
os.open().  If so, it behooves you to specify that, as an unqualified 
open() can only refer to the one in builltin.

More information about the Python-list mailing list