Pylab Fails with Runtime Error on Win XP Under Python 2.4

W

W. eWatson

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/>
 
W

W. eWatson

Dennis said:
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.
 
W

W. eWatson

Dennis said:
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\Dennis Lee Bieber\My Documents\Python Progs"

E:\UserData\Dennis Lee Bieber\My Documents\Python Progs>dir
Volume in drive E is Data
Volume Serial Number is 2626-D991

Directory of E:\UserData\Dennis Lee Bieber\My Documents\Python 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\Dennis Lee Bieber\My Documents\Python 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\Dennis Lee Bieber\My Documents\Python Progs>cd c:\bin

E:\UserData\Dennis Lee Bieber\My Documents\Python Progs>dir
Volume in drive E is Data
Volume Serial Number is 2626-D991

Directory of E:\UserData\Dennis Lee Bieber\My Documents\Python Progs

<snipped>

E:\UserData\Dennis Lee Bieber\My Documents\Python 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/platformdownload.php?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.speckledwithstars.net/>
 
J

John Machin

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.

One wouldn't expect the "run" or the "exec" to work.

Try these in this order:
python aprog.py
\python24\python aprog.py
c:\python24\python aprog.py

and instead of "didn't work", tell us what message you get. Also
consider telling us where your Python 2.4 is installed, and what you
see when you execute the PATH command.
 
W

W. eWatson

John said:
One wouldn't expect the "run" or the "exec" to work.

Try these in this order:
python aprog.py
\python24\python aprog.py
c:\python24\python aprog.py

and instead of "didn't work", tell us what message you get. Also
consider telling us where your Python 2.4 is installed, and what you
see when you execute the PATH command.
The first one requires a compile program.
The second required a path, probably back to my c-drive
The third one is too ghastly to think about, unless I move aprog.py to the
python folder.

I think I'll compile it and try.

--
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/>
 
W

W. eWatson

Dennis said:
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:\Python24\; E:\GNAT\2008\bin; C:\WINDOWS\system32; C:\WINDOWS;
C:\WINDOWS\System32\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\DLLShared\;
C:\Program Files\Common Files\Roxio Shared\DLLShared\;
C:\PROGRA~1\MySQL\MySQL Server 5.0\bin;
C:\Program Files\TortoiseSVN\bin; E:\GNAT\GtkAda\bin; C:\MSSQL7\BINN;
c:\PROGRA~1\sdb\programs\bin; c:\PROGRA~1\sdb\programs\pgm; c:\Regina;
e:\Python24\Scripts

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;.EXE;.BAT;.pyw;.py;.pyo;.pyc;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.tcl

But I think something else was required... Ah

FTYPE Python.File="E:\Python24\python.exe" "%1" %*
I entered at the H:\......\python_dev\ prompt
FTYPE Python.File="C:\Python24\python.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.speckledwithstars.net/>
 
W

W. eWatson

Ah, a tiny break through. I got
C:\Python24\python 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_InterInPlace: 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.speckledwithstars.net/>
 
W

W. eWatson

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\python 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_InterInPlace: 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.speckledwithstars.net/>
 
G

Gabriel Genellina

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\python 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_InterInPlace: 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
 
W

W. eWatson

Gabriel said:
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\python 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_InterInPlace: 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.speckledwithstars.net/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top