*static/scripts/python/mover.py*
URI = 'mysql://root:mysqlpassword@localhost/site'
other_db = DAL(URI, auto_import = True)
print ('Exporting data')
db.export_to_csv_file(open('tmp.csv', 'wb') )
print ('Importing data')
other_db.import_from_csv_file(open('tmp.csv', 'rb') )
other_db.commit()
print ('Done!')

$ cd ~/python/web2py
$ python web2py.py -S site -M -R applications/site/static/scripts/python/
mover.py
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2018
Version 2.16.1-stable+timestamp.2017.11.14.05.54.25
Database drivers available: psycopg2, couchdb, pymysql, imaplib, sqlite3, 
pg8000, pyodbc, pymongo
Exporting data
Importing data
Traceback (most recent call last):
  File "/Users/sugizo/python/web2py/gluon/shell.py", line 274, in run
    execfile(startfile, _env)
  File "applications/site/static/scripts/python/mover.py", line 9, in 
<module>
    other_db.import_from_csv_file(open('tmp.csv', 'rb') )
  File "/Users/sugizo/python/web2py/gluon/packages/dal/pydal/base.py", line 
866, in import_from_csv_file
    raise SyntaxError('invalid file format')
SyntaxError: invalid file format
$ ls -la tmp.csv 
-rw-r--r--  1 sugizo  staff  499049 Jul 25 09:33 tmp.csv

tried to open the file (tmp.csv), it's in proper csv file format, any idea?

thx n 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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to