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


Groups > comp.lang.python > #75779

Re: TypeError: 'bytes' object is not callable error while trying to converting to bytes.

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'subject:not': 0.03; "subject:' ": 0.07; 'subject:trying': 0.09; 'subject:while': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; "wouldn't": 0.14; "'data'": 0.16; 'file.read()': 0.16; 'fine.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'introduces': 0.16; 'python4': 0.16; 'rarely': 0.16; 'subject: \n ': 0.16; 'subject:object': 0.16; 'travis': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'code,': 0.22; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'bytes': 0.24; 'earlier': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'work.': 0.31; 'critical': 0.32; 'could': 0.34; 'received:google.com': 0.35; 'in.': 0.36; 'pm,': 0.38; 'that,': 0.38; 'how': 0.40; "you'll": 0.62; "you've": 0.63; 'name': 0.63; 'pick': 0.64; 'different': 0.65; 'introduce': 0.78; '2014,': 0.84; '3.6': 0.84; "it'd": 0.84; 'shadow': 0.84; 'to:none': 0.92
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=1pORK8mH8lBRDEFb8MTunfB2tZPLXb52TgKUWmx6i40=; b=OBFEJu6yj/YqTUhC3PLUVFUI+wF+KU9qC701fES0qPzBLS6WuSp021yAZDLnPrx/3K yr7riNbbbSqs0t2qGOA1MGuSNaQByPKoteM6reTHSMGr1n+Q4gzU/ztPLBy3YMaegO1K 5rHCDBIkLmXgt0HYuUYvlTQTHJdphraeIh0N4Vv7Vta69BH+D+vuIbDhxObflQuvLV7W 4HtYjNDC+KqR1mX067cPPB/oPMOk9GwfbU2Bch5GCLubVyzUR8PANb2SAU3IjE6ZRU0I /2xFyUUOXtYQttt2pzpywMhK6PDX+WBKBjeUBbcpJcypZYHCProVkFPnhfHT6hpWNxH5 EZSQ==
MIME-Version 1.0
X-Received by 10.42.216.148 with SMTP id hi20mr11446902icb.12.1407303430208; Tue, 05 Aug 2014 22:37:10 -0700 (PDT)
In-Reply-To <77C4289C-FBCD-449F-8460-B33029A4A236@gmail.com>
References <02baad14-39b1-41a0-a47d-28772c97ea54@googlegroups.com> <CAPTjJmqZdHdx7VJf7HMEUKe8J7uCH2HuKN1PO2i4azHygFGuDA@mail.gmail.com> <77C4289C-FBCD-449F-8460-B33029A4A236@gmail.com>
Date Wed, 6 Aug 2014 15:37:10 +1000
Subject Re: TypeError: 'bytes' object is not callable error while trying to converting to bytes.
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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>
Newsgroups comp.lang.python
Message-ID <mailman.12687.1407303433.18130.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1407303433 news.xs4all.nl 2879 [2001:888:2000:d::a6]:47762
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:75779

Show key headers only | View raw


On Wed, Aug 6, 2014 at 3:31 PM, Travis Griggs <travisgriggs@gmail.com> wrote:
>> On Aug 4, 2014, at 22:57, Chris Angelico <rosuav@gmail.com> wrote:
>>
>> On Tue, Aug 5, 2014 at 3:47 PM, Satish ML <satishmlwizpro@gmail.com> wrote:
>>>>>> bytes = file.read()
>>
>> You've just shadowed the built-in type 'bytes' with your own 'bytes'.
>> Pick a different name for this, and you'll be fine. 'data' would work.
>
> Until python4 introduces the 'data' built in. :)

Python 3.6 could introduce that, no need to wait for Python 4. :)
However, it wouldn't be critical to this code, unless the builtin's
meaning is also wanted; it'd be on par with the shadowing of 'file'
earlier - given how rarely Python programs actually need 'file'
(rather than 'open'), it's not a big deal to shadow that one.

ChrisA

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


Thread

TypeError: 'bytes' object is not callable error while trying to converting to bytes. Satish ML <satishmlwizpro@gmail.com> - 2014-08-04 22:47 -0700
  Re: TypeError: 'bytes' object is not callable error while trying to converting to bytes. Ben Finney <ben+python@benfinney.id.au> - 2014-08-05 15:57 +1000
  Re: TypeError: 'bytes' object is not callable error while trying to converting to bytes. Chris Angelico <rosuav@gmail.com> - 2014-08-05 15:57 +1000
  Re: TypeError: 'bytes' object is not callable error while trying to converting to bytes. Travis Griggs <travisgriggs@gmail.com> - 2014-08-05 22:31 -0700
  Re: TypeError: 'bytes' object is not callable error while trying to converting to bytes. Chris Angelico <rosuav@gmail.com> - 2014-08-06 15:37 +1000

csiph-web