SyntaxError unicode error unicodeescape codec can t decode bytes in position 2-3 truncated UXXXXXXXX escape

0 votes
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
Sep 9, 2020 in Python by anonymous
• 130 points
8,920 views

1 answer to this question.

0 votes

This error occurs because you are using a normal string as a path. You can use one of the following solutions to fix your problem.

  1. Just put r before your normal string it converts normal string to raw string:
pandas.read_csv(r"C:\Users\Edureka\Desktop\myac.csv")
pandas.read_csv("C:/Users/Edureka/Desktop/myac.csv")
pandas.read_csv("C:\\Users\\Edureka\\Desktop\\myac.csv")

You can try one of this

answered Sep 9, 2020 by Gitika
• 65,970 points

Related Questions In Python

0 votes
0 answers
0 votes
2 answers

Error: Speech to Text Codec cannot decode the bytes in position

import speech_recognition as sr r = sr.Recognizer() audio ='C\Users\Desktop\audiofile1.wav' with ...READ MORE

answered Nov 28, 2018 in Python by Nabarupa Das
1,318 views
0 votes
2 answers

Python Error "UnicodeEncodeError: 'ascii' codec can't encode character u'\u03b1' in position 20: ordinal not in range(128)"

import csv import sys reload(sys) sys.setdefaultencoding('utf8') data = [["a", "b", u'\xe9']] with ...READ MORE

answered Jun 28, 2019 in Python by anonymous
9,831 views
+2 votes
2 answers

UnicodeDecodeError: "utf-8" codec can't decode byte in position : invalid start byte

You have to use the encoding as latin1 ...READ MORE

answered Jul 23, 2019 in Python by Kunal
141,030 views
0 votes
0 answers

utf-8' codec can't decode byte 0xa0 in position 10: invalid start byte

my code import wordcloud import numpy as np from matplotlib ...READ MORE

Mar 29, 2020 in Python by anonymous
• 120 points
2,985 views
0 votes
2 answers
0 votes
1 answer

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

Hi, @hala, Regarding your query, you can go ...READ MORE

answered Jun 29, 2020 in Python by Niroj
• 82,880 points
8,024 views
+1 vote
1 answer

'utf-8' codec can't decode byte 0xa9 in position 12527: invalid start byte

Hello, You can always safely read in binary ...READ MORE

answered Jun 30, 2020 in Python by Niroj
• 82,880 points
6,874 views
0 votes
3 answers

(unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

You are getting this error because you ...READ MORE

answered Dec 31, 2019 in Python by Kalgi
• 52,370 points
49,987 views
0 votes
2 answers

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

Hey,  @Himanshu. It's still most likely gzipped data. ...READ MORE

answered Jul 27, 2020 in Python by Gitika
• 65,970 points
7,232 views