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


Groups > comp.lang.python > #59666

Re: Beginner python 3 unicode question

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'interpreter': 0.05; 'interpreter.': 0.07; 'python3': 0.07; 'executed': 0.09; 'imported': 0.09; 'mode:': 0.09; 'subject:question': 0.10; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'script,': 0.16; 'subject:unicode': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'else,': 0.19; 'typing': 0.19; 'script.': 0.24; 'looks': 0.24; 'script': 0.25; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'skip:p 30': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'getting': 0.31; 'invoke': 0.31; 'probably': 0.32; 'running': 0.33; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'being': 0.38; 'easiest': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'called': 0.40; 'how': 0.40; "you're": 0.61; 'more': 0.64; 'difference.': 0.84; 'nagy': 0.84; '2013': 0.98
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 :content-type; bh=yMXsg0cfiT9ptfk6x3kmmRAtMERrpZmqFwr/ABeJFoY=; b=VwKkpttbyDiF+lGaZ71JcwlH2cFitE0lzhbdkMUit1CWOl8Z0vm14va9DRncurk2zS 5ydZNekcgWtt4PBkegCoERxeziYIU1Qz5WW1RFAqPK4u6Pk4OrcXHx/Ivj2u72u9PXzC 7z3cKCWm1daXNW6wst93rnHsb6c5Dd7icXQ6XQc8Fjgn+QZdSfMgpmhYH8I7xbYyu7k0 aNjzHM50icQ3TyGjh5ueNRHEufrygaI+0ypXThMiPpU4VrvVqQL8ZcT7ATiOLyy9jJwU zPfk9m1F53wGacdalbMdBtK5au854lJXzP9GJCxGnoNnPZrH0LWUQQFbfu5QsYkdbEjC 699w==
MIME-Version 1.0
X-Received by 10.68.225.9 with SMTP id rg9mr5912467pbc.122.1384642031562; Sat, 16 Nov 2013 14:47:11 -0800 (PST)
In-Reply-To <5287E163.1080800@shopzeus.com>
References <5287C3B2.30807@shopzeus.com> <5287E163.1080800@shopzeus.com>
Date Sun, 17 Nov 2013 09:47:11 +1100
Subject Re: Beginner python 3 unicode question
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.2744.1384642034.18130.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1384642034 news.xs4all.nl 15934 [2001:888:2000:d::a6]:50215
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:59666

Show key headers only | View raw


On Sun, Nov 17, 2013 at 8:19 AM, Laszlo Nagy <gandalf@shopzeus.com> wrote:
>         print("digest",digest,type(digest))
>
> This function was called inside a script, and gave me this:
>
> ('digest', '\xa0\x98\x8b\xff\x04\xf9V;\xbd\x1eIHzh\x10-\xc5!\x14\x1b', <type
> 'str'>)
>

This looks very much like you're running under Python 2. Take care of
which interpreter you're running; that might be because of your
shebang (as Luuk mentioned), or because of what you're typing to
invoke the script; either way, it makes a huge difference. The easiest
solution is probably to invoke the interpreter explicitly:

Interactive mode:
$ python3
Script mode:
$ python3 scriptname.py

But you seem to have something WAY more complex than a single script.
What's the setup? How is Python getting invoked? If your code is
getting imported by something else, no shebang will help you - you
need the other code to be being executed by the other interpreter.

ChrisA

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


Thread

Re: Beginner python 3 unicode question Chris Angelico <rosuav@gmail.com> - 2013-11-17 09:47 +1100

csiph-web