SQLAlchemy solution programmingerror:you must not use 8-bit bytestrings unless your use a text_factory

Source: Internet
Author: User

SQLAlchemy newspaper programmingerror:you must not use 8-bit bytestrings unless you use a text_factory the can interpret 8-bit by Testrings Error

python2.x The most annoying is the coding problem, write down for later use.

Workaround:

1. At the beginning add:

#encoding: Utf-8


2. Try Convert characters to Unicode format

Unicode (Str_name)

This method sometimes appears: "Unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0xe5 in position 108:ordinal not in range (128 ...") This problem.

Workaround:

Import sysreload (SYS) sys.setdefaultencoding (' UTF8 ')


SQLAlchemy solution programmingerror:you must not use 8-bit bytestrings unless your use a text_factory

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.