CiscoDevNet / yang-explorer

An open-source Yang Browser and RPC Builder Application
Apache License 2.0
438 stars 177 forks source link

Installation errors: TypeError: _serialize_xml() got an unexpected keyword argument 'short_empty_elements #59

Closed jean-christophe-manciot closed 7 years ago

jean-christophe-manciot commented 7 years ago

Ubuntu 16.10 bash 4.4.0 Python 3.5.2+ virtualenv 15.1.0

All requirements installed correctly.

bash setup.sh
...
Creating default users ..
Copying default models ..
Traceback (most recent call last):
  File "/home/actionmystique/Ansible/git-yang-explorer/v/bin/pyang", line 420, in <module>
    run()
  File "/home/actionmystique/Ansible/git-yang-explorer/v/bin/pyang", line 394, in run
    emit_obj.emit(ctx, modules, fd)
  File "explorer/plugins/cxml.py", line 86, in emit
    cxml.emit_cxml()
  File "explorer/plugins/cxml.py", line 214, in emit_cxml
    fd.write(ET.tostring(module_node))
  File "/usr/lib/python3.5/xml/etree/ElementTree.py", line 1134, in tostring
    short_empty_elements=short_empty_elements)
  File "/usr/lib/python3.5/xml/etree/ElementTree.py", line 775, in write
    short_empty_elements=short_empty_elements)
TypeError: _serialize_xml() got an unexpected keyword argument 'short_empty_elements'
Traceback (most recent call last):
  File "/home/actionmystique/Ansible/git-yang-explorer/v/bin/pyang", line 420, in <module>
    run()
  File "/home/actionmystique/Ansible/git-yang-explorer/v/bin/pyang", line 394, in run
    emit_obj.emit(ctx, modules, fd)
  File "explorer/plugins/cxml.py", line 86, in emit
    cxml.emit_cxml()
  File "explorer/plugins/cxml.py", line 214, in emit_cxml
    fd.write(ET.tostring(module_node))
  File "/usr/lib/python3.5/xml/etree/ElementTree.py", line 1134, in tostring
    short_empty_elements=short_empty_elements)
  File "/usr/lib/python3.5/xml/etree/ElementTree.py", line 775, in write
    short_empty_elements=short_empty_elements)
TypeError: _serialize_xml() got an unexpected keyword argument 'short_empty_elements'
Setup completed.. 
jean-christophe-manciot commented 7 years ago

Full log

.

pgohite commented 7 years ago

Looks like you are using python 3.x, Yang-Explorer is only supported on python 2.7.x

If you have both python 2 and python 3 install on your system, you may create virtualenv for 2.7 before running setup.sh.

cd \<Yang-Explorer Root> rm -rf v virtualenv -p `which python2.7` v bash setup.sh**

jean-christophe-manciot commented 7 years ago

OK - I suggest to update the installation process in README.me because most Linux distributions have both python versions installed by default.

peteasa commented 4 years ago

You could also patch yang explorer to make it work with python3. I have done this and it works for me. I built django (v1.8.3), lxml (v4.4.2), pyang (v2.1), ydk-py (yam branch latest), applied my own myrequirements.txt and used latest explorer https://github.com/CiscoDevNet/yang-explorer/pull/110/commits/c94f56544d0aa3d6d0d158d9de4da9efebe06d35 and it all seemed to work. I am not using a virtual environment.

yang-explorer.zip