Pylab Fails with Runtime Error on Win XP Under Python 2.4

W. eWatson notvalid2 at sbcglobal.net
Sun Oct 12 14:24:32 EDT 2008


I copied the following code from a matplotlib tutorial, and it fails. I'm 
using python 2.4 on Win XP. It's matplotlib-0.98.3.win32-py2.4exe. It fails 
in IDLE with a small window showing a runtime error. Clicking the OK on it 
kills IDLE and the shell. If I double-click on the py file, the console 
briefly appears too quickly to notice any contents. I have read raw to stop 
it. If I execute it from a console window, I'm told the results will be 
available there. I've long forgotten how to get a console window up in Win 
XP. I can strip it all the code way down to the from, and it will fail the 
same way. Bad matplotlib install? Python error?

Here's the code. I added finish() to it.

from pylab import *

def finish():
     print; print "Bye"
     print
     raw_input('Press Enter to Quit')
     sys.exit()

t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
plot(t, s, linewidth=1.0)

xlabel('time (s)')
ylabel('voltage (mV)')
title('About as simple as it gets, folks')
grid(True)
show()
finish()



-- 
                                W. eWatson

              (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
               Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet

                     Web Page: <www.speckledwithstars.net/>




More information about the Python-list mailing list