BOMBOLOM.COM

(python) S-exp Scanner in Python

By: Helder Guerreiro.

In the last year and a half I've been programming (very slowly I admit) a web mail client written in Python. The objective is to have more or less the same feature set that Squirrelmail has.

You can check the result of my efforts here. Please be advised that this software is on its early stages and far from complete, it was only tested with Cyrus IMAP which is a very standard compliant IMAP server, so, if you test the program with other less compliant servers it may fail to work.

By now you've guessed that I'm using the IMAP server as the backend storage system for the web mail client. Since the IMAP server responses are symbolic expressions (s-exp for short) I needed a fast enough scanner to be able to parse the server responses. Note that this responses can be a bit lengthy and complex.

I'll try to show how I've solved this problem in the context described above.

2009.02.02 | There's more... | Comments 0 | Tags

(python) ImportError: Bad magic number

Posted by José Lopes.

How to fix an error like:

ImportError: Bad magic number in ../SOME_FILE.pyc
2008.01.09 | There's more... | Comments 0 | Tags ,

(python) Personalize graphic axis on ReportLab

Posted by José Lopes.

If you are using ReportLab to generate graphics you may find necessary to costumize the label axis to show only some of the entries, in order to get a more readable graphic.

The solution I propose is simple.

2007.12.11 | There's more... | Comments 0 | Tags ,

(python) Maximum Recursion Depth Exceeded

Posted by José Lopes

If you get the following error message when you execute a function with Python:

RuntimeError: maximum recursion depth exceeded

It means that the recursion limit of your platform was exceeded, but this can be easily fixed.

2007.09.13 | There's more... | Comments 0 | Tags ,

(python) Find minimum and maximum value of a set of lists

Posted by José Lopes

This post shows a range of solutions to find the maximum value of a set of lists, and the minimum value by analogy.

Supose, as an example, that you have the following lists:

A = [1, 2, 9]
B = [100, 50, 75]
C = [6, 2, 80]
D = [42, 33, 5]

We want to get 100 as the maximum and 1 as the minimum values.

2007.09.04 | There's more... | Comments 0 | Tags ,

(python) PY2EXE and the library.zip file size

Posted by José Lopes

When you run py2exe for a small Python program you may notice that the file library.zip it's too big.
This may cause some problems if you're planning to make a distribution.
This post explains why and how to minimize this file size.

2007.05.31 | There's more... | Comments 0 | Tags , ,

(python) Compatibility problem between projects with PY2EXE

Posted by José Lopes

It may happen, after using py2exe several times with different projects, that the exe files get an error but the equivalent python files run without problems when executed from a shell.

Your last project runs without any problem but an older one that you just changed gives you this problem.

2007.05.31 | There's more... | Comments 0 | Tags , ,

(python) PY2EXE and the PIL library error

Posted by de José Lopes

When you get the following message its due to a compatibility problem between py2exe and PIL library.

File "Image.pyc", line 1571, in open
IOError: cannot identify image file
2007.05.31 | There's more... | Comments 0 | Tags , ,

(python) Codecs/Encodings problem with PY2EXE

Posted by José Lopes

While using PY2EXE you may come up with one the following error messages:

LookupError: unknown encoding:

Or:

LookupError: no codec search functions registered:
can't find encoding solution: explicitly include the encodings package:
2007.05.21 | There's more... | Comments 0 | Tags , , ,

(python) ReportLab Installation Error

Posted by: José Lopes

Sometimes you may get the installation error for ReportLab:

RenderPMError: Can't setFont(Times-Roman) missing
the T1 files?
2007.01.17 | There's more... | Comments 0 | Tags ,

Made with PyBlosxom | Add to Google