Could be a Python3 issue. I don't export my DBs via appadmin but via an
admin controller with the following code:
PY2 = sys.version_info[0] == 2
...
filename = <your filename>
if PY2:
db.export_to_csv_file(open(filename, 'wb'))
else:
db.export_to_csv_file(open(filename, 'w', encoding='utf-8', newline=''))
Importing as follows:
filename = <your filename>
if PY2:
db.import_from_csv_file(open(filename, '*rb*'))
db.commit()
else:
db.import_from_csv_file(open(str(filename), '*r*', encoding='*utf-8*'))
db.commit()
And before re-importing the database, first drop all tables.
Have a try, hope it helps!
Best regards
Clemens
On Friday, June 11, 2021 at 11:44:52 AM UTC+2 黄祥 wrote:
> *step to reproduce*
> 1 create new app
> 2 edit db.py at the bottom :
> db.define_table('mytable', Field('myfield'))
>
> 3 insert data on appadmin
> 4 export as csv file on appadmin
> 5 import the exported file
> no data added and have flash error
> <div>unable to parse csv file<pre>iterator should return strings, not
> bytes (did you open the file in text mode?)</pre></div>
>
> any idea or fix about this ?
>
> thanks and best regards,
> stifan
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/dd106c3b-4041-4c90-82b6-354e023349a3n%40googlegroups.com.