Am 29.03.2017 um 23:05 schrieb Uwe Stöhr:

('de_DE', 'cp1252')

OK, using

inpname = shortPath(str(tmpfname).encode(encoding)).replace('\\', '/')
or
inpname = shortPath(str(tmpfname).encode('cp1252')).replace('\\', '/')

gives this error:

TypeError: a bytes-like object is required, not 'str'

I googled this:
"
You are using Python 2 methodology instead of Python 3.
Change:
outfile=open('./immates.csv','wb')
To:
outfile=open('./immates.csv','w')
.....
In Python 3 csv takes the input in text mode, whereas in Python 2 it took it in binary mode.
"

And indeed by using i n line 208

os.write(fd, b'\relax')
instead of
os.write(fd, r'\relax')

I get with
inpname = shortPath(str(tmpfname)).replace('\\', '/')
no error. But then it will of course fail with Python 2.

regards Uwe

Reply via email to