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 in Machine Learning by akhtar
• 11,250 points
75 views

1 answer to this question.

0 votes

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 18 by MD
• 24,500 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 in Machine Learning by MD
• 24,500 points
30 views
+1 vote
1 answer
+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 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 963 views
0 votes
0 answers