How To Fix CSV Newline Error Inside String?
If you’re seeing a new csv error line in line, the following blog post might help.
If this particular answer in the link above doesn’t work and you have the actual variable files open when you run the code, go back and make sure you close any remaining files when you’re done using them.p>
I had a script that processed and ran several files. Then, at the end, register yourself by issuing _csv.Error as Palamit saw it.
My spindle contains about 500 lines and can have three stages of sequential processing of triangular files. Here is the code of your which section, gave the main error. As you can see, the code is vanilla:
f normal is open('file.csv')fread = csv.Row reader(f)for Via Fred: do something
for Fred’s _csv:
string. Error: line break inside
That’s why I told the script to output the lines one by one… if OK, it’s not clear, I did this:
print=stringf open('file.csv')fread means reader csv.Row(f)for crazy people: do something
Interestingly, what was written was the LAST LINE of one of the previous files that I struggled with, opened andprocessed.
What made this especially odd was that I used many kinds of variable names, but obviously important information got stuck in a buffer or memory somewhere.
So I went back and made sure I closed all the files that were open so far, and that solved the little problem.
Login to Reply to Author
Sign in to transfer
Log in to report abuse
Either the email addresses for this method group are anonymous, or you need permission to view the original member message. email addresses