0

I have a header block in my programs enclosed by """ in lines by themselves. Two of them started throwing SyntaxError on the closing set after editing the file. (Not both recently. This is the second occurrence.)

Also of note: the first line is # -*- coding: utf-8 -*-

The failure message reads as follows:

[lists the file name and line number] Pointer at the third of 3 " characters, then "SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 274-275: truncated \UXXXXXXXX escape"

These are mature files that have been evolving for more than a year with no problem. When this started on the most recent instance, the header block hadn't even been modified. I've tried replacing the double quote characters, replacing the whole line, adding an r as the first character, and adding blank lines before and after. I have been unable to figure it out and have resorted to making all the header lines comments.

I can't find any help topics specifically for the """ problem. If anyone has an idea what causes this, please share. Thanks,

GTaylor
  • 61
  • 6
  • 3
    Please include the full relevant portion of the Python script involved in the error. A screen shot will not get the point across. – Tim Biegeleisen Nov 01 '21 at 15:08
  • Minimial reproducible example, please. What bytes are at position 274-275, and can you create a string with *just* those bytes that produces the same error? – chepner Nov 01 '21 at 15:16
  • I can't put that on a public forum, but the suggestion that I provide the code with just the content that causes the problem was something I hadn't thought to do. Having @file: C:\Users between the lines with """ in them is what causes the problem. When "Users" is deleted there is no problem. – GTaylor Nov 01 '21 at 17:20

0 Answers0