View Full Version : [SOLVED] Trying to run an older python script

January 12th, 2016, 04:49 AM
I am trying to run an older python script, which can be found here:


It begins with: import MV,struct,Numeric,string

First, I got the error message ImportError: No module named MV. I am told that the program can still be used without problems without MV, so I removed it. Numeric is no longer in use and has been replaced with numpy, so I installed the python-numpy package (and the python-scipy package for good measure) and replaced all instances of Numeric in the script with numpy.

Now I am getting the error:

Traceback (most recent call last):
File "MakeCouplerRestart.py", line 90, in <module>
oro = numpy.zeros((uwlat,uwlon),numpy.Float32)
AttributeError: 'module' object has no attribute 'Float32'

This seems to be the problematic part of the code:

oro = numpy.zeros((uwlat,uwlon),numpy.Float32)
ioro = oro.astype(numpy.Int) #Convert to integer
oioro = ioro.copy()

I am not good at python, so if anyone could point me towards where the error lies, I'd be very grateful. Thank you.

January 12th, 2016, 03:56 PM
try lowercasing the type name.

>>> import numpy
>>> numpy.Float32
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Float32'
>>> numpy.float32
<type 'numpy.float32'>