Getting invalid syntax error


Hi all.

I’m trying to run the run the train_cartpole example but I’m getting an invalid syntax error:

python -m baselines.deepq.experiments.train_cartpole
Traceback (most recent call last):
File “/usr/lib/python2.7/”, line 163, in _run_module_as_main
mod_name, _Error)
File “/usr/lib/python2.7/”, line 102, in _get_module_details
loader = get_loader(mod_name)
File “/usr/lib/python2.7/”, line 464, in get_loader
return find_loader(fullname)
File “/usr/lib/python2.7/”, line 474, in find_loader
for importer in iter_importers(fullname):
File “/usr/lib/python2.7/”, line 430, in iter_importers
File “/usr/local/lib/python2.7/dist-packages/baselines/deepq/”, line 4, in
from baselines.deepq.simple import learn, load # noqa
File “/usr/local/lib/python2.7/dist-packages/baselines/deepq/”, line 10, in
from baselines import logger
File “/usr/local/lib/python2.7/dist-packages/baselines/”, line 139
def log(*args, level=INFO):
SyntaxError: invalid syntax

Could somebody give me a hint please?

Best regards.


The problem was related to the python’s version, after using python 3 instead of python everything worked fine.