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

OSError and EOFError2 #14

Open
lvjinqiao opened this issue Dec 21, 2020 · 3 comments
Open

OSError and EOFError2 #14

lvjinqiao opened this issue Dec 21, 2020 · 3 comments

Comments

@lvjinqiao
Copy link

I learned to use your code on windows, but encountered the problem of oserror and eoferror. I checked it env.py I don't think the following paragraph is meaningful. Would you please explain the meaning of this code? Because my mother tongue is not English, can you understand what I mean??

#     for index in range(num_envs):
#
#         process = mp.Process(target=self.run, args=(index,))
#         process.start()
#
#         # self.env_conns[index].close()
#
# def run(self, index):
#
#     # self.agent_conns[index].close()
#     while True:
#
#         request, action = self.env_conns[index].recv()
#         print(request,action)
#         if request == "step":
#             self.env_conns[index].send(self.envs[index].step(action.item()))
#         elif request == "reset":
#             self.env_conns[index].send(self.envs[index].reset())
#
#         else:
#             raise NotImplementedError
@zhimakaimenxa
Copy link

我碰到了相同的问题,这两句逻辑不对,运行报错,注释掉以后又会在reset函数里出错,

I learned to use your code on windows, but encountered the problem of oserror and eoferror. I checked it env.py I don't think the following paragraph is meaningful. Would you please explain the meaning of this code? Because my mother tongue is not English, can you understand what I mean??

#     for index in range(num_envs):
#
#         process = mp.Process(target=self.run, args=(index,))
#         process.start()
#
#         # self.env_conns[index].close()
#
# def run(self, index):
#
#     # self.agent_conns[index].close()
#     while True:
#
#         request, action = self.env_conns[index].recv()
#         print(request,action)
#         if request == "step":
#             self.env_conns[index].send(self.envs[index].step(action.item()))
#         elif request == "reset":
#             self.env_conns[index].send(self.envs[index].reset())
#
#         else:
#             raise NotImplementedError

@yjh5246
Copy link

yjh5246 commented Mar 19, 2023

This problem does not occur when running Ubuntu, but it does on win10

@Mumasr
Copy link

Mumasr commented Aug 3, 2023

I figure out what the problem is in win10
first, comment this two lines in env.py,you can‘t use pipe like this in window

self.env_conns[index].close()
....
self.agent_conns[index].close()

next, in env.py
the class MultipleEnvironments create all envs in main process and try to access each single env in subprocess
but the _LIB in nes_py can't share during processes because some share memory police in window,i guess.
so, we should create each single env in each subprocess, in function run()

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

4 participants