EdinburghGenomics / pyclarity-lims

Python interface to the GenoLogics LIMS server via its REST API.
MIT License
11 stars 4 forks source link

Exception will attempting to advance() a step #25

Closed tbooth closed 6 years ago

tbooth commented 6 years ago
  File "./clarity_run_id_setter.py", line 68, in main
    Step(lims, id=ep.id).advance()
  File "/lustre/home/pipeline/illuminatus/current/_py3_venv/lib/python3.5/site-packages/pyclarity_lims/entities.py", line 843, in advance
    data=self.lims.tostring(ElementTree.ElementTree(self.root))
  File "/lustre/home/pipeline/illuminatus/current/_py3_venv/lib/python3.5/site-packages/pyclarity_lims/lims.py", line 698, in tostring
    self.write(outfile, etree)
  File "/lustre/home/pipeline/illuminatus/current/_py3_venv/lib/python3.5/site-packages/pyclarity_lims/lims.py", line 703, in write
    etree.write(outfile, encoding='utf-8', xml_declaration=True)
  File "/lustre/software/python/Python-3.5.2/lib/python3.5/xml/etree/ElementTree.py", line 772, in write
    qnames, namespaces = _namespaces(self._root, default_namespace)
  File "/lustre/software/python/Python-3.5.2/lib/python3.5/xml/etree/ElementTree.py", line 875, in _namespaces
    for elem in elem.iter():
AttributeError: 'NoneType' object has no attribute 'iter'

Hi,

I got the stack trace above. I'm not sure if this is something broken in the module or just a failure to catch an error condition and convert it to a meaningful error. I think the step was already completed, and I'm not 100% sure I have permission to close it. Will dig further.

Cheers,

TIM

tbooth commented 6 years ago

OK, I simply need to call .get() before I can .advance(). I suspect .advance() should simply call .get() automatically?

Cheers,

TIM

tcezard commented 6 years ago

I see ... I never ran advance() on a Step that was just created. I can add get() in advance to fix this

tbooth commented 6 years ago

Hi Tim, What I'm actually doing is looking for existing processes that match certain criteria then closing them, so: process_i_found.step.advance(), which I've realised is equivalent to Step(lims, id=process_i_found.id).advance(). In both cases the extra get() is needed.

Cheers, TIM