0
나는 최신 장고의 CSV 가져 오기는 여기에서 찾을 사용하고 있습니다 : 빈 줄이없는 정수를 포함하는 CSV의 http://django-csv-importer.readthedocs.org/en/latest/index.html장고 된 CSV 가져 오기 정수 오류
2 호선을. 그들은 모두 숫자입니다. 나는 CSV로 가서 정수로 번호가 모든 행을 변환 한 다음 파일을 다시 업로드,하지만 난 여전히이 오류가 다음과 같이
line 182, in import_data
return importer.import_data(data)
File "/.../lib/python2.7/csvImporter/model.py", line 282, in import_data self.process_line(data, line, lines, line_number)
File "/.../lib/python2.7/csvImporter/model.py", line 299, in process_line
raise CsvDataException(line_number, field_error = e.message)
CsvDataException: Line 2: invalid literal for int() with base 10: ''
내 모델 설정입니다 :
class Character(models.Model):
name = models.CharField(max_length=128)
points = models.IntegerField()
description = models.TextField()
image = models.ManyToManyField(Image)
dice = models.IntegerField(blank=True, null=True)
def __unicode__(self):
return self.name
class CsvCharacterUpload(CsvDbModel):
name = models.CharField(max_length=128)
points = models.IntegerField()
description = models.TextField()
image = models.ManyToManyField(Image)
dice = models.IntegerField(blank=True, null=True)
class Meta:
dbModel = Character
delimiter = ","
has_header = True
빈 항목이 없으며 빈 항목이없고 텍스트 항목에 실제로', '...이 없습니다. –
Excel 또는 open/libreoffice calc로 csv 파일을 열고 표시되는지 확인하십시오 거기 제대로. 또한 python 자체에는 이미이 제 3 자 라이브러리 대신 사용할 수있는'csv' [library] (http://docs.python.org/library/csv.html)가 이미 있습니다. – l4mpi
예, 특별히 OpenOffice를 사용했습니다. 모든 것이 좋습니다. 나는 그것이 실제로 무엇인지 모른다. 그래서 CharField()로 번호를 바꿨다. 실제로 제안하지는 않았지만 거기에서 작동하므로 문제가 무엇인지 잘 모르겠습니다. – AAA