Python EOL While scanning string literal problem resolution

Source: Internet
Author: User
Tags eol exception handling truncated

This article mainly introduces the Python EOL while scanning string literal problem solving method, this article summarizes the database data problems caused by this problem, the need for friends can refer to the

There is a timed task in the project, every day to get some table data to an external interface, but there has always been an anomaly, today checked the reason.

First, the local and test environment test this program is no problem, only the online environment will throw an exception in the log, guess the main reason for the exception is the data exception.

But what data is unusual, by the unknown, so that the program's output log and data printing, through several runs to locate the error of the function and data records.

The exception is this:

The code is as follows:

EOL while scanning string literal: , line 1, POS 7

Google, the reason for 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 call last):

File " ", line 1, in

EOL while scanning string literal: , line 1, POS 7

Think of the program is not such a problem, the problem comes from the database records, after the detection of the database has a maximum length of a field of 65k, and stored data greater than 65k, the entire string was truncated.

The entire string is not a generic string, but rather a dictionary of character forms, similar to STR (DICTA)

Dica a key or value is truncated for example from {"Name": "ORANGLEIU"} truncated to {"name": "Orang

So when you take out the conversion to the STR type, the error.

Plus exception handling and field growth lengths solve the problem.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.