[Tutor] script conversion windows -> linux error

Rance Hall ranceh at gmail.com
Fri Mar 25 21:17:19 CET 2011


On Fri, Mar 25, 2011 at 1:54 PM, Walter Prins <wprins at gmail.com> wrote:
>
>
> On 25 March 2011 18:26, Rance Hall <ranceh at gmail.com> wrote:
>>
>> config_version =  config.get('versions','configver',0)
>>
>> This line fails under 3.2 Linux with the error message:
>>
>> TypeError:  get() takes exactly 3 positional arguments (4 given)
>>
>> What could the 4th argument be?  I only see three.
>>
>> This same code worked on python 3.1 under windows.
>>
>> What am I missing?
>
> OK, off the top of my head and not having checked anything, here's me
> thinking out loud:
>
> Recall that all methods get one extra parameter, namely the instance
> reference of the object that the method applies to/is being called on.
>

Thanks for this, I could not have recalled this, because I don't think
I knew it prior to you mentioning it.

> Regardless, the message is telling you that you're passing one more
> parameter than expected.  This makes me think that the version of config
> module that you're using is older than the one you used on Windows, and that
> perhaps this older version had one less parameter, which is why it's
> complaining about too many parameters.
>

The version of config on the linux box should be NEWER than the one I
used in windows.  Recall in my OP that Windows was python 3.1 and
Linux is now 3.2

> As I say, that's just educated guesswork/inference, I've not checked whether
> the above hypothesis holds water under examination...

Likely explanation.  But I don't think it holds water when compared
against the configparser documentation.

Interactive help documentation seems to suggest that my syntax is ok.
But the compiler clearly doesnt like it.

Rance


PS, I just took the original zero third argument out, and now it works.

I think that confirms your theory.


More information about the Tutor mailing list