nzhenev / yapgvb

Automatically exported from code.google.com/p/yapgvb
0 stars 0 forks source link

Error reading graph from dot file #20

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Load simple.dot with yapgvb.Graph.read()

simple.dot: 
 digraph graphname {
     a -> b -> c;
     b -> d;
 }

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

No error expected. Instead, this python error stack: 
>>> yapgvb.Graph.read('simple.dot')
********************************************************************************
Function:  __init__ at 
/Library/Python/2.6/site-packages/yapgvb/_yapgvb_py.py:106
Calling:   CGraph.__original_init__(self, *a,**b)
           ('/Library/Python/2.6/site-packages/yapgvb/__init__.py', 181, 'cgraph_init_wrapper')
TypeError: __init__() takes exactly 3 arguments (2 given)
    Args:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.6/site-packages/yapgvb/__init__.py", line 245, in read
    newgraph = cls(input_stream_or_filename)
  File "/Library/Python/2.6/site-packages/yapgvb/__init__.py", line 531, in __init__
    GraphBase.__init__(self, arg)
  File "/Library/Python/2.6/site-packages/yapgvb/__init__.py", line 275, in __init__
    CGraph.__init__(self,*args,**keywords)
  File "/Library/Python/2.6/site-packages/yapgvb/__init__.py", line 181, in cgraph_init_wrapper
    CGraph.__original_init__(self, *a,**b) 
  File "/Library/Python/2.6/site-packages/yapgvb/_yapgvb_py.py", line 52, in fc
    print >> sys.stderr, "        %-30s (%s)" % (repr(x),x.__class__)
  File "/Library/Python/2.6/site-packages/yapgvb/__init__.py", line 354, in __repr__
    return '<%s "%s">' % (self.__class__.__name__, self)
  File "/Library/Python/2.6/site-packages/yapgvb/__init__.py", line 351, in __str__
    return self.name
  File "/Library/Python/2.6/site-packages/yapgvb/_yapgvb_py.py", line 102, in <lambda>
    name = property(lambda x: x._name, readonly)
AttributeError: 'Graph' object has no attribute '_name'

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

1.1.3

Please provide any additional information below.

Running on Mac OSX 10.6
>>> sys.version
'2.6.1 (r261:67515, Jun 24 2010, 21:47:49) \n[GCC 4.2.1 (Apple Inc. build 
5646)]'

Original issue reported on code.google.com by ngaloppo@gmail.com on 23 Nov 2010 at 7:39

GoogleCodeExporter commented 8 years ago
Take home message was that reading dot files is not supported yet. More 
comments below. Have Another Day.

I did all this under Win32. 

Original error message:
********************************************************************************

Function:  __init__ at c:\python27\lib\site-packages\yapgvb\_yapgvb_py.py:106
Calling:   CGraph.__original_init__(self, *a,**b)
           ('c:\\python27\\lib\\site-packages\\yapgvb\\__init__.py', 181, 'cgrap
h_init_wrapper')
TypeError: __init__() takes exactly 3 arguments (2 given)
    Args:
Traceback (most recent call last):
  File "update.py", line 74, in <module>
    graph.read("projects.gv")
  File "c:\python27\lib\site-packages\yapgvb\__init__.py", line 245, in read
    newgraph = cls(input_stream_or_filename)
  File "c:\python27\lib\site-packages\yapgvb\__init__.py", line 511, in __init__

    GraphBase.__init__(self, arg)
  File "c:\python27\lib\site-packages\yapgvb\__init__.py", line 275, in __init__

    CGraph.__init__(self,*args,**keywords)
  File "c:\python27\lib\site-packages\yapgvb\__init__.py", line 181, in cgraph_i
nit_wrapper
    CGraph.__original_init__(self, *a,**b)
  File "c:\python27\lib\site-packages\yapgvb\_yapgvb_py.py", line 52, in fc
    print >> sys.stderr, "        %-30s (%s)" % (repr(x),x.__class__)
  File "c:\python27\lib\site-packages\yapgvb\__init__.py", line 354, in __repr__

    return '<%s "%s">' % (self.__class__.__name__, self)
  File "c:\python27\lib\site-packages\yapgvb\__init__.py", line 351, in __str__
    return self.name
  File "c:\python27\lib\site-packages\yapgvb\_yapgvb_py.py", line 102, in <lambd
a>
    name = property(lambda x: x._name, readonly)
AttributeError: 'Digraph' object has no attribute '_name'

I traced part of the problem to the name being returned at line 351 of 
__init__.py in folder C:\Python27\Lib\site-packages\yapgvb  

    def __str__(self):
        return self.name

I changed this to 
    def __str__(self):
        return self.__class__.__name__

then I got :

********************************************************************************

Function:  __init__ at c:\python27\lib\site-packages\yapgvb\_yapgvb_py.py:106
Calling:   CGraph.__original_init__(self, *a,**b)
           ('c:\\python27\\lib\\site-packages\\yapgvb\\__init__.py', 181, 'cgrap
h_init_wrapper')
TypeError: __init__() takes exactly 3 arguments (2 given)
    Args:
351>>> Digraph
        <Digraph "Digraph">            (<class 'yapgvb.Digraph'>)
        <open file 'projects.gv', mode 'r' at 0x00B54F40> (<type 'file'>)
    No keywords.
Traceback (most recent call last):
  File "update.py", line 76, in <module>
    graph.read("projects.gv")
  File "c:\python27\lib\site-packages\yapgvb\__init__.py", line 245, in read
    newgraph = cls(input_stream_or_filename)
  File "c:\python27\lib\site-packages\yapgvb\__init__.py", line 513, in __init__

    GraphBase.__init__(self, arg)
  File "c:\python27\lib\site-packages\yapgvb\__init__.py", line 275, in __init__

    CGraph.__init__(self,*args,**keywords)
  File "c:\python27\lib\site-packages\yapgvb\__init__.py", line 181, in cgraph_i
nit_wrapper
    CGraph.__original_init__(self, *a,**b)
  File "c:\python27\lib\site-packages\yapgvb\_yapgvb_py.py", line 59, in fc
    raise NotImplementedError("You are using the pure-Python experimental backen
d.  A lot of things are not implemented yet.")
NotImplementedError: You are using the pure-Python experimental backend.  A lot
of things are not implemented yet.

......

Original comment by darrells...@gmail.com on 8 Jan 2011 at 9:30