[Scribus] Calendar script - a summary
Fri Oct 29 23:08:53 CEST 2004
>> -----Original Message-----
>> From: scribus-bounces at nashi.altmuehlnet.de On Behalf Of Elmar Jobs
>> Sent: Friday, October 29, 2004 7:30 AM
>> The solution is:
>> In list MonthList, prepend all names with nun ASCII-Chars with
>> an 'u', or write these chars in HEX/OCT e.g. u'M?rz' oder
>> Change all occurrences of MonthList[Month] in CreateText() and
>> CreateImage() to str(Month).
>> That should work. Maybe Henry can include these changes in the
>> latest version of the script and post it to scribus.net.
I'd be more than happy to update the script and publish it. I also agree
that it would be best if it could be done without having to change site.py.
The problem for me at this point is that my script still failed after making
your suggested changes. In fact, the calendar_A3 version you posted didn't
work either. calendar_A3.py fails on line 71 which is the one place that
MonthList[Month] still shows up. You cannot get rid of it there since you
sort of need the month names at that point.
The error I get is:
Traceback (most recent call last): File " ", line 4,
in ? File "/home/henry/calendar_A3.py", line 71, in ?
SetText(MonthList[Month] + " " + str(Year), ob)
UnicodeEncodeError: 'ascii' codec can't encode
character u'\xe4' in position 1 : ordinal not in
if I replace the month name with 'M\xe4rz' then it doesn't fail but all I
have on my third page is "M rz" which isn't much help.
I wrote a short test script and ran it at the command prompt:
#-*- coding: utf-8 -*-
MonthList = ["Januar","Februar",u"M??rz","April"]
for Month in range(4):
print str(Month+1) + ":" + MonthList[Month]
This correctly prints M?rz for the third month. Could the problem be in the
SetText() function not correctly dealing with (or knowing how to deal with)
the unicode object? Could there be some environmental difference between my
command line and Scribus that's causing it to fail in Scribus?
If I've missunderstood what you meant, then I'd be happy to be corrected.
If we can get this working, I'm sure it will be helpful for future scripts.
More information about the scribus