In the cssutils sources I use the line __date__ = '$LastChangedDate$' in every file. I never figured this may be the source for any problem but it actually is.
Issue #10 in cssutils issue tracker is put up by an Argentine who had a problem with an accented “é” in the source. I never put it there. I do have some tests with non-ASCII characters in some of the testcases but specified an encoding in theses Python source files with the standard # -*- coding: utf-8 -*- as the 1st (or 2nd if a she-bang is present) line (actually in most cases # -*- coding: iso-8859-1 -*- as most tests use german umlauts which are the easiest to type on my german keyboard
). But not in the setup.py where the problem occured and which is just plain ASCII.
But if you check out the files from the SVN the $LastChangedDate$ is replaced according to the locale you work in (or specify explicitly). This in my case is german so the result is something like __date__ = '$LastChangedDate: 2007-10-23 19:30:59 +0200 (Di, 23 Okt 2007) $'. Notice the “Di” which is short for “Dienstag” (Tuesday). It seems that in Argentine (which is basically spanish [shame on my not even knowing this stuff properly
]) some days actually have accented characters in them so the resulting string actually contains non-ASCII characters which then result in an invalid Python file – if no source encoding is specified (which I guess should be UTF-8 as e.g. ISO-8859-1 may work but I am not sure).
Very interesting…
For now I just added the encoding to setup.py only but I fear need to do this for any file
I guess a workaround would be to specify another encoding when checking out from Subversion. I also guess this problem will happen quite often as IMHO most English speaking people do mostly still use ASCII source code only. Even in widely used languages like Java I think this will be a problem.


