Kaixhin / Rainbow

Rainbow: Combining Improvements in Deep Reinforcement Learning
MIT License
1.56k stars 282 forks source link

Non-ASCI characters used without declaring encoding #45

Closed jkterry1 closed 5 years ago

jkterry1 commented 5 years ago

When you use some of the flags to run the code (i.e. for the data efficient rainbow like i was) you use greek unicode characters for some of the metavariables. This creates an error when using them:

justinkterry@prophet:~/Dropbox/rainbow/Rainbow$ python main.py --target-update 2000                --T-max 100000                --learn-start 1600                --memory-capacity 100000                --replay-frequency 1                --multi-step 20                --architecture data-efficient                --hidden-size 256                --learning-rate 0.0001                --evaluation-interval 10000                --enable-cudnn
  File "main.py", line 27
SyntaxError: Non-ASCII character '\xcf' in file main.py on line 27, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

I read the PEP mentioned, and was going to make a PR with the fix myself, but adding # coding: utf-8 at the top like you'd expect gave the error

  File "main.py", line 5, in <module>
    from math import inf
ImportError: cannot import name inf

Can you please fix this so that the data efficient rainbow is usable?

Kaixhin commented 5 years ago

In 52284cc I've done my best to add Python 2 compatibility but let me know if something else is broken, or ideally send in a PR to fix this repo for Python 2/3 cross-compatibility.

Kaixhin commented 5 years ago

I've now successfully run for a little while under Python 2 with the latest code.