[Numpy-discussion] TypeError: 'module' object is not callable

josef.pktd at gmail.com josef.pktd at gmail.com
Mon Jan 11 21:55:29 EST 2010


On Mon, Jan 11, 2010 at 9:03 PM, Jankins <andyjian430074 at gmail.com> wrote:
> Here is the command line python:
>
>  >>> import scipy.sparse.linalg as linalg
>  >>>
>  >>> linalg.eigen()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: 'module' object is not callable
>  >>>

linalg.eigen.eigen   ?

Is your working directory inside scipy ?

I have no idea, since I'm not able not to get the function, and your
information is a bit minimal.

Josef

>
> It's really wired.
>
> Jankins
>
> On 1/11/2010 7:53 PM, josef.pktd at gmail.com wrote:
>> On Mon, Jan 11, 2010 at 7:16 PM, Jankins<andyjian430074 at gmail.com>  wrote:
>>
>>> I am sorry. My bad.
>>>
>>>    File "C:\test.py", line 7, in<module>
>>>      print linalg.eigen(M)
>>> TypeError: 'module' object is not callable
>>>
>>> I installed "pythonxy". "pythonxy" has already included the scipy package.
>>>
>>> On 1/11/2010 6:12 PM, Robert Kern wrote:
>>>
>>>> On Mon, Jan 11, 2010 at 18:03, Jankins<andyjian430074 at gmail.com>    wrote:
>>>>
>>>>
>>>>> It is very simple code:
>>>>>
>>>>> import networkx as nx
>>>>> import scipy.sparse.linalg as linalg
>>>>>
>>>>> G = nx.Graph()
>>>>> G.add_star(range(9))
>>>>> M= nx.to_scipy_sparse_matrix(G)
>>>>> print linalg.eigen(M)
>>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>> Please post the complete traceback.
>>>>
>> eigen is both a function and a module. Normally the function shadows the module
>>
>>
>>> python
>>>
>> Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
>> win32
>> Type "help", "copyright", "credits" or "license" for more information.
>>
>>>>> import scipy.sparse.linalg.eigen
>>>>> scipy.sparse.linalg.eigen
>>>>>
>> <function eigen at 0x01541AB0>
>>
>> I'm not able to import the eigen module, so there is either something
>> different with python 2.6 or networkx is doing some magic ?
>>
>> Can you try without networkx, try linalg.eigen.eigen ?
>>
>> Does
>>
>>>>> scipy.sparse.linalg.eigen
>>>>>
>> show the module or the function?
>>
>> Josef
>>
>> PS: I don't like functions shadowing a module
>>
>>>>
>>>>
>>> _______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>
>>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



More information about the NumPy-Discussion mailing list