After updating to Python 2.6.6 on my CentOS system, one of my email handling scripts failed with the following error message when trying to access the filename of the Maildir file object:

mailbox._ProxyFile instance has no attribute ‘name’

The mailbox.Maildir filename pointer has changed from fp.name to fp._file.name

Refer to the sample code below:

#!/usr/bin/python
import mailbox
md = mailbox.Maildir(‘../data/email/archived’)
mde = md.next()

# old filename pointer
print mde.fp.name

# new filename pointer for python 2.6.6
print mde.fp._file.name

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

This entry was posted on Tuesday, January 29th, 2013 at 12:36 pm and is filed under Programming.Python, Troubleshooting Errors. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply