mujoco-py icon indicating copy to clipboard operation
mujoco-py copied to clipboard

XML parse error at line 0, column 0:\nFailed to open file\n

Open abhigenie92 opened this issue 8 years ago • 8 comments

$ python
Python 3.6.1 |Anaconda custom (64-bit)| (default, May 11 2017, 13:09:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mujoco_py
>>> from os.path import dirname
>>> model = mujoco_py.load_model_from_path(dirname(dirname(mujoco_py.__file__))  +"/xmls/claw.xml")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "mujoco_py/cymj.pyx", line 132, in mujoco_py.cymj.load_model_from_path
Exception: Failed to load XML file: /nohome/jaan/abhishek/anaconda3/lib/python3.6/site-packages/mujoco_py-1.50.1.31-py3.6.egg/xmls/claw.xml. mj_loadXML error: b'XML parse error at line 0, column 0:\nFailed to open file\n'

Mujoco_py installed correctly and imports fine. I get the above error.

$ pip list | grep mujoco
mujoco-py (1.50.1.31)
$ pip list | grep gym
gym (0.9.4)

I am using the mujoco_py and gym installed from the github repo. directly. Everything is latest.

Using the cython 0.27.3 still doesn't work as referenced here - https://github.com/openai/mujoco-py/issues/131#issuecomment-340081199 in this issue https://github.com/openai/mujoco-py/issues/131#issuecomment-340081199

abhigenie92 avatar Nov 12 '17 07:11 abhigenie92

I was getting the same error. I wrote full path of my xml file in model line and it worked. model = load_model_from_path("/home/joy/.mujoco/mjpro150/mujoco-py-1.50.1.0/xmls/fetch/main.xml")

ghost avatar Jan 23 '18 15:01 ghost

orflow) gbenga@gbenga-Lenovo:~/Downloads/mujoco-py-master/examples$ python3 disco_fetch.py Traceback (most recent call last): File "disco_fetch.py", line 9, in model = load_model_from_path("xmls/fetch/main.xml") File "cymj.pyx", line 131, in mujoco_py.cymj.load_model_from_path Exception: Failed to load XML file: xmls/fetch/main.xml. mj_loadXML error: b'XML parse error at line 0, column 0:\nFailed to open file\n'

GbengaOdesanmi avatar Oct 25 '18 15:10 GbengaOdesanmi

@abhigenie92 if you update to latest mujoco-py, xmls are now distributed with the package.

machinaut avatar Oct 25 '18 20:10 machinaut

@GbengaOdesanmi I am getting the exact error, did you manage to solve it?

Ameyapores avatar Nov 02 '18 15:11 Ameyapores

The XMLs are included with the python package, but don't seem to be getting installed to that location.

Does it work if you download the files or checkout the repo and load the model from there?

machinaut avatar Nov 02 '18 21:11 machinaut

I just updated the readme to use a humanoid xml as an example instead.

https://github.com/openai/mujoco-py#install-and-use-mujoco-py

machinaut avatar Nov 02 '18 21:11 machinaut

@Ameyapores then it was path problem, and i was able to resolve it, yesterday, I also had the same problem. try to check the updated readme. thanks @machinaut

GbengaOdesanmi avatar Nov 03 '18 07:11 GbengaOdesanmi

I had a similar error earlier today - as it turns out the message spewed by the compiler isn't very descriptive of the underlying error. In my case, the XML file I was trying to load had other XML dependencies it couldn't access or find. Fixed it by moving around some files. Hope this helps someone out!

cyrilzakka avatar Nov 19 '18 21:11 cyrilzakka