Hi I am relatively new to Python so forgive me if I have missed an
elephant in the room so to speak.
My code has worked for the whole day, but this afternoon I have begun receiving the error

Traceback (most recent call last):
  File "C:\Documents and Settings\King Alex\My Documents\Summer Project\Python files\graphs.py", line 7, in <module>
    plt.show()
  File "D:\Python254\Lib\site-packages\matplotlib\backends\backend_tkagg.py", line 79, in show
    Tk.mainloop()
  File "D:\Python254\lib\lib-tk\Tkinter.py", line 328, in mainloop
    _default_root.tk.mainloop(n)
AttributeError: 'NoneType' object has no attribute 'tk'

whenever I try to call

plt.show()

To use a simple example this occurs when I run

import networkx as nx
import matplotlib.pyplot as plt

G = nx.Graph()
G.add_node(1)

plt.show()

Help solving this is very appreciated as it occured without me making a change to my code. During running I was receiving errors from visual c++ about the program terminating unusually.

I am using python 2.5.4 with NumPy, DimPy, Matplotlib and NetworkX. Let me know if any other information would be helpful.

If you didn't edit the code, the only thing I could think of is that one of the files being used or imported got changed. But if none of the files necessary to run the program were edited I see no reason that it shouldn't work.

Hi the problem seems to be perhaps with networkx
When I

import networkx as nx

I receive the deprecation warning

Warning (from warnings module):
  File "C:\Python25\lib\site-packages\matplotlib\numerix\__init__.py", line 18
    warnings.warn(msg, DeprecationWarning)
DeprecationWarning: 
**********************************************************
matplotlib.numerix and all its subpackages are deprecated.
They will be removed soon.  Please use numpy instead.
**********************************************************

pyplot.show() works fine with normal graphs, and none of the networkx drawing methods work. Any advice on this, even though I can't solve the original mystery of why this has stopped working.

Clibbon, have you solved this problem?
"matplotlib.numerix and all its subpackages are deprecated."

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.