Skip to content

from mlagents_envs.envs.unity_gym_env import UnityToGymWrapper cause HTTP error #6268

@GF-Huang

Description

@GF-Huang

Describe the bug
As title.

To Reproduce
Steps to reproduce the behavior:

from mlagents_envs.envs.unity_gym_env import UnityToGymWrapper

Console logs / stack traces

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
File c:\Users\jokeh\miniconda3\envs\ML-Agents\lib\site-packages\mlagents_envs\registry\binary_utils.py:218, in load_remote_manifest(url)
    217 try:
--> 218     request = urllib.request.urlopen(url, timeout=30)
    219 except urllib.error.HTTPError as e:  # type: ignore

File c:\Users\jokeh\miniconda3\envs\ML-Agents\lib\urllib\request.py:216, in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    215     opener = _opener
--> 216 return opener.open(url, data, timeout)

File c:\Users\jokeh\miniconda3\envs\ML-Agents\lib\urllib\request.py:525, in OpenerDirector.open(self, fullurl, data, timeout)
    524     meth = getattr(processor, meth_name)
--> 525     response = meth(req, response)
    527 return response

File c:\Users\jokeh\miniconda3\envs\ML-Agents\lib\urllib\request.py:634, in HTTPErrorProcessor.http_response(self, request, response)
    633 if not (200 <= code < 300):
--> 634     response = self.parent.error(
    635         'http', request, response, code, msg, hdrs)
    637 return response

File c:\Users\jokeh\miniconda3\envs\ML-Agents\lib\urllib\request.py:563, in OpenerDirector.error(self, proto, *args)
    562 args = (dict, 'default', 'http_error_default') + orig_args
--> 563 return self._call_chain(*args)

File c:\Users\jokeh\miniconda3\envs\ML-Agents\lib\urllib\request.py:496, in OpenerDirector._call_chain(self, chain, kind, meth_name, *args)
    495 func = getattr(handler, meth_name)
--> 496 result = func(*args)
    497 if result is not None:

File c:\Users\jokeh\miniconda3\envs\ML-Agents\lib\urllib\request.py:643, in HTTPDefaultErrorHandler.http_error_default(self, req, fp, code, msg, hdrs)
    642 def http_error_default(self, req, fp, code, msg, hdrs):
--> 643     raise HTTPError(req.full_url, code, msg, hdrs, fp)

HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
Cell In[7], line 10
      7 from IPython.display import display, clear_output as ipython_clear_output
      9 from mlagents_envs.environment import UnityEnvironment
---> 10 from mlagents_envs.envs.unity_gym_env import UnityToGymWrapper

File c:\Users\jokeh\miniconda3\envs\ML-Agents\lib\site-packages\mlagents_envs\envs\__init__.py:5
      2 from mlagents_envs.envs.pettingzoo_env_factory import logger, PettingZooEnvFactory
      4 # Register each environment in default_registry as a PettingZooEnv
----> 5 for key in default_registry:
      6     env_name = key
      7     if key[0].isdigit():

File c:\Users\jokeh\miniconda3\envs\ML-Agents\lib\site-packages\mlagents_envs\registry\unity_env_registry.py:118, in UnityEnvRegistry.__iter__(self)
    117 def __iter__(self) -> Iterator[Any]:
--> 118     self._load_all_manifests()
    119     yield from self._REGISTERED_ENVS

File c:\Users\jokeh\miniconda3\envs\ML-Agents\lib\site-packages\mlagents_envs\registry\unity_env_registry.py:83, in UnityEnvRegistry._load_all_manifests(self)
     81 for path_to_yaml in self._manifests:
     82     if path_to_yaml[:4] == "http":
---> 83         manifest = load_remote_manifest(path_to_yaml)
     84     else:
     85         manifest = load_local_manifest(path_to_yaml)

File c:\Users\jokeh\miniconda3\envs\ML-Agents\lib\site-packages\mlagents_envs\registry\binary_utils.py:220, in load_remote_manifest(url)
    218     request = urllib.request.urlopen(url, timeout=30)
    219 except urllib.error.HTTPError as e:  # type: ignore
--> 220     e.reason = f"{e.reason} {url}"  # type: ignore
    221     raise
    222 manifest_path = os.path.join(tmp_dir, str(uuid.uuid4()) + ".yaml")

AttributeError: can't set attribute 'reason'

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • Unity Version: Unity 6000.3.0f1
  • OS + version: Windows 11 25H2
  • ML-Agents version: 1.1.0

NOTE: We are unable to help reproduce bugs with custom environments. Please attempt to reproduce your issue with one of the example environments, or provide a minimal patch to one of the environments needed to reproduce the issue.

Metadata

Metadata

Assignees

Labels

bugIssue describes a potential bug in ml-agents.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions