Women in Technology

Hear us Roar

  Processing Mailbox Files with mailbox.py
Subject:   python 2.5's mailbox.py incompatible under 2.3
Date:   2007-07-10 11:50:06
From:   jemptymethod
I replaced Python 2.3's mailbox.py with the version for Python 2.5, but the following error:

>>> import mailbox
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib64/python2.3/mailbox.py", line 928
return iter(sorted(int(entry) for entry in os.listdir(self._path)
SyntaxError: invalid syntax

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • python 2.5's mailbox.py incompatible under 2.3
    2007-07-12 03:45:39  A. M. Kuchling | [View]

    Most modules in the Python standard library aren't written to be compatible with earlier versions of Python, so that bit of code is using a generator comprehension. To use the module with Python 2.3,
    you'd have to rewrite that line to create and sort a list instead.