[SciPy-user] getting values from traits objects

gross olof.gross@student.gu...
Wed Nov 26 11:07:14 CST 2008

I'm obviously missing something very basic, can someone please explain to me
what i've done wrong in this example: 

from enthought.traits.api import HasTraits, Float, Int
from scipy import linspace

class InputData(HasTraits):
  x=linspace(xmin, xmax, xres)

if __name__ == "__main__":
  window = InputData()

Executing this file results in: 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "t2.py", line 4, in <module>
    class InputData(HasTraits):
  File "t2.py", line 8, in InputData
    x=linspace(xmin, xmax, xres)
  File "/usr/lib/python2.5/site-packages/numpy/lib/function_base.py", line
74, in linspace
    num = int(num)
TypeError: int() argument must be a string or a number, not 'Int'

Printing the value of xres after execution returns the (by me) expected
value of 128 as an int, but it seems it doesen't work in the same way when
the script runs? Believe me, i've studied examples and searched for hours,
but it can be really difficult to find straight answers to such general
questions as this one...
View this message in context: http://www.nabble.com/getting-values-from-traits-objects-tp20623191p20623191.html
Sent from the Scipy-User mailing list archive at Nabble.com.

More information about the SciPy-user mailing list