Following code line produces an SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 57-58: malformed \N character escape
:
self.le1 = QLineEdit('\\S24014\\file.xlsx', self)
This is a filepath, that I Need to Keep.
Spyder Shows that \\S24014
is the Problem. The file has # -*- coding: utf-8 -*-
at the top. How to solve the Problem?
I am using Spyder 2 with Python 3.5 and PyQt4
It sounds as if you need to pass the string as a raw string literal, i.e. r'\\S24014\\file.xlsx
.
Both string and bytes literals may optionally be prefixed with a letter
r
orR
; such strings are called raw strings and treat backslashes as literal characters.