Python3.3 django error handling "sre_constants.error: nothing to repeat"

Source: Internet
Author: User

After python3.3, The multiline Regular Expression matching seems to have been modified. It cannot match a multi-line regular expression with non-escape characters.

The following error is reported:

>>>
Traceback (most recent call last ):
File" ", Line 420, in run_nodebug
File" <模块1> ", Line 48, in
File" <模块1> ", Line 31, in main
File "C: \ Python33 \ lib \ re. py", line 214, in compile
Return _ compile (pattern, flags)
File "C: \ Python33 \ lib \ re. py", line 281, in _ compile
P = sre_compile.compile (pattern, flags)
File "C: \ Python33 \ lib \ sre_compile.py", line 498, in compile
Code = _ code (p, flags)
File "C: \ Python33 \ lib \ sre_compile.py", line 483, in _ code
_ Compile (code, p. data, flags)
File "C: \ Python33 \ lib \ sre_compile.py", line 75, in _ compile
Elif _ simple (av) and op is not REPEAT:
File "C: \ Python33 \ lib \ sre_compile.py", line 362, in _ simple
Raise error ("nothing to repeat ")
Sre_constants.error: nothing to repeat
>>>


As prompted, we need to modify the value assignment of locatestarttagend_tolerant in row 56th of the "C: \ Python33 \ Lib \ html \ parser. py" file.

The modification method is to convert the original multi-line escape character into one line.


<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHByZSBjbGFzcz0 = "brush: java;" >## locatestarttagend_tolerant = re. compile (r "##< [a-zA-Z] [-. a-zA-Z0-9: _] * # tag name ##(? : [\ S/] * # optional whitespace before attribute name ##(? :(? <= ['"\ S/]) [^ \ s/>] [^ \ s/=>] * # attribute name ##(? : \ S * = + \ s * # value indicator ##(? : '[^'] * '# LITA-enclosed value ##| "[^"] * "# encryption-enclosed value ##| (?! ['"]) [^> \ S] * # bare value ##)##(? : \ S *,) * # possibly followed by a comma ##)? (? : \ S |/(?!> )) *##)*##)? ##\ S * # trailing whitespace # "", re. VERBOSE) locatestarttagend_tolerant = re. compile (r "\ n <[a-zA-Z] [-. a-zA-Z0-9: _] * # tag name \ n (? : [\ S/] * # optional whitespace before attribute name \ n (? :(? <= ['"\ S/]) [^ \ s/>] [^ \ s/=>] * # attribute name \ n (? : \ S * = + \ s * # value indicator \ n (? : '[^'] * '# LITA-enclosed value \ n | "[^"] * "# encryption-enclosed value \ n | (?! ['"]) [^> \ S] * # bare value \ n) \ n (? : \ S *,) * # possibly followed by a comma \ n )? (? : \ S |/(?!> )) * \ N )? \ N \ s * # trailing whitespace \ n ", re. VERBOSE)
I have a problem with the incorrect understanding. It should be due to the regular expression writing problem. It's late, and another day is working on it.



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.