Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!goblin1!goblin.stu.neva.ru!hq-usenetpeers.eweka.nl!hq-usenetpeers.eweka.nl!bcyclone01.am1.xlned.com!bcyclone01.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:text': 0.05; 'attribute': 0.07; '2to3': 0.09; 'line:': 0.09; 'subject:string': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'cc:name:python list': 0.16; 'help?': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'error': 0.23; 'unicode': 0.24; 'cc:2**0': 0.24; 'updating': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'appreciated.': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; '"")': 0.31; 'convert': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'pm,': 0.38; 'guidance': 0.39; 'to:addr:gmail.com': 0.65; 'reads': 0.68; 'business,': 0.83; 'rick': 0.93 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:to :cc:content-type; bh=xVOpGWbuNZHUDXqW4HbktdnRmTHKbxUiyXXaJ9rWOeY=; b=M4le1AEPHxuW2YQb2DHjlrCYciy3rSJ0pq8Aj7k1/k4/4ppgRvOZ85UW0032ajFcBu zvLTRjZkfcEi3RkZwUx0mjI4YDo0ArNOpq5wCBy+mVz3oEiCaB1WGVsw44rBVwqxIWrB VPFfmsgvL0j/vgUjC4EbXOwDdXKeL2JXI4DoKn7b9meQVZhBSicSJ7jz/3pFrDAw5pG6 lPMDFYTphrY2avxQwoW7SQ/ef1lSiN4+6973lqgbp+YLdILiF4bxxR8MwKfmZ8DfGAmc 8gpIp0UZeOFzHKKvCiGFBPKQ28p9+2LUxGBDxKjPusuB1wMnBpS4dAFiNn3Mquz7rOh2 E8hQ== MIME-Version: 1.0 X-Received: by 10.152.28.134 with SMTP id b6mr7450166lah.12.1414535415355; Tue, 28 Oct 2014 15:30:15 -0700 (PDT) In-Reply-To: References: Date: Tue, 28 Oct 2014 15:30:15 -0700 Subject: Re: checking whether a string is text or binary From: Dan Stromberg To: Rick Dooling Content-Type: text/plain; charset=UTF-8 Cc: Python List X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1414535418 news.xs4all.nl 2892 [2001:888:2000:d::a6]:59804 X-Complaints-To: abuse@xs4all.nl X-Received-Body-CRC: 900284995 X-Received-Bytes: 3596 Xref: csiph.com comp.lang.python:79861 On Tue, Oct 28, 2014 at 3:21 PM, Rick Dooling wrote: > I tried to convert the code using 2to3 and it broke. > > The error I get when using Python 3 is on this line: > > _null_trans = string.maketrans("", "") > > and the error reads > > AttributeError: 'module' object has no attribute 'maketrans' > > Any help? I barely understand the whole unicode business, but any guidance in updating the code would be much appreciated. Top hit on "python3 maketrans" in Google: http://stackoverflow.com/questions/3031045/how-come-string-maketrans-does-not-work-in-python-3-1