0

I am making a GUI using tkinter and i am using matplotlib to print some graphics in a tk windown. But when i run the code it gives me a "unicode error".

error image

I already know that the problem is with the "\U" part in the paths, but i can't find a way to change this and remove the error.

1 Answers1

0

The problem is with the directory string.

"C:\Users\Vinicius"

Per this thread,

"Here, \U starts an eight-character Unicode escape, such as '\U00014321`. In your code, the escape is followed by the character 's', which is invalid.

You either need to duplicate all backslashes, or prefix the string with r (to produce a raw string)." @martin-v-löwis

Community
  • 1
  • 1
  • 1
    Note that in Python 2, `\U` escapes are still processed even in raw (unicode) strings, so you must duplicate the backslashes in front of the Us. – BrenBarn Dec 22 '16 at 22:15
  • First of all, thanks for the answer. So... i know that I need to do this, the question is: since this is an automatic import from the module, and it already knows the path to look for, how can I change that? – Vinicius Syl Dec 23 '16 at 00:37
  • Use a raw string r'path', double \\, or forward / instead. –  Dec 23 '16 at 00:44