Attribute error when writing xml output

Open
#306 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

Start with odml/tools/xmlparser.py, especially save_element around line 82, and reproduce the writer.write_file('{0}.xml'.format("bla")) call shown in the traceback. Done means XML output can be written without the reported AttributeError.

Written by the indexing model from the issue text.

Description

odml version 1.4.1
INFO:rdflib:RDFLib Version: 4.2.2

Traceback: 
writer.write_file('{0}.xml'.format("bla"))
  File "/usr/local/lib/python2.7/dist-packages/odml/tools/xmlparser.py", line 128, in write_file
    data = unicode(self).encode('utf-8')
  File "/usr/local/lib/python2.7/dist-packages/odml/tools/xmlparser.py", line 122, in __unicode__
    return ET.tounicode(self.save_element(self.doc), pretty_print=True)
  File "/usr/local/lib/python2.7/dist-packages/odml/tools/xmlparser.py", line 108, in save_element
    ele = XMLWriter.save_element(v)
  File "/usr/local/lib/python2.7/dist-packages/odml/tools/xmlparser.py", line 108, in save_element
    ele = XMLWriter.save_element(v)
  File "/usr/local/lib/python2.7/dist-packages/odml/tools/xmlparser.py", line 82, in save_element
    cur = E(fmt.name)
AttributeError: 'unicode' object has no attribute 'name'
Dominant language
Python
Stars
25
Forks
30
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from G-Node/python-odml

All issues in G-Node/python-odml

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.