MJL85 / natlas

natlas - Network Discovery and Auto-Diagramming
GNU General Public License v2.0
514 stars 111 forks source link

cannot concatenate 'str' and 'int' objects #2

Closed zimage closed 9 years ago

zimage commented 9 years ago
$ ./mnet-graph.py -r x.x.x.x -d 20 -f foo.svg -t "Network Diagram" -c ./mnet.conf
Couldn't import dot_parser, loading of dot files will not be possible.
MNet-Graph v0.1
Written by Michael Laforest <mjlaforest@gmail.com>

    Config file: ./mnet.conf
      Root node: x.x.x.x
    Output file: foo.svg
    Crawl depth: 20
  Diagram title: Network Diagram

router-name (x.x.x.x)
-----
----- DEVICES
-----
      Name: router-name
        IP: x.x.x.x
  Platform: UNKNOWN
   Routing: yes
   OSPF ID: x.x.x.x
   BGP LAS: 65001
  HSRP Pri: None
  HSRP VIP: None
 Stack Cnt: 0
  VSS Mode: 0
VSS Domain: None

-----
----- LINKS
-----
-----
----- Summary
-----
Discovered devices: 1
Discovered links:   0
Traceback (most recent call last):
  File "./mnet-graph.py", line 666, in <module>
    main(sys.argv[1:])
  File "./mnet-graph.py", line 492, in main
    output_dot(opt_dot, opt_title)
  File "./mnet-graph.py", line 661, in output_dot
    output_func(dot_file)
  File "/Library/Python/2.7/site-packages/pydot.py", line 1602, in <lambda>
    lambda path, f=frmt, prog=self.prog : self.write(path, format=f, prog=prog))
  File "/Library/Python/2.7/site-packages/pydot.py", line 1696, in write
    dot_fd.write(self.create(prog, format))
  File "/Library/Python/2.7/site-packages/pydot.py", line 1740, in create
    self.write(tmp_name)
  File "/Library/Python/2.7/site-packages/pydot.py", line 1694, in write
    dot_fd.write(self.to_string())
  File "/Library/Python/2.7/site-packages/pydot.py", line 1452, in to_string
    graph.append( node.to_string()+'\n' )
  File "/Library/Python/2.7/site-packages/pydot.py", line 722, in to_string
    node_attr.append( attr + '=' + quote_if_necessary(value) )
TypeError: cannot concatenate 'str' and 'int' objects
liftedkilt commented 9 years ago

Did you install pydot?

zimage commented 9 years ago
$ pip show pydot
---
Metadata-Version: 1.1
Name: pydot
Version: 1.0.2
Summary: Python interface to Graphviz's Dot
Home-page: http://code.google.com/p/pydot/
Author: Ero Carrera
Author-email: ero@dkbza.org
License: MIT
Location: /Library/Python/2.7/site-packages
Requires: pyparsing, setuptools
liftedkilt commented 9 years ago

What distro?

On Tue, Jul 7, 2015, 12:43 PM Tim Nowaczyk notifications@github.com wrote:

$ pip show pydot

Metadata-Version: 1.1 Name: pydot Version: 1.0.2 Summary: Python interface to Graphviz's Dot Home-page: http://code.google.com/p/pydot/ Author: Ero Carrera Author-email: ero@dkbza.org License: MIT Location: /Library/Python/2.7/site-packages Requires: pyparsing, setuptools

— Reply to this email directly or view it on GitHub https://github.com/MJL85/mnet/issues/2#issuecomment-119314948.

zimage commented 9 years ago

MacOS Yosemite.

kamakazikamikaze commented 9 years ago

We're also experiencing this error on Ubuntu 14.10 (Server).

blake commented 9 years ago

You want pydot2.

pip install pydot2

MJL85 commented 9 years ago

I had this problem today testing on Windows. I noticed pip would only install pydot 1.0.2. You can force it to update to 1.0.28 with:
# pip install --allow-unverified pydot pydot==1.0.28

This resolved the issue for me. However I am looking at moving to either pydot2 as blake mentioned or something else as pydot appears to no longer be under development. Also I added mnet to pip so you can install from there now.

kamakazikamikaze commented 9 years ago

If you do transition to pydot2 be sure to reference this StackOverflow submission. It looks like some files are omitted when upgrading/installing pydot2 because it expects some source code in pydot1 to already exist. If you don't add this into the README then a lot of users will experience said issues.