The docs say that the encoding attribute is "New in version 2.3". Python 2.2's IDLE produces exactly the exception reported by the OP. Cheers, John