There is a scheduled task in the project, the daily fetch some table data to an external interface, but there is always an exception, today checked the next reason.
First of all, the local and test environment to test the program is not a problem, only the online environment will be thrown in the log exception, guess the exception is mainly caused by the exception of the data.
However, the data is not known, and the output log and data printing of the program is added, and the function and data record of the error are located in several runs.
The exception is this:
The code is as follows:
EOL while scanning string literal: , line 1, POS 7
Google, the cause of this exception is the string, the quotation marks do not appear in pairs, which is similar to the following situation
The code is as follows:
STR (' 1)
Traceback (most recent):
File " ", line 1, in
EOL while scanning string literal: , line 1, POS 7
Think of the program is not such a problem, the problem is from the database records, after the discovery of the database has a field maximum length is 65k, and the data deposited more than 65k, the entire string is truncated.
The entire string is not a generic string, but rather a dictionary of character form, similar to STR (DICTA)
Dica a key or value is truncated for example from {"Name": "Orangleiu"} to {"name": "Orang
Therefore, when the conversion to the STR type of the time of the error.
Adding exception handling and field growth lengths solves the problem.