473,385 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

mailbox module in Python 2.3.4

I've written a script that uses the mailbox module. It works on my local machine with python 2.5. On loading it onto my web hosting provider's server it doesn't work. They are running Python 2.3.4. Is this likely to be the reason?

I've tried loading the 2.5 version of mailbox.py onto the web server - now I get some different errors.

When was mailbox introduced?

Is there a version that'll run on python 2.3.4?

If not, what changes would I have to make to get it to work - assuming that this is feasible?

Thanks - Rowan
Jul 25 '07 #1
3 1046
bartonc
6,596 Expert 4TB
Misc. Q.s Moderator, please move to the Python Forum . Thank you.
Jul 25 '07 #2
bartonc
6,596 Expert 4TB
I've written a script that uses the mailbox module. It works on my local machine with python 2.5. On loading it onto my web hosting provider's server it doesn't work. They are running Python 2.3.4. Is this likely to be the reason?

I've tried loading the 2.5 version of mailbox.py onto the web server - now I get some different errors.

When was mailbox introduced?

Is there a version that'll run on python 2.3.4?

If not, what changes would I have to make to get it to work - assuming that this is feasible?

Thanks - Rowan
It's highly feasible, but we'd need to see some code to point out where you have a compatibility issue.
Jul 25 '07 #3
bartonc
6,596 Expert 4TB
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
And the reply :
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.
Jul 25 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Chuck Amadi | last post by:
Has anyone got a simple python script that will parse a linux mbox and create a large file to view . Cheers Chu
6
by: chuck amadi | last post by:
Hi , Im trying to parse a specific users mailbox (testwwws) and output the body of the messages to a file ,that file will then be loaded into a PostGresql DB at some point . I have read the...
16
by: Chuck Amadi | last post by:
Sorry to bovver you again (again) here's script. I still can't see why the get_payload() doesn't produce the plain text message body of an emails in the testwwws users mailbox. As you can see I...
0
by: David Stockwell | last post by:
Hi, After looking at http://docs.python.org/lib/module-mailbox.html I am a bit confused. The bottom of the page refers to some shortcut usage for getting a mail box import email import...
3
by: noah | last post by:
Is there a way to figure out what filename an email object points to in a qmail style Maildir directory? Hmmm... I don't think so, but I'm hoping I wrong. I instantiated a Maildir mailbox and...
2
by: Nirnimesh | last post by:
I want to extract emails from an mbox-type file which contains a number of individual emails. I tried the python mailbox and email modules individually, but I'm unable to combine them to get...
0
by: jesse.k.rosenthal | last post by:
Dear all, I'm trying to figure out if mailbox will let me get the flags of a Maildir message without running get_message on it, and reading the whole message. It seems like it should work by...
2
by: tinnews | last post by:
I am trying to write a utility to remove empty maildir mailboxes. It sounds like this should be very simple but it's proving really difficult. I'm doing this on a Fedora 7 system with python...
1
by: ra9ftm | last post by:
Hi all. I am trying to use mailbox module, mbox class like this: import mailbox m1 = mailbox.mbox('./ra9ftm2') But it gives the following: ra9ftm:/home/ra9ftm/pyemail# python mbox1.py...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.