Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.x compatibility issues #38

Open
b0b3rt opened this issue Sep 8, 2017 · 1 comment
Open

Python 3.x compatibility issues #38

b0b3rt opened this issue Sep 8, 2017 · 1 comment

Comments

@b0b3rt
Copy link

b0b3rt commented Sep 8, 2017

Code requires:
from functools import reduce #py2.7 reduce > py3.x functools.reduce
s/xrange/range #py2.7 xrange > py3.x range

Issue after those are fixed:

Traceback (most recent call last):
  File "main.py", line 70, in <module>
    tf.app.run()
  File "/usr/local/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 62, in main
    agent = Agent(config, env, sess)
  File "/Users/emmanuel.mwangi/open_source/laml/DQN-tensorflow/dqn/agent.py", line 31, in __init__
    self.build_dqn()
  File "/Users/emmanuel.mwangi/open_source/laml/DQN-tensorflow/dqn/agent.py", line 329, in build_dqn
    self._saver = tf.train.Saver(self.w.values() + [self.step_op], max_to_keep=30)
TypeError: unsupported operand type(s) for +: 'dict_values' and 'list'
@GeneDer
Copy link

GeneDer commented Sep 20, 2017

Refer to this: https://stackoverflow.com/questions/43663206/typeerror-unsupported-operand-types-for-dict-values-and-int

Simply convert self.w.values() to list before the sum will do the trick. (i.e. list(self.w.values()))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants