1

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/model.py", line 134
    except ValueError,e :
                     ^
SyntaxError: invalid syntax

What am I doing wrong?

Community
  • 1
  • 1
ytk
  • 2,787
  • 4
  • 27
  • 42

1 Answers1

3

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 https://github.com/anthony-tresontani/csv_importer/pulls