Setting an attribute on the graph fails

Help
2013-02-19
2013-04-20
  • Hello,

    I'm building a graph from the Python API, under Ubuntu 12.10. Tulip is 4.1. According to the documentation, there is a tlp.Graph.setAttribute() method.

    See the following code:

    $ python
    Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
    [GCC 4.7.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from tulip import *
    >>> graph = tlp.newGraph()
    >>> graph.setAttribute("hasTreeStructure", True)
    >>> tlp.saveGraph(graph, "toto.tlp")
    Write error: No data type serializer found for mangled type  b 
    Write error: No data type serializer found for mangled type  Ss 
    True
    >>>
    

    And the resulting "toto.tlp" file defines no attribute on the graph:

    $ cat toto.tlp 
    (tlp "2.3"
    (date "02-19-2013")
    (comments "")
    (nb_nodes 0)
    ;(nodes <node_id> <node_id> ...)
    (nodes)
    (nb_edges 0)
    ;(edge <edge_id> <source_id> <target_id>)
    (property  0 color "viewColor"
    (default "(255,0,0,255)" "(0,0,0,255)")
    )
    (property  0 string "viewFont"
    (default "TulipBitmapDir/font.ttf" "TulipBitmapDir/font.ttf")
    )
    (property  0 int "viewFontSize"
    (default "18" "18")
    )
    (property  0 string "viewLabel"
    (default "" "")
    )
    (property  0 int "viewShape"
    (default "4" "0")
    )
    (property  0 size "viewSize"
    (default "(1,1,1)" "(0.125,0.125,0.5)")
    )
    (property  0 int "viewSrcAnchorShape"
    (default "0" "-1")
    )
    (property  0 size "viewSrcAnchorSize"
    (default "(1,1,0)" "(0.25,0.25,0.25)")
    )
    (property  0 int "viewTgtAnchorShape"
    (default "0" "50")
    )
    (property  0 size "viewTgtAnchorSize"
    (default "(1,1,0)" "(0.25,0.25,0.25)")
    )
    (graph_attributes 0 
    )
    )
    
     
  • Of course, the same happens also with integers and strings (with the according correct error message about the mangled type).

     
  • FYI, I just built Tulip from SVN and this works.

     
  • Confere:

    $ python
    Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
    [GCC 4.7.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 
    KeyboardInterrupt
    >>> from tulip import *
    >>> tlp.getTulipRelease()
    '4.2.0'
    >>> graph = tlp.newGraph()
    >>> graph.setAttribute("hasTreeStructure", True)
    >>> tlp.saveGraph(graph, "toto.tlp")
    True
    >>>
    
    $ cat toto.tlp 
    (tlp "2.3"
    (date "02-20-2013")
    (comments "")
    (nb_nodes 0)
    ;(nodes <node_id> <node_id> ...)
    (nodes)
    (nb_edges 0)
    ;(edge <edge_id> <source_id> <target_id>)
    (property  0 color "viewColor"
    (default "(255,0,0,255)" "(0,0,0,255)")
    )
    (property  0 string "viewFont"
    (default "TulipBitmapDir/font.ttf" "TulipBitmapDir/font.ttf")
    )
    (property  0 int "viewFontSize"
    (default "18" "18")
    )
    (property  0 string "viewLabel"
    (default "" "")
    )
    (property  0 int "viewShape"
    (default "4" "0")
    )
    (property  0 size "viewSize"
    (default "(1,1,1)" "(0.125,0.125,0.5)")
    )
    (property  0 int "viewSrcAnchorShape"
    (default "0" "-1")
    )
    (property  0 size "viewSrcAnchorSize"
    (default "(1,1,0)" "(0.25,0.25,0.25)")
    )
    (property  0 int "viewTgtAnchorShape"
    (default "0" "50")
    )
    (property  0 size "viewTgtAnchorSize"
    (default "(1,1,0)" "(0.25,0.25,0.25)")
    )
    (graph_attributes 0 
    (bool "hasTreeStructure" true)
    (string "file" "toto.tlp")
    )
    )