Python Typeerror: Must Be Encoded String Without Null Bytes, Not Str
Trying to get familiar with python's standard library and doing some mucking around with it on my Windows machine. Using python 2.7 I have the following little script which is int
Solution 1:
"...Photos\Modified\0-PyTest"
Its taking the \0 as a null character. You have to escape \
using \\
, or just put an r
before the string to make it raw:
r'C:\Users\me\Photo Projects\Project Name\Project Photos\Modified\0-PyTest'
Solution 2:
turns out to be the single backslash problem. i thought os.path.normpath would format the path as required by the os.
Solution 3:
If you are giving a path url just add r before it :
(r'E:\Images\1.png')
Post a Comment for "Python Typeerror: Must Be Encoded String Without Null Bytes, Not Str"