python - Sending out a csv attachment with Django Email, is forcing the COLUMN_HEADERS into the next row if they are over 998 characters long -


steps reproduce:

1) long line of comma separated values (mine starts balking @ 998 characters).

2) send out through django email: message.attach('some.csv', csv_file, 'text/csv')

3) open file in email, , notice values have been written second row, instead of staying on 1 row.

input/output

input:

csv_file = 'field_1,field_2,field_3,...,field_998, field_999'

expected output (all on 1 row):

field_1 | field_2 | field_3 | ... | field_998 | field_999

actual output:

field_1 | field_2 | field_3 | ... | field_ 998 | field_999

(please note example, starts balk @ 998 char's not strings)

this happening through django email attachment being sent text/csv , limitations of that. it's acting 'word wrap'. changing text/csv application/octet-stream, leaves data as-is. https://docs.djangoproject.com/en/1.11/topics/email/#emailmessage-objects


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -