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

[Exercise 7.2] NameError: name 'environment' is not defined #12

Open
Xuanaxx opened this issue Apr 6, 2023 · 0 comments
Open

[Exercise 7.2] NameError: name 'environment' is not defined #12

Xuanaxx opened this issue Apr 6, 2023 · 0 comments

Comments

@Xuanaxx
Copy link

Xuanaxx commented Apr 6, 2023

Hello,

When I run the program comparison.py in Exercise 7.2, the program reports the following error
Traceback (most recent call last):

File "D:\Download\Anaconda\envs\py39torch\lib\concurrent\futures\process.py", line 246, in _process_worker
r = call_item.fn(*call_item.args, **call_item.kwargs)
File "D:\Download\Anaconda\envs\py39torch\lib\concurrent\futures\process.py", line 205, in _process_chunk
return [fn(*args) for args in chunk]
File "D:\Download\Anaconda\envs\py39torch\lib\concurrent\futures\process.py", line 205, in
return [fn(*args) for args in chunk]
File "d:\Desktop\python_work\RL\RLhomework4\comparison.py", line 44, in run_pred
return test_predictor(x, **y)
File "d:\Desktop\python_work\RL\RLhomework4\comparison.py", line 35, in test_predictor
e = predictor.environment.generate_episode()
File "d:\Desktop\python_work\RL\RLhomework4\comparison.py", line 94, in generate_episode
environment.next()
NameError: name 'environment' is not defined

After a period of debugging, I found that the environment.next() in the member function generate_episode of the class RandomWalkEnvironment should be changed to self.next(). With this modification, the bug disappears.

Thanks and keep up the good work !

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

1 participant