Python 2.7 TypeError: file() argument 1 must be encoded string without NULL bytes, not str

Viewed 6810

I try to open an excel sheet with Python and xlrd but I still have the following error

error in open_workbook:

f = open(filename, "rb")

TypeError: file() argument 1 must be encoded string without NULL bytes, not str.

This is my code:

FILE =  tkFileDialog.askopenfile()
string=FILE.read()
wb = xlrd.open_workbook(string)

Please what's wrong? Thanks a lot

1 Answers
Related