pombreda / pydot

Automatically exported from code.google.com/p/pydot
MIT License
0 stars 0 forks source link

Need to catch AttributeError #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the pebl testsuite (http://pypi.python.org/pypi/pebl)

What is the expected output? What do you see instead?

Expected output is tests passing. Instead, we see:

ERROR: pebl.test.test_pebl_script.TestHtmlReport.test_htmlreport
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/builddir/build/BUILD/pebl-1.0.2/src/pebl/test/test_pebl_script.py",
line 32, in test_htmlreport
    pebl_script.run(os.path.join(self.tempdir, 'config.txt'))
  File "/builddir/build/BUILD/pebl-1.0.2/src/pebl/pebl_script.py", line 71, in
run
    merged_result.tohtml()
  File "/builddir/build/BUILD/pebl-1.0.2/src/pebl/result.py", line 150, in
tohtml
    outdir or config.get('result.outdir')
  File "/builddir/build/BUILD/pebl-1.0.2/src/pebl/result.py", line 211, in
htmlreport
    top.layout()
  File "/builddir/build/BUILD/pebl-1.0.2/src/pebl/network.py", line 289, in
layout
    self.node_positions = [[int(float(i)) for i in
n.get_pos()[1:-1].split(',')] for n in nodes]
  File "/builddir/build/BUILD/pebl-1.0.2/src/pebl/network.py", line 288, in
<genexpr>
    nodes = (n for n in dotgraph.get_node_list() if n.get_pos())
  File "/usr/lib/python2.7/site-packages/pydot.py", line 682, in <lambda>
    self.__setattr__('get_'+attr, lambda a=attr : self.__get_attribute__(a))
  File "/usr/lib/python2.7/site-packages/pydot.py", line 594, in
__get_attribute__
    defaults = self.get_parent_graph().get_node( default_node_name )
AttributeError: 'NoneType' object has no attribute 'get_node'

What version of the product are you using? On what operating system?

1.0.25 on Fedora 15.

Please provide any additional information below.

I have attached a simple patch by Thomas Spura which resolves the issue.

Original issue reported on code.google.com by spo...@gmail.com on 11 Oct 2011 at 2:54

Attachments:

GoogleCodeExporter commented 9 years ago
This did fix the test suite issue for me:
nosetests -v pebl.test.test_result:TestHtmlReport

However, the tutorial is still not working for me (on Ubuntu):
>>> ex1result.tohtml("booya6")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/pebl-1.01-py2.6-linux-x86_64.egg/pebl/result.py", line 150, in tohtml
    outdir or config.get('result.outdir')
  File "/usr/local/lib/python2.6/dist-packages/pebl-1.01-py2.6-linux-x86_64.egg/pebl/result.py", line 211, in htmlreport
    top.layout()
  File "/usr/local/lib/python2.6/dist-packages/pebl-1.01-py2.6-linux-x86_64.egg/pebl/network.py", line 289, in layout
    self.node_positions = [[int(i) for i in n.get_pos()[1:-1].split(',')] for n in nodes] 
  File "/usr/local/lib/python2.6/dist-packages/pebl-1.01-py2.6-linux-x86_64.egg/pebl/network.py", line 288, in <genexpr>
    nodes = (n for n in dotgraph.get_node_list() if n.get_pos())
  File "build/bdist.linux-x86_64/egg/pydot.py", line 682, in <lambda>
    # Generate all the Setter methods.
  File "build/bdist.linux-x86_64/egg/pydot.py", line 594, in __get_attribute__
    try: 
AttributeError: 'NoneType' object has no attribute 'get_node'

Original comment by medici...@gmail.com on 7 Dec 2011 at 10:38

GoogleCodeExporter commented 9 years ago
this appears to work fine, however, using pebl 1.0.2

Original comment by medici...@gmail.com on 7 Dec 2011 at 1:19

GoogleCodeExporter commented 9 years ago
Improvements regarding this issue were made in revision 28. Should not occur 
anymore.

Original comment by ero.carr...@gmail.com on 2 Jan 2012 at 11:57