ytk ytk - 7 months ago 45
Python Question

Import csv to django model using csvImporter

I am trying to import data from a csv file to a django model. I found this thread, which lead me to the documentation for CSVImporter. Since I have already declared a model in my django app, the documentation suggests I use the following code:

>>> from my_projects.models import Person
>>> from csvImporter.model import CsvDbModel
>>> class MyCsvModel(CsvDbModel):
>>> class Meta:
>>> dbModel = Person
>>> delimiter = ";"

So I did this:

from polls.models import Question
from csvImporter.model import CsvDbModel
File "/Users/ytk/anaconda3/lib/python3.5/site-packages/csvImporter/", line 134
except ValueError,e :
SyntaxError: invalid syntax

What am I doing wrong?


This syntax is incompatible with python 3. The correct syntax in Python3 is

except ValueError as e:

This library doesn't support python 3, but exists pull request to make support