[Tutor] How does one construct a module for import?

Emile van Sebille emile at fenx.com
Mon Jun 2 15:58:43 CEST 2014


On 6/2/2014 5:21 AM, Sydney Shall wrote:
> I am having a similar problem.

<next time just start a new thread>

> However, when I use the import statement in my program I get a runtime
> error as follows:
>
> <ipython-input-14-abb1b897e8b9> in <module>()
> ----> 1 CapitalSimulation(51, 4000.0, 20.0, 20.0, 100, 1.0, 0.0, 40.0, 1.0)
>
> /Users/sydney/My_Documents/Political_Economy/Capital_Simulation/Capital/Current
> version/CapitalWithProdV14.py in CapitalSimulation(number_of_cycles,
> capital_advanced, unit_constant_capital, wagerate, labour_powers,
> productivity, prodinc, work_duration, labour_intensity)
>      525                         lnsurplusvalue, lnvariablecapital,
> lnconstantcapital,
>      526                         lnlabourpowers, lnnewvaluecreated,
> rationvtoac,
> --> 527                         rationvtorc)

this is the end of something (as per the closing paren) The error 
message would indicate that the name on the start of this something is a 
module name.  so you've likely done something like:

import xyz
xyz(a,b,c,d,e...,rationvtorc)

when you should be doing something like:

import xyz
xyz.callable(a,b,c,d,e...,rationvtorc)

HTH,

Emile




>      528
>      529     plotDataV2(cycles, AdvancedCapital, lnAdvancedCapital,
> RealisedCapital,
>
> TypeError: 'module' object is not callable
>
> I do not really understand what Steven is recommending below.
> Is it an init statement in a file or is it an independent file.
>
> Thanks to you all.
>
> Sydney
>



More information about the Tutor mailing list