Forums

Problems in Web2py interactive shell with import_from_csv_file

I'm currently trying to import data from a csv file into my database in web2py, but a command that works on my local computer does not work in the pythonanywhere console.

I'm starting the web2py interactive console like this: python2.6 web2py.py -M -S appname

which starts web2py in Ipython.

I then using this command in the web2py interactive console: db.import_from_csv_file(open('csvfile.csv','rb'), null=''))

which gives me the following error: TypeError: %d format: a number is required, not NoneType

When I try import the csv file without the null='' argument, the importing works. I'm not what the problem is, possibly using null in Ipython? Any help on this would be much appreciated!

Hi there, that is rather strange. Could it be some kind of operating system issue? Our servers run Debian/GNU/Linux... Are you on windows or MacOS perhaps?

Looking at that error, it seems something is expecting a number where there isn't one...

It's possible that the import is working fine, once you remove the null=... Is there any way you can check?

Thanks for the response, got it working today. The error only appears after dropping a table in the web2py shell, but simply restarting the web2py shell solves this problem.