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

0 votes

Hi Guys,

I am trying to click my photo using cv2 module. So that I can create face recognition program. But it shows me the below error.

 File "<ipython-input-5-49e205a6723c>", line 8
    file_name_path = 'C:\Users\ Akhter\Desktop\mlops-ws\Adv CNN\Transfer Learning _ Fine Tuning\nadeem\image' + str(count) + '.jpg'
                    ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

How can I solve this error?

May 18, 2020 in Machine Learning by akhtar
• 38,230 points
7,158 views

1 answer to this question.

+1 vote

Hi@akhtar,

In your file_name_path you have to give / instead of \. Otherwise you can add r before your path name as given below. 

file_name_path = 'C:/Users/ Akhter/Desktop/mlops-ws/Adv CNN/Transfer Learning _ Fine Tuning/nadeem/image' + str(count) + '.jpg

file_name_path = r'C:\Users\ Akhter\Desktop\mlops-ws\Adv CNN\Transfer Learning _ Fine Tuning\nadeem\image' + str(count) + '.jpg

Hope this will solve your error.

answered May 19, 2020 by MD
• 95,440 points

Related Questions In Machine Learning

0 votes
1 answer

Error: while loading mnist dataset in jupyter!

Hi@akhtar, Instead of using sklearn dataset, you can use ...READ MORE

answered May 8, 2020 in Machine Learning by MD
• 95,440 points
2,042 views
+1 vote
1 answer

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-8nhf9w2t/grpcio/

Hi@akhtar, You may get this error because of ...READ MORE

answered May 16, 2020 in Machine Learning by MD
• 95,440 points
31,860 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,058 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP