Tanks Dave, this is the extract csv of the database, together record ok 
saved via the web2py form, and also record imported from a dbf with db 
browser

id,codice,descriz,classmerc1,classmerc2,escluso,un_mis,sottosc,pesounit,litriunit,materiapri,editinpv,fornitore,codiceacci,pr_acq,percspese,perc_ric,cod_iva,pr_vend,listino01,listino02,listino03,listino04,dataaggpr,codccstato,camputente
14817,ok1,record ok without 
data,,,N,N,0,0.0,0.0,N,N,,,0.0,0.0,0.0,22,0.0,0.0,0.0,0.0,0.0,,,    record 
generated from the form, OK
14818,ok2,record ok with 
data,,,N,N,0,0.0,0.0,N,N,,,0.0,0.0,0.0,22,0.0,0.0,0.0,0.0,0.0,2016-07-28,, 
 record generated from the form,  OK
14769,007442,Aia fr Diavoletto 
Arrosto,00094,,N,N,0,0.5,0.0,N,,AIA,,1.8933,3.0,59.9,10,3.43,0.0,0.0,0.0,0.0,2015-10-01,,
 
 record imported, not ok
14771,007443,Sigma Sgrassatore ml 
750,00306,,N,N,0,0.75,0.0,N,,SIGMA,,1.01,8.5,42.12,22,1.9,0.0,0.0,0.0,0.0,2015-08-11,,
 
 record imported, not ok

tanks very much
Daniele




Il giorno mercoledì 27 luglio 2016 21:39:41 UTC+2, Dave S ha scritto:
>
>
>
> On Wednesday, July 27, 2016 at 10:49:52 AM UTC-7, dfpro...@gmail.com 
> wrote:
>>
>> good morning
>> first of all thanks and congratulations for the wonderful work that is 
>> web2py.
>>
>> I just started using it and I have this problem.
>>
>> writing on  db.py I created a SQLite database, a table (articles) and I 
>> imported data from an existing .dbf file with a  script, 
>>
>> it happens that the "data" field (the date of price change);  if it is 
>> empty generates an exception, "ValueError: invalid literal for int () with 
>> base 10: '' if the field is full, everything ok.
>>
>> The "data" field is in format year, month, day.  (looking with db browser)
>>
>
> Can you give the 1st line of the file, and an example line that's ok and 
> one that isn't?
>  Also the define_table() from your model file ... I take it you're using 
> 'datetime' for the relevant field type.
>
> I think the issue may be with the way in which "empty" is represented.
>
>
>> I tried to import it via .csv files and even .sql 
>>
>> This happens only on the imported data, the records registered by the 
>> form, everything ok.
>> I understand that the program understands that it is imported but should 
>> accept it as it is, do not try to convert it (I think)
>>
>>
> Well, it's trying to turn strings into non-string values (that is, 
> something like "January 10 2001" into the binary number that the database 
> uses to represent that), so conversion is necessary.  It would be the same 
> for converting "134.56" into a DECIMAL field.
>
> I also imported with "db.articoli.import_from_csv_file (open ( 'z: 
>> /articoli.csv'))"
>>
>> also as "migrate = false"
>>
>> but is all useless :(
>>
>> I can not find a solution, someone with a good heart can help me?
>>
>> for the magic Massimo .... why do not you talk more about the Italian ?? 
>> :) 
>>
>> tanks to all
>>
>
>
> /dps
>  
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to