Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed1.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'error:': 0.07; "subject:' ": 0.07; '(unicode': 0.09; 'escape': 0.09; 'subject:position': 0.09; 'truncated': 0.09; 'cc:addr :python-list': 0.11; '5:00': 0.16; 'backslash': 0.16; 'codec': 0.16; 'contexts,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject: \n ': 0.16; 'subject:skip:u 10': 0.16; 'subject:unicode': 0.16; 'syntaxerror:': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'bytes': 0.24; 'cc:2**0': 0.24; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; 'file': 0.32; 'stuff': 0.32; 'maybe': 0.34; 'problem': 0.35; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'subject:can': 0.39; 'even': 0.60; 'save': 0.62; "you'll": 0.62; 'show': 0.63; 'forward': 0.65; 'special': 0.74; 'yourself': 0.78; '2015': 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=tOLWck7GFMqIJbq6K8Pkd9+Pgd94IhU5QXi8VQeC5Zo=; b=GhaT6eYvBfV9+yM6hnIrc8Lj8Pjmrsc/7A6VTcfxuFOL+aqsw8y/IsamGQHgdnFoJv iNto3YbcrdaAsBA+OKsq0UVamIt1/qoF2ZmM4tVX4WEoNRD4WnOCHZZf8u543km+r4z+ A1b0nmZEtZHWEGFmRN8Ldb6Ml/+dx2TWy4RlnjVJxK3JndTkIiKDMxx5LjuPV/jz4tWT 9tIJHII9Li+Fv3jk9V0ltrga+Q8+d5D59UoeSKKOoBhUzMT6FAU+YdsHQOAkgBXlrhgC uHi69KT7cr6TssU3lfj/efpLY/PSYMfxsWmXNaCoQZo/xVKiQdSvr/k4cKcK+y3e8NJH URVw== MIME-Version: 1.0 X-Received: by 10.107.134.206 with SMTP id q75mr358887ioi.27.1431125689515; Fri, 08 May 2015 15:54:49 -0700 (PDT) In-Reply-To: References: Date: Sat, 9 May 2015 08:54:49 +1000 Subject: Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1431125692 news.xs4all.nl 2908 [2001:888:2000:d::a6]:45138 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:90199 On Sat, May 9, 2015 at 5:00 AM, wrote: > But it returns the following error: > > > C:\Python34\python.exe C:/Users/bckslash_test.py > File "C:/Users/bckslash_test.py", line 4 > ROOTDIR = 'C:\Users' > ^ > SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape Strong suggestion: Use forward slashes for everything other than what you show to a human - and maybe even then (some programs have always printed stuff out that way - zip/unzip, for instance). The backslash has special meaning in many contexts, and you'll just save yourself so much trouble... ROOTDIR = 'C:/Users/zoran' Problem solved! ChrisA