crowdAI / marLo

Multi Agent Reinforcement Learning using MalmÖ
MIT License
244 stars 46 forks source link

NameError: name 'etree' is not defined #76

Open OneFiveChen opened 5 years ago

OneFiveChen commented 5 years ago

After installation, I test Single Agent Example. It works. But when I test Multi Agent Example, an error shows

2
{'maze_height': '2'}
Traceback (most recent call last):
  File "multiagentExample.py", line 13, in <module>
    "MarLo-Agent-1"
  File "/home/onefivechen/anaconda3/envs/marlo/lib/python3.6/site-packages/marlo/__init__.py", line 96, in make
    join_tokens = env.init(params, dry_run=True)
  File "/home/onefivechen/anaconda3/envs/marlo/lib/python3.6/site-packages/marlo/base_env_builder.py", line 628, in init
    self.build_env(self.params)
  File "/home/onefivechen/anaconda3/envs/marlo/lib/python3.6/site-packages/marlo/base_env_builder.py", line 646, in build_env
    self.setup_mission_spec(params)
  File "/home/onefivechen/anaconda3/envs/marlo/lib/python3.6/site-packages/marlo/base_env_builder.py", line 601, in setup_mission_spec
    mission_xml = self.transform_mission_xml(params, mission_xml)
  File "/home/onefivechen/anaconda3/envs/marlo/lib/python3.6/site-packages/marlo/base_env_builder.py", line 577, in transform_mission_xml
    vp = etree.Element(ns + "VideoProducer")
NameError: name 'etree' is not defined

I am sure that two port 10000 and 10001 is open and running Minecraft. I thought it may need import xml.etree, so I add import xml.etree as etree. And it didn't work. AttributeError: module 'xml.etree' has no attribute 'Element'

So, how to solve this VideoProducer problem?

andrekramer commented 5 years ago

This was fixed recently in the marLo github repository so you could re-install from that. Please see:

https://github.com/crowdAI/marLo/pull/73

(Changing etree to ElementTree)

OneFiveChen commented 5 years ago

@andrekramer I tried this before, but it also caused an another problem that

2
{'maze_height': '2'}
Traceback (most recent call last):
  File "multiagentExample.py", line 13, in <module>
    "MarLo-Agent-1"
  File "/home/onefivechen/anaconda3/envs/marlo/lib/python3.6/site-packages/marlo/__init__.py", line 96, in make
    join_tokens = env.init(params, dry_run=True)
  File "/home/onefivechen/anaconda3/envs/marlo/lib/python3.6/site-packages/marlo/base_env_builder.py", line 628, in init
    self.build_env(self.params)
  File "/home/onefivechen/anaconda3/envs/marlo/lib/python3.6/site-packages/marlo/base_env_builder.py", line 646, in build_env
    self.setup_mission_spec(params)
  File "/home/onefivechen/anaconda3/envs/marlo/lib/python3.6/site-packages/marlo/base_env_builder.py", line 601, in setup_mission_spec
    mission_xml = self.transform_mission_xml(params, mission_xml)
  File "/home/onefivechen/anaconda3/envs/marlo/lib/python3.6/site-packages/marlo/base_env_builder.py", line 580, in transform_mission_xml
    w.text = str(params.videoResolution[0] if params.videoResolution else '800')
AttributeError: 'NoneType' object has no attribute 'text'
tanakat01 commented 5 years ago

I submitted a pull request to fix this problem (see PR#77).

MonikaBarget commented 4 years ago

Has anything happened on this front? I am also getting this error when using "etree" although I did import the libraries. Thanks!