I created a csv file in Mac Excel and wanna upload it to my server through Django, part of my code in views.py is as follows:
FILE_UPLOAD_DIR2 = '/mnt/opt/data/spam/' fd2, filepath2 = tempfile.mkstemp(suffix=request.FILES['spamFile'].name, dir=FILE_UPLOAD_DIR2) with open(filepath2, 'wb') as dest2: shutil.copyfileobj(request.FILES['spamFile'], dest2) But an unexpected error came out: new-line character seen in unquoted field - do you need to open the file in universal-newline mode?
I uploaded a csv file created in Windows to my server before and it worked fine, So I guess this may have something to do with the difference of the csv file created in Windows and Mac. Someone has the same problem before?