ZSI & Python newbie

Faser invalid at faser.net
Wed Nov 12 18:54:37 EST 2003


On Wed, 12 Nov 2003 16:16:53 GMT, Alex Martelli <aleax at aleax.it> wrote:


>Are you using the Python time module, and the time tuples documented in
>it?  You surely don't seem to be:

I used the time module too, but I always got some kind of errors.

>> import datetime
>    ...
>> nascita = datetime.date(1950,12,22)
>> soapNascita = TC.gDate(nascita)
>
>Now, if you passed nascita.timetuple(), THAT might help -- at least
>it could be said to place you in compliance with the doc you quote.
>
>However, from the traceback you quote it doesn't seem like that...:
>
>
>> File "D:\MySoft\Python\codicefiscale\cf.py", line 16, in ?
>> soapNascita = TC.gDate(nascita)
>> File "C:\PROGRA~1\Python23\Lib\site-packages\ZSI\TC.py", line 65, in
>> __init__
>> i = self.pname.find(':')
>> AttributeError: 'datetime.date' object has no attribute 'find'
>
>Indeed it does, and neither does a timetuple.  What this code in
>TC.py is doing is trying to parse a string by finding a colon in it.
>So, maybe, a string is what you need to pass...?  That parameter IS
>called 'name' in the docs you quote, after all -- even though to
>think of a 'name' as something containing a colon seems strange to me.

I tried to pass this:
nascita = datetime.date(1950,12,22).timetuple()[:9]

and the error change in:

File "D:\MySoft\Python\codicefiscale\cf.py", line 24, in ?
cf = codiceFiscale('Rossi','Marco','M','Milano','MI',nascita)
File "D:\MySoft\Python\codicefiscale\cf.py", line 14, in codiceFiscale
soapNascita = TC.gDate(nascita)
File "C:\PROGRA~1\Python23\Lib\site-packages\ZSI\TC.py", line 59, in
__init__
    self.nspname, self.pname = pname
ValueError: unpack tuple of wrong size

I think I will give up.
Thank you very much for your help.


Faser
-- 
FABIO SERRA
*Questo testo deve essere valutato secondo il senso della RFC-3*
Per rispondere in e-mail sostituire "invalid" con "faser"
--------------------




More information about the Python-list mailing list