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

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.