Error in opening of file. Python -


i trying open file , met problem:

typeerror: coercing unicode: need string or buffer, nonetype found 

here code example:

a = open(fname, "rb").read(255) 

whats wrong code?

fname none, not string:

>>> open(none) traceback (most recent call last):   file "<stdin>", line 1, in <module> typeerror: coercing unicode: need string or buffer, nonetype found 

you'll have fix how set fname or explicitly guard against being none.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -