[Tutor] script conversion windows -> linux error

Walter Prins wprins at gmail.com
Fri Mar 25 19:54:49 CET 2011

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.

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.

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

Best wishes,


2) Consequently always adjust error messages, taking into account that the
real number of paramers passed to a method is always one more than the
"real" parameters.
3) Given that you're explicitly passing 3 parameters in the code, this means
that in reality 4 is passed, your 3 + the instance reference.
4) Since the error is that only 3 is expected (e.g. 2 + instance) this
implies that you're
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110325/9ab7cb6d/attachment.html>

More information about the Tutor mailing list