[Python-modules-team] Bug#735776: python-networkx: networkx raises	TypeError when reading input from .gml file
    Matus Valo 
    matusvalo at gmail.com
       
    Fri Jan 17 19:36:52 UTC 2014
    
    
  
Package: python-networkx
Version: 1.7~rc1-3
Severity: normal
Dear Maintainer,
networkx raises TypeError when reading input from .gml file:
$ python cart_product.py c3.gml c3.gml
graph [
  node [
    id 0
Traceback (most recent call last):
  File "cart_product.py", line 22, in <module>
    for line in nx.generate_gml(X):
  File "/usr/lib/pymodules/python2.7/networkx/readwrite/gml.py", line 328, in generate_gml
    yield 2*indent+'label %s'%label
TypeError: not all arguments converted during string formatting
Bug is affecting Debian stable and sid. It seems that version 1.7-2 in
Debian experimental contains the same bug, since it contains the same
line in file gml.py.
It seems that bug is fixed by applying the following patch (tested for
debian stable and sid):
--- a/networkx/readwrite/gml.py
+++ b/networkx/readwrite/gml.py
@@ -325,7 +325,7 @@
         label=G.node[n].get('label',n)
         if is_string_like(label):
             label='"%s"'%label
-        yield 2*indent+'label %s'%label
+        yield 2*indent+'label {0}'.format(label)
         if n in G:
           for k,v in G.node[n].items():
               if k=='id' or k == 'label': continue
-- System Information:
Debian Release: 7.3
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages python-networkx depends on:
ii  python          2.7.3-4+deb7u1
ii  python-support  1.0.15
Versions of packages python-networkx recommends:
ii  python-matplotlib     1.1.1~rc2-1
ii  python-numpy          1:1.6.2-1.2
ii  python-pkg-resources  0.6.24-1
ii  python-pygraphviz     1.1-2
ii  python-scipy          0.10.1+dfsg2-1
ii  python-yaml           3.10-4
python-networkx suggests no packages.
-- no debconf information
-------------- next part --------------
graph [
comment "C_3"
     node [ id 1 ]
     node [ id 2 ]
     node [ id 3 ]
     edge[ source 1 target 2 ]
     edge[ source 2 target 3 ]
     edge[ source 3 target 1 ]
]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cart_product.py
Type: text/x-python
Size: 576 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20140117/0f35e302/attachment.py>
    
    
More information about the Python-modules-team
mailing list