pymc-devs / pymc2

THIS IS THE **OLD** PYMC PROJECT (VERSION 2). PLEASE USE PYMC INSTEAD:
http://pymc-devs.github.com/pymc/
Other
879 stars 229 forks source link

Error on implicit byte->string conversion in getInput in utils.py #140

Closed elnjensen closed 7 years ago

elnjensen commented 7 years ago

In Python 3 the behavior of os.read() has changed to return a bytestring rather than a string, so this line returns an error if the user enters input from the terminal while a chain is running:

TypeError: Can't convert 'bytes' object to str implicitly

For Python 3, the fix is just to add .decode() to the end of that line, e.g.

            input += os.read(sock,4096).decode()

but I don't know how to do that in a way that won't break Python 2.

fonnesbeck commented 7 years ago

Please test the PR above. Should do the trick.

elnjensen commented 7 years ago

That works great - thanks for the quick fix!