4

I am trying to run a huge evolution simulating python software from the command line. The software is dependent on the following python packages:

1-networkX

2-pyparsing

3-numpy

4-pydot

5-matplotlib

6-graphviz

The error I get is this:

Couldn't import dot_parser, loading of dot files will not be possible.
initializing with file= initAdapt.py in model dir= ./Test_adaptation//
Traceback (most recent call last):
  File "run_evolution.py", line 230, in <module>
    gr.write_dot( os.path.join(test_output_dir, 'test_net.dot') )
  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

I have already tried the solution suggested for a similar question on stack overflow. I still get the same error. Here are the package versions I am using and my python version.

  • I'm using python 2.7.6
  • typing the command which -a python yields the result: "/usr/bin/python".

1-pyparsing (1.5.7)

2-pydot (1.0.2)

3-matplotlib (1.3.1)

4-graphviz (0.4.2)

5-networkx (0.37)

6-numpy (1.8.0rc1)

Any ideas? Seeing that the solution to similar questions is not working for me, I think the problem might be more fundamental in my case. Something wrong with the way I installed my python perhaps.

2 Answers 2

3

Any particular reason you're not using the newest version of pydot?

This revision of 1.0.2 looks like it fixes exactly that problem:

https://code.google.com/p/pydot/source/diff?spec=svn10&r=10&format=side&path=/trunk/pydot.py

See line 722.

Sign up to request clarification or add additional context in comments.

2 Comments

Version 1.0.28 fixes the problem. Thanks!!! I still get the message "Couldn't import dot_parser, loading of dot files will not be possible" when I run my program though.
yes, the error still comes out from 1.0.28's pydot. And I modified the pydot.py by deleting the lines that does the "import dot_parser" and everything is good.
1

Upgrading my pyparsing module fixed this issue. Try:

pip install --upgrade pyparsing

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.