[Solved] SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 6-7: malformed

Successfully solved syntaxerror: (Unicode error) ‘Unicode eescape’ codec can’t decode bytes in position 6-7: malformed


solve the problem

input_image_path = ‘Inputs\Nnu01.jpg’
^
SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 6-7: malformed \N character escape

Solution ideas

Syntax error: (Unicode error) the ‘Unicode escape’ codec cannot decode bytes at positions 6-7: malformed\n character escape

Solution:

Escape character problem, caused by ‘\n’ in the string! You need to modify as follows, just add r in front!

input_image_path = r'Inputs\Nnu01.jpg'

OK, it’s done!

Read More: