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


Groups > comp.lang.python > #59666

Re: Beginner python 3 unicode question

References <5287C3B2.30807@shopzeus.com> <5287E163.1080800@shopzeus.com>
Date 2013-11-17 09:47 +1100
Subject Re: Beginner python 3 unicode question
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2744.1384642034.18130.python-list@python.org> (permalink)

Show all headers | 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