Re: [Numpy-discussion] view takes no keyword arguments exception

2009-05-20 Thread Stéfan van der Walt
Hi Jochen

2009/5/20 Jochen Schroeder cycoma...@gmail.com:
 I'm trying to help someone out with some problems with pyfftw
 (pyfftw.berlios.de). He is seeing an exception,

 TypeError: view() takes no keyword arguments

 This doesn't only happen when he uses pyfftw but also when he does the
 following:

 import numpy as np
 a=np.arange(10)
 print a.view(dtype='float')
 Traceback (most recent call last):
  File stdin, line 1, in module
 TypeError: view() takes no keyword arguments

 I he's on Windows and sees this error both with numpy 1.1.1 and 1.3.
 I'm a bit lost anybody have an idea what could be the problem?

In the older versions of numpy, a.view(float) should work (float is
preferable above 'float' as well), but I would guess that you are
really looking for

a.astype(float)

Regards
Stéfan
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] view takes no keyword arguments exception

2009-05-20 Thread Jochen Schroeder
On 21/05/09 00:20, Stéfan van der Walt wrote:
 Hi Jochen
 
 2009/5/20 Jochen Schroeder cycoma...@gmail.com:
  I'm trying to help someone out with some problems with pyfftw
  (pyfftw.berlios.de). He is seeing an exception,
 
  TypeError: view() takes no keyword arguments
 
  This doesn't only happen when he uses pyfftw but also when he does the
  following:
 
  import numpy as np
  a=np.arange(10)
  print a.view(dtype='float')
  Traceback (most recent call last):
   File stdin, line 1, in module
  TypeError: view() takes no keyword arguments
 
  I he's on Windows and sees this error both with numpy 1.1.1 and 1.3.
  I'm a bit lost anybody have an idea what could be the problem?
 
 In the older versions of numpy, a.view(float) should work (float is
 preferable above 'float' as well), but I would guess that you are
 really looking for
 
 a.astype(float)

Sorry maybe I phrased my question wrongly.  I don't want to change the code 
(This was just a short example).
I just want to know why it is failing on his system and what he
can do so that a.view(dtype='...') is working. I suspected it was an old
numpy installation but the person is saying that he installed a new
version and is still seeing the same problem (or does he just have an
old version of numpy floating around). 

Cheers
Jochen

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] view takes no keyword arguments exception

2009-05-20 Thread Pierre GM

On May 20, 2009, at 9:57 PM, Jochen Schroeder wrote:
 Sorry maybe I phrased my question wrongly.  I don't want to change  
 the code (This was just a short example).
 I just want to know why it is failing on his system and what he
 can do so that a.view(dtype='...') is working. I suspected it was an  
 old
 numpy installation but the person is saying that he installed a new
 version and is still seeing the same problem (or does he just have an
 old version of numpy floating around).

Likely to be the second possibiity, the ghost of a previous  
installation. AFAIR, the keywords in .view were introduced in 1.2 or  
just after.
A safe way to check would be to install numpy 1.3 in a virtualenv and  
check that it works. If it does (expected), then you may want to ask  
your user to start afresh (remove 1.1.1 and 1.3 and then reinstall 1.3  
from a clean slate).
My 2c.
P.
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] view takes no keyword arguments exception

2009-05-20 Thread Charles R Harris
On Wed, May 20, 2009 at 3:51 PM, Jochen Schroeder cycoma...@gmail.comwrote:

 Hi all,

 I'm trying to help someone out with some problems with pyfftw
 (pyfftw.berlios.de). He is seeing an exception,

 TypeError: view() takes no keyword arguments

 This doesn't only happen when he uses pyfftw but also when he does the
 following:

  import numpy as np
  a=np.arange(10)
  print a.view(dtype='float')
 Traceback (most recent call last):
  File stdin, line 1, in module
 TypeError: view() takes no keyword arguments

 I he's on Windows and sees this error both with numpy 1.1.1 and 1.3.
 I'm a bit lost anybody have an idea what could be the problem?


I don't see this error on linux:

In [3]: a.view(dtype=double)
Out[3]: array([ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.])

What version of python do you have installed? Did try deleting the previous
version of numpy from site-packages before install? Windows 32 or 64 bit?
Etc.

Chuck
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion