Importing pylab causes exception - any ideas?

Hi,

Sorry to repost but I'm tearing my hair out with this one....

I'm using the Python(x,y) distribution which comes with matplotlib for
Windows. My OS is Windows XP with all updates and service packs on an
AMD Athlon 2600+ PC with ATI Radeon 9600 graiphics card.

Python will work fine for anything that doesn't import the pylab
component (I can import matplotlib itself no problem as well as numpy
etc) but if I try to import pylab I get:-

"An unhandled exception occured in pythonw.exe [3976]"

I've tied reinstalling Python(x,y) and even reinstalling windows then
Python(x,y) but to no avail. This seems odd to me as 2 other PCs at work
install Python(x,y) and run Pylab fine.

Any suggestions as to what I should check to track down this error?

Thanks

Jon

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4904 (20100301) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Bringing this to the list and not to Jon alone ...

2010/3/1 Jon Moore <jonr_moore@...225...>:

I'm using the Python(x,y) distribution which comes with matplotlib for
Windows. My OS is Windows XP with all updates and service packs on an
AMD Athlon 2600+ PC with ATI Radeon 9600 graiphics card.

Python will work fine for anything that doesn't import the pylab
component (I can import matplotlib itself no problem as well as numpy
etc) but if I try to import pylab I get:-

"An unhandled exception occured in pythonw.exe [3976]"

Hmm, I'm wondering why no one in answering your post. May you please
do the following:

I assume that you aren't so much familiar with Python etc., because
you didn't do the following steps on your own. If this is wrong,
please feel not offended.

Please try:

import matplotlib.mpl
import matplotlib.dates
import matplotlib.mlab
import matplotlib.pyplot

This should be the essential imports done by import matplotlib.pylab

Can you also do the following:

import __builtin__
old_import = __import__
def new_import(name, *args, **kwargs):
   print name
   return old_import(name, *args, **kwargs)

__builtin__.__import__ = new_import

and then type:

import matplotlib.pylab

Or do the monkeypatch after import matplotlib, if that makes no
trouble at all. It will print all the import attempts before
executing them.

I'm curious at what import it fails ...

I also wonder why it's pythonw.exe. It means that you have no output
on console. In this case:

import sys
outfile = open('log.txt', 'w')
sys.stdout = outfile
sys.stderr = outfile

This will log the hidden output in "log.txt".

Friedrich