Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'differently': 0.07; 'python3': 0.07; '34,': 0.09; '__init__': 0.09; 'clean.': 0.09; 'subject:question': 0.10; 'python': 0.11; 'base64': 0.16; 'mailscanner,': 0.16; 'subject:unicode': 0.16; 'typeerror:': 0.16; 'subject:python': 0.16; 'fix': 0.17; 'command': 0.22; '>>>': 0.22; 'example': 0.22; 'import': 0.22; 'this?': 0.23; 'header:User- Agent:1': 0.23; 'source': 0.25; 'this:': 0.26; 'scanned': 0.29; 'behaving': 0.31; 'sep': 0.31; 'file': 0.32; 'linux': 0.33; '(most': 0.33; "can't": 0.35; 'convert': 0.35; 'but': 0.35; 'believed': 0.36; 'skip:" 50': 0.36; 'should': 0.36; 'to:addr :python-list': 0.38; 'recent': 0.39; 'skip:b 40': 0.39; 'to:addr:python.org': 0.39; 'dangerous': 0.60; 'viruses': 0.61; 'more': 0.64; '3.3.1': 0.84; '2013,': 0.91 Date: Sat, 16 Nov 2013 20:12:50 +0100 From: Laszlo Nagy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: python-list@python.org Subject: Beginner python 3 unicode question Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-shopzeus-MailScanner-Information: Please contact the ISP for more information X-shopzeus-MailScanner-ID: 18AB088973A0.AF079 X-shopzeus-MailScanner: Found to be clean X-shopzeus-MailScanner-From: gandalf@shopzeus.com X-Spam-Status: No 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: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1384629174 news.xs4all.nl 15881 [2001:888:2000:d::a6]:34591 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:59646 Example interactive: $ python3 Python 3.3.1 (default, Sep 25 2013, 19:29:01) [GCC 4.7.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import uuid >>> import base64 >>> base64.b32encode(uuid.uuid1().bytes)[:-6].lower() b'zsz653co6ii6hgjejqhw42ncgy' >>> But when I put the same thing into a source file I get this: Traceback (most recent call last): File "/home/gandalf/Python/Lib/shopzeus/yaaf/ui/widget.py", line 94, in __init__ self.eid = uniqueid() File "/home/gandalf/Python/Lib/shopzeus/yaaf/ui/__init__.py", line 34, in uniqueid base64.b32encode(uuid.uuid1().bytes)[:-6].lower() TypeError: Can't convert 'bytes' object to str implicitly Why it is behaving differently on the command line? What should I do to fix this? -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.