jansel / opentuner

An extensible framework for program autotuning
http://opentuner.org/
MIT License
382 stars 112 forks source link

save_to_file() error in Python 3. #141

Closed NoyaFangzhou closed 3 years ago

NoyaFangzhou commented 4 years ago

save_to_file() will dump the best configuration to a binary file in JSON format. However, if indicating 'wb', which is hardcoded in save_to_file() function, it will raise the error TypeError: a bytes-like object is required, not 'str'.

I'd like to suggest if we could change 'wb' to 'w' or let programmers pass the file-type parameters.

jmguo commented 3 years ago

Seconded. I got the same error and fixed it by replacing 'wb' with 'w' in save_to_file().

jansel commented 3 years ago

https://github.com/jansel/opentuner/commit/070c5cef6d933eb760a2f9cd5cd08c95f27aee75 should fix this