-1

Line of code:

typewrite('C\Users\Arthur\Desktop\New folder\a'+picture[i]+'.png')

If I remove the \ from the code, the above works so I know the issue is with the \ symbol and do not remember why \ cannot be in quotes this way.

Syntax Error:

(unicode error) 'unicodeescape' codec can't decode bytes in position 1-2: truncated \UXXXXXXXX escape
Artur Podlesniy
  • 145
  • 1
  • 7

1 Answers1

1

\ has a special meaning. While giving a address you have to counter this special meaning. You could do one of the following: Either:

typewrite('C\\\Users\\\Arthur\\\Desktop\\\New folder\\\a'+picture[i]+'.png')

That is, I have used double slashes.

Or,

typewrite(r'C\\Users\Arthur\Desktop\New folder\a'+picture[i]+'.png')

That is, put 'r' before 'C.... (don't use double slashes with this method)

deadshot
  • 8,881
  • 4
  • 20
  • 39