Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute error when writing xml output #306

Open
graslandschaft opened this issue Oct 29, 2018 · 2 comments
Open

Attribute error when writing xml output #306

graslandschaft opened this issue Oct 29, 2018 · 2 comments

Comments

@graslandschaft
Copy link

graslandschaft commented Oct 29, 2018

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'
@mpsonntag
Copy link
Contributor

Thanks for reporting this issue!

I saved a document using Python 2.7 with odml 1.4.1 but was not able to recreate the reported error.
Could you give more details about what you are trying to save? If you could run ...

from odml.tools import dumper
dumper.dumpDoc(doc)

... where doc is the document that results in your error and paste the resulting printed document maybe I can get a better idea what is actually going wrong.

@graslandschaft
Copy link
Author

graslandschaft commented Nov 9, 2018

 *datasets (type='dataset')
  :files (value=./2018-11-09/trial_0004_info.dat, dtype='string')
 *[u'Recording'] (type='recording')
  :Comment (definition='Comments on the recording session.', value=, dtype='string')
  :StartDate (definition='The date the recording session was conducted\n      (YYYY-MM-DD format).', value=, dtype='date')
  :EndDate (definition='The date the recording session ended (YYYY-MM-DD\n      format).', value=, dtype='date')
  :Experimenter (definition='The name of the person actually performing the\n      recordings.', value=Joerg Henninger, dtype='person')
  :StartTime (value=2018-11-09 20:02:34, dtype='string')
 *[u'Fish tank at Krahe Lab'] (type='setup')
  :Maintainer (definition='The person who is responsible for the setup\n      maintanance.', value=Joerg Henninger, dtype='string')
  :Description (definition='A textual description of the setup.', value=, dtype='string')
  :Creator (definition='The person who built the setup.', value=[Joerg Henninger,Jan Benda], dtype='string')
  :Location (definition='The location of the setup (e.g. room).', value=Krahe Lab, HU Berlin, dtype='string')
  :Department (definition='The department where the setup is\n      located.', value=Abteilung Neuroethologie, dtype='string')
  :Config (definition='An identifier of the used setup\n      configuration, e.g. if variations of the same setup are\n      used.', value=, dtype='string')
 *[u'Observation of Behavior'] (type='experiment/bahavior')
  :IndividualCount (definition='The number of individuals that are\n      observed/investigated at the same time.', value=1, dtype='int')
  :Task (value=, dtype='string')
  :definition (definition='A definition of the conducted experiment.', value=, dtype='string')
 *[u'Subject'] (type='subject')
  :Comment (definition='A general comment on a specific\n      subject.', value=, dtype='text')
  :- (definition='The tank in which the subject is housed.', value=, dtype='string')
  :Subject id (value=, dtype='string')
  :TrivialName (definition='The trivial name of the species like\n      Honeybee, Human.', value=, dtype='string')
  :Species (definition='The scientific name of the species e.g. Apis\n      mellifera, Homo sapiens.', value=, dtype='string')
 *camera00 (type='hardware/camera')
  :Framerate (value=25, unit='Hz', dtype='int')
 *events (type='event_list')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants