473,570 Members | 2,942 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pylab Fails with Runtime Error on Win XP Under Python 2.4

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('Pres s 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.speckledwi thstars.net/>

Oct 12 '08 #1
7 2356
Dennis Lee Bieber wrote:
On Sun, 12 Oct 2008 11:24:32 -0700, "W. eWatson"
<no*******@sbcg lobal.netdeclai med the following in comp.lang.pytho n:

>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?
Well, in my case, I always put a copy of the XP "Command Prompt"
shortcut on the "start" menu, customized for my tastes (font
size/rows/columns). Lacking that, you should find it under:
start/programs/accessories/command prompt. You could also do start/run
and type "cmd".

As for IDLE (which I don't use) -- possibly some conflict between
its graphics system and that of matplotlib...

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

Runs okay on my system when started from PythonWin, but I'm likely
behind "current"

PythonWin 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)]
on win32.

ActivePython 2.4.3 Build 12 (ActiveState Software Inc.) based on
Python 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)] on
win32

*** Installation started 2007/03/15 21:31 ***
Source: C:\Documents and Settings\All
Users\Documents \matplotlib-0.90.0.win32-py2.4.exe

Let me archive my site-packages directory, and then locate a newer
matplotlib (hmmm, might need to get a newer numpy too){This is getting
nasty -- my numpy had been an egg, and the new installer is an .exe}

Okay -- matplotlib-0.98.3 and numpy-1.2.0 superpack installed...
Trying your code in a fresh PythonWin

Nope... That runs too (this time the left/right navigation arrows
displayed, but the pop-up help over the buttons wasn't).

And -- I just noticed, it IS using tk for plotting, and IDLE is also
tk; good place for conflicting event loops.
Thanks.

Oddly when I use cmd, it gets me to settings and docs. If I try c:\whatever
I get a msg, and it remains in the same folder.

I guess PythonWin is a download for another IDE than IDLE. Will modules be
available like mathplotlib if I install it, or do I have to establish them
for it? I'll look PythonWin once I get past the cmd operation.

Oct 12 '08 #2
Dennis Lee Bieber wrote:
On Sun, 12 Oct 2008 12:56:26 -0700, "W. eWatson"
<no*******@sbcg lobal.netdeclai med the following in comp.lang.pytho n:

>Oddly when I use cmd, it gets me to settings and docs. If I try c:\whatever
I get a msg, and it remains in the same folder.

That's likely the defined "home directory" on your machine.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Dennis Lee Bieber>cd c:\bin

C:\bin>e:

E:\>cd "UserData\Denni s Lee Bieber\My Documents\Pytho n Progs"

E:\UserData\Den nis Lee Bieber\My Documents\Pytho n Progs>dir
Volume in drive E is Data
Volume Serial Number is 2626-D991

Directory of E:\UserData\Den nis Lee Bieber\My Documents\Pytho n Progs

08/23/2008 01:26 PM <DIR .
08/23/2008 01:26 PM <DIR ..
08/23/2008 01:26 PM 1,089 azel_interp.py
04/22/2007 04:43 PM 1,622 binadd.py
04/22/2007 06:03 PM 1,485 binadd2.py
12/11/2006 10:21 PM 119,889 BookList.zip
<snipped>
06/13/2008 08:46 PM 1,929 timing.py
11/03/2007 10:31 PM 56 trips.dat
03/31/2006 11:31 PM 10 update_log
11/30/2005 10:11 AM 104 ut_00.py
112 File(s) 397,123,218 bytes
2 Dir(s) 270,550,671,360 bytes free

E:\UserData\Den nis Lee Bieber\My Documents\Pytho n Progs>

NOTE: to change directory you need to enter the command:
cd new-directory
Without the "cd" your entry is being treated as the path to an
executable program -- and directories, of course, are not executable. To
change to a different partition/drive, you do enter just the drive
letter and a colon. And you need to do that separately -- each drive
maintains a "current directory"

E:\UserData\Den nis Lee Bieber\My Documents\Pytho n Progs>cd c:\bin

E:\UserData\Den nis Lee Bieber\My Documents\Pytho n Progs>dir
Volume in drive E is Data
Volume Serial Number is 2626-D991

Directory of E:\UserData\Den nis Lee Bieber\My Documents\Pytho n Progs

<snipped>

E:\UserData\Den nis Lee Bieber\My Documents\Pytho n Progs>c:

C:\bin>

Notice how changing drive to C: put me into the bin directory
specified earlier. If I now enter e:, I'll be back to the Python Progs
directory.
>I guess PythonWin is a download for another IDE than IDLE. Will modules be
available like mathplotlib if I install it, or do I have to establish them
for it? I'll look PythonWin once I get past the cmd operation.
It comes supplied with the ActiveState Python download (which also
includes the win32 extensions). I believe it can also be obtained as a
stand-alone with the win32 stuff.

The win32 extensions are:
http://sourceforge.net/project/platf...group_id=78018 (just
checked, PythonWin is included)
I worked my way into the folder where the py program is, but couldn't
executed. Just entering aprog.py, run aprog.py or exec aprog.py didn't work.

--
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.speckledwi thstars.net/>

Oct 12 '08 #3
Dennis Lee Bieber wrote:
On Sun, 12 Oct 2008 15:07:57 -0700, "W. eWatson"
<no*******@sbcg lobal.netdeclai med the following in comp.lang.pytho n:

>I worked my way into the folder where the py program is, but couldn't
executed. Just entering aprog.py, run aprog.py or exec aprog.py didn't work.

Try:
python aprog.py

If that doesn't work, you'll need to check your environment variable
PATH to make sure the directory with the python interpreter is on it...
(I've added spaces and/or newlines after the ; to make for easier
reading)

Path=E:\Python2 4\; E:\GNAT\2008\bi n; C:\WINDOWS\syst em32; C:\WINDOWS;
C:\WINDOWS\Syst em32\Wbem; C:\Program Files\SciTE;
C:\Program Files\Java\jre1 .6.0_03\bin;
C:\Program Files\Java\jdk1 .6.0_03\bin;
C:\Program Files\Common Files\Adobe\AGL ; C:\Tcl\bin;
C:\Program Files\Common Files\Roxio Shared\9.0\DLLS hared\;
C:\Program Files\Common Files\Roxio Shared\DLLShare d\;
C:\PROGRA~1\MyS QL\MySQL Server 5.0\bin;
C:\Program Files\TortoiseS VN\bin; E:\GNAT\GtkAda\ bin; C:\MSSQL7\BINN;
c:\PROGRA~1\sdb \programs\bin; c:\PROGRA~1\sdb \programs\pgm; c:\Regina;
e:\Python24\Scr ipts

It IS possible to set an association so that *.py will invoke python
as the processor. Part of is the environment variable pathext...

PATHEXT=.COM;.E XE;.BAT;.pyw;.p y;.pyo;.pyc;.CM D;.VBS;.VBE;.JS ;.JSE;.WSF;.WSH ;.tcl

But I think something else was required... Ah

FTYPE Python.File="E: \Python24\pytho n.exe" "%1" %*

I entered at the H:\......\pytho n_dev\ prompt
FTYPE Python.File="C: \Python24\pytho n.exe" aprog.py
but nothing happened. Nothing at all in the console window other than it
still shows the folder path in the prompt. Well not quite. It just responded
with python.exe" aprog.py.

Is there some way to copy in and out of the console. A copy/paste seems to
get nowhere.

It's odd that I cannot widen the console window. It shows <---when I grab
a side.

Maybe I'll compile the code, as suggested by a poster above. I don't think
IDLE will do that, but I can probably find something that will.

Ah, I found py2exe and installed it. It shows up nowhere in my Start->All
Programs. It may be in the list under Python. I see a command line entry off
that men. I don't think it was there. Off for more exploring.
--
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.speckledwi thstars.net/>

Oct 13 '08 #4
Ah, a tiny break through. I got
C:\Python24\pyt hon myprogram.py aprog.py. I copied the program to this folder.

I don't seem to be able to copy the window, so I see pretty much what I had
before from a dialog that popped up, except it adds:
Fatal Pyton error: Pystring_InterI nPlace: strings only please! The rest is
about the run time error.
This (Pystring) seems quite relevant, but I have no idea what.
>

--
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.speckledwi thstars.net/>

Oct 13 '08 #5
Thanks for the help, but I'm bowing out of this graphics problem. This
should have been a snap, but has turned into a detour. I'll get back to the
python program I was considering for it, and just work without the scatter
plot. It's easily done. It would just look prettier in a plot.

The meat of the matter is the Fatal error msg I copied below. To me it
indicates a serious error. Maybe some developer can sort it out.

From above post.
+++++++++++++++ +++++++++++++++ ++++
Ah, a tiny break through. I got
C:\Python24\pyt hon myprogram.py aprog.py. I copied the program to this folder.

I don't seem to be able to copy the window, so I see pretty much what I had
before from a dialog that popped up, except it adds:

Fatal Python error: Pystring_InterI nPlace: strings only please! <-Meat!

The rest is about the run time error [, and of zippo help].

This (Pystring) seems quite relevant, but I have no idea what.
+++++++++++++++ +++++++++++++++ +++++
--
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.speckledwi thstars.net/>

Oct 13 '08 #6
En Sun, 12 Oct 2008 23:45:15 -0300, W. eWatson <no*******@sbcg lobal.net>
escribió:
The meat of the matter is the Fatal error msg I copied below. To me it
indicates a serious error. Maybe some developer can sort it out.

From above post.
+++++++++++++++ +++++++++++++++ ++++
Ah, a tiny break through. I got
C:\Python24\pyt hon myprogram.py aprog.py. I copied the program to this
folder.

I don't seem to be able to copy the window, so I see pretty much what I
had before from a dialog that popped up, except it adds:

Fatal Python error: Pystring_InterI nPlace: strings only please! <-Meat!

The rest is about the run time error [, and of zippo help].

This (Pystring) seems quite relevant, but I have no idea what.
+++++++++++++++ +++++++++++++++ +++++
Python 2.4 is almost four years old now, and unmaintained. Chances are the
bug is already fixed. With 2.6 already released (and 3.0 soon to be) I
think it's highly improbable any developer will show interest in this - in
any case, almost noone will notice unless you file a bug at bugs.python.org

--
Gabriel Genellina

Oct 14 '08 #7
Gabriel Genellina wrote:
En Sun, 12 Oct 2008 23:45:15 -0300, W. eWatson <no*******@sbcg lobal.net>
escribió:
>The meat of the matter is the Fatal error msg I copied below. To me it
indicates a serious error. Maybe some developer can sort it out.

From above post.
++++++++++++++ +++++++++++++++ +++++
Ah, a tiny break through. I got
C:\Python24\py thon myprogram.py aprog.py. I copied the program to this
folder.

I don't seem to be able to copy the window, so I see pretty much what
I had before from a dialog that popped up, except it adds:

Fatal Python error: Pystring_InterI nPlace: strings only please! <-Meat!

The rest is about the run time error [, and of zippo help].

This (Pystring) seems quite relevant, but I have no idea what.
++++++++++++++ +++++++++++++++ ++++++

Python 2.4 is almost four years old now, and unmaintained. Chances are
the bug is already fixed. With 2.6 already released (and 3.0 soon to be)
I think it's highly improbable any developer will show interest in this
- in any case, almost noone will notice unless you file a bug at
bugs.python.org
Thanks. You're probably right. I'm sort of stuck with this (2.4.4). The
supplier of the s/w I am working on distributed it under 2.4. There are a
number of people who are using the program, and aren't python savvy. The
supplier has moved to 2.5. I'm trying to provide a program that will run for
them, and probably 2.5. I find it odd though that this simple program on
the matplotlab never got checked by someone. I suppose it's possible.

I'm giving this one more try (a new post shortly). If not, I'm dragging
everyone up to 2.5.

--
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.speckledwi thstars.net/>

Oct 15 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2684
by: jean.rossier | last post by:
Hello All, I am facing a problem while importing pylab library(in a .py program file) via web browser however the same program works when I execute it from the command prompt. my configuration : Fedora Core 3 Apache 2.0
3
4037
by: Dr. Colombes | last post by:
On my home laptop computer, I'm trying to install the appropriate modules so that Python version 2.3.3 and IDLE version 1.0.2 (with an "import matplotlib.matlab" statement) can produce nice MatLab-like plots. I have a matplotlib.matlab-capable Python set-up running OK on my office desktop, which I obtained after downloading and installing...
0
1110
by: ajikoe | last post by:
I found this error message when I import pylab. from pylab import * Error message: Microsoft Visual C++ Runtime Library Assertion failed! Program:c\python24\python.exe File:CXX/cxx_extentions.cxx Line:1031
2
7799
by: Charles Krug | last post by:
List: I'm trying to us pylab to see what I'm doing with some DSP algorithms, in case my posts about convolution and ffts weren't giving it away. I've been using pylab's plot function, but I'm finding it a bit cumbersome. It works, but if I switch from the interactive window to the plot window and back, the plot window gets trashed.
2
2710
by: timw.google | last post by:
Hi all. I installed matplotlib 0.87.3 under Python 2.4 on both Linux (FC3) and Windows XP Pro. On the linux install, I can import pylab, but when I try to do the same thing on the Windows installation, I get >>> from pylab import * Traceback (most recent call last): File "<pyshell#7>", line 1, in -toplevel-
14
6732
by: amitsoni.1984 | last post by:
hi, I have some values(say from -a to a) stored in a vector and I want to plot a histogram for those values. How can I get it done in python. I have installed and imported the Matplotlib package but on executing the code =hist(eig, 10) # make a histogram I am getting an error saying "NameError: name 'hist' is not defined". Is there any...
3
5694
by: Caren Balea | last post by:
Hello, I'm newbie to python. So far, I'm a bit disappointed. It's awful to set Python up to work. It's not working!!! Ok, calm down. Here are my settings: I'm using Windows XP machine and have installed Python 2.5.1.
1
2418
by: oyinbo55 | last post by:
I am trying to use the pylab plot command on my laptop running Ubuntu 6.06 (Dapper). Although the plot command works fine on my XP desktop at work, I cannot open the plot window on the laptop. I edited matplotlibrc to change interactive: to "True". In idle, I entered the commands: The terminal window closed abruptly when I typed the...
3
2799
by: Willem-Jan Vriend | last post by:
I want to use pylab (matplotlib) on a machine without X11. I'm trying to generate onthefly graphics for an apache2 web service, so they do not have to be displayed on this machine ! When i do pylab.figure() I get the error TclError: couldn't connect to display ":0.0" I tried setting the DISPLAY environment variable to "", ":0.0" but I...
0
7724
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7944
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8149
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7699
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3681
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1238
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
971
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.