Python

pyClamd - use ClamAV antivirus from Python

pyClamd is a portable Python module to use the ClamAV antivirus engine on Windows, Linux, MacOSX and other platforms. It requires a running instance of the clamd daemon. pyClamd is more portable than pyClamAV because it does not need to be compiled, so it works on Windows.

This is a slightly improved version of pyClamd v0.1.1 originally created by Alexandre Norman and published on his website: http://xael.org/norman/python/pyclamd/

Recompiling lxml on Windows with Python 2.5

In order to improve lxml for C14N, I had to recompile my patched version. I followed the build instructions on the lxml website but I came across a few issues. Here are a few tips to save some time.

XML Canonicalization (C14N) in Python using lxml

XML Canonicalization (C14N) is useful in some cases such as digital signature.
lxml provides a very easy way to do it in Python. However, the current version lxml 2.1 does not give access to all C14N parameters. Here is a simple patch to improve its C14N support.

ElementTree and lxml for pythonic XML processing in Python

ElementTree is a "pythonic" XML parser interface developed by Fredrik Lundh which is included in the Python standard library since version 2.5. It provides a very simple and intuitive API to process XML (well, much simpler and more intuitive than usual parsers). lxml is a more efficient parser with a compatible interface. Here are some useful tips to use ElementTree and lxml.

How to display standard file icons in wxPython on Windows

A very useful recipe to display standard Windows file icons in wxPython:

http://ginstrom.com/scribbles/2007/08/31/file-list-with-icons-on-wxpytho...

Inspired from this message: http://mail.python.org/pipermail/python-win32/2005-March/003071.html

Does anyone know how to do the same on Linux and MacOSX ?

How to force urllib2 not to use a proxy

If no proxy is explicitly specified, urllib2 will use Internet Explorer proxy settings by default. The issue is that urllib2 does not take into account the list of addresses which should be reached directly without a proxy, e.g. localhost or the local LAN. In some situations, this means that only external addresses can be reached.

It is possible to force urllib2 not to use any proxy, but this is not explained in the official Python documentation.

Useful links about Python

Collection of various websites with useful information about Python, recipes, tips and tricks.

Unit tests in Python

Here are several solutions to run unit tests in Python.

Using XML-DSig and OpenSSL in Python

Using XML-DSig (XML Digital Signature) and OpenSSL from Python scripts is not straightforward, but there are solutions. Here are a few links to useful libraries and articles.

A batch file to ease Python packages install on Windows

Here is a simple batch file "install.bat" to ease Python packages install on Windows.

Syndicate content