Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103055

Re: TypeError: not all arguments converted during string formatting

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: TypeError: not all arguments converted during string formatting
Date Thu, 18 Feb 2016 01:02:01 +1100
Lines 19
Message-ID <mailman.211.1455717723.22075.python-list@python.org> (permalink)
References <CACT3xuX36xwQUZ=KWoxVzyNzsmnt_UM3==j0zgDH5UNTGR7HxQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de oHUijZdGAppDHMnqUCU/Mw/qpxol1Yhtcbho1Ovv+nZg==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'predefined': 0.07; 'cc:addr:python-list': 0.09; 'optional': 0.09; 'rules.': 0.09; 'subject:string': 0.09; 'python': 0.10; 'subject:not': 0.11; 'thu,': 0.15; '2016': 0.16; 'dump,': 0.16; 'err': 0.16; 'err,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'happily': 0.16; 'instead:': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'tweak': 0.16; 'wrote:': 0.16; 'string': 0.17; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'arguments': 0.22; 'converted': 0.22; 'am,': 0.23; 'feb': 0.23; 'header:In- Reply-To:1': 0.24; 'linux': 0.26; 'error': 0.27; 'logging': 0.27; 'message-id:@mail.gmail.com': 0.27; '2.6': 0.27; 'accepts': 0.29; 'arguments,': 0.29; 'ret': 0.29; 'print': 0.30; 'code': 0.30; 'subject:all': 0.32; 'getting': 0.33; 'received:google.com': 0.35; 'replaced': 0.35; 'according': 0.36; 'serve': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'suggestion': 0.37; 'received:209': 0.38; 'format': 0.39; 'well.': 0.40; 'some': 0.40; 'chrisa': 0.84; 'to:none': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=WeYo9zsz81fw21I8a1vom60Sednq59t14HCvUNvX6gc=; b=PQFRxTS7qs4N3rzZIcGe3RUWEHcKIsxEJbs4S+l4t0VkLhzTTDBTIOZJzk738LFQqn LDdpeFK5a495W+T+CYFU4f7Yt0LzDTBIU0si/lxvwaHb3COlKjPpbFBxRwFCtnycwTXK A1oyMZV9qfEBuHuHi9vxrcaoUscvJkEc6tXGFnKgRHbxxOlSWAQZQ5YuKnr8pVixmirn rWn+AN/bAGUMp/BfjJFmUcPpvSs/GrAKiqmR3PknPGtsHOF1NCCINvtZ5lSg6ptAQi7T cUG1ARDYulVEaNRHEc0pytzgcH0v2QkZF4rSZfQ4grenMAjk6/z4c/dNYwKkjQudEzEJ TNOA==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc:content-type; bh=WeYo9zsz81fw21I8a1vom60Sednq59t14HCvUNvX6gc=; b=K3ijoPqvhCr8HJpZ4toRug1SuHXRDYd8QylzbuDC4nO5AH3zo9h8eJyA55hFsaFodi vm0rusjl6Q4EoXM3N9foUnlYi/kYPwRSZM2eVsZW9ecdmFsAvLFe5jREKd1PW2Cb5ljy 5BQuPitbrLPj14A7yvf+8/qRqiYlVBh6ABC8rIm9/Z/d75PFju0EYQ4Lq0NvwHOEC8px tw2Jw5KkWdWbeNNeZExXeHJ3aniV+ed7mHJbojx5lSSSTGVmz2J4O4iA1wP/KlRSopKl bNxCWS36T+yQYXObGrQSM2aUH6BO4az8c24bo6ohEu3IYCqLymO5J9aT5ylkkrciAo1o zNZQ==
X-Gm-Message-State AG10YOTxi2fXtYw4ull9Agb0LotB0FNr6BgpyxDoaw8XPFl0bKgMK+w6iVeL3m1uEc0ybbiBfeLYCc3F4iOyjA==
X-Received by 10.50.137.35 with SMTP id qf3mr3760236igb.92.1455717721691; Wed, 17 Feb 2016 06:02:01 -0800 (PST)
In-Reply-To <CACT3xuX36xwQUZ=KWoxVzyNzsmnt_UM3==j0zgDH5UNTGR7HxQ@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:103055

Show key headers only | View raw


On Thu, Feb 18, 2016 at 12:58 AM, Ganesh Pal <ganesh1pal@gmail.com> wrote:
> Iam on python 2.6 and Linux  ,  I had replaced print out, err ret with
>   logging.info(out, err ,ret)   in the below code . I am getting
>
> "TypeError: not all arguments converted during string formatting"
> error any quick suggestion
>

The print statement/function happily accepts multiple arguments, and
will join them according to a set of predefined rules. The logging
functions don't have those rules, so they take one message and some
optional parameters. Try this, instead:

logging.info("%r %r %r", out, err, ret)

and then tweak the format string according to requirements. For a
quick dump, this will serve you well.

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: TypeError: not all arguments converted during string formatting Chris Angelico <rosuav@gmail.com> - 2016-02-18 01:02 +1100

csiph-web