Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'cpython': 0.05; 'scripts': 0.09; 'python': 0.09; 'encode': 0.09; 'subject:script': 0.09; 'gui': 0.11; 'subject:not': 0.11; '(but': 0.15; 'ball.': 0.16; 'codec': 0.16; 'eclipse': 0.16; 'printing.': 0.16; 'subject:when': 0.16; 'wrote:': 0.17; 'fix': 0.17; 'projects,': 0.17; 'unicode': 0.17; 'windows': 0.19; 'trying': 0.21; 'errors': 0.23; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'errors.': 0.27; "doesn't": 0.28; 'this?': 0.28; 'fine': 0.28; 'run': 0.28; 'case,': 0.29; 'character': 0.29; 'probably': 0.29; 'usually': 0.30; 'error': 0.30; 'code': 0.31; 'running': 0.32; 'could': 0.32; 'print': 0.32; 'says': 0.33; 'handle': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'open': 0.35; 'received:192.168.0': 0.35; "won't": 0.35; 'skip:u 20': 0.36; 'but': 0.36; 'message-id:@gmail.com': 0.36; 'characters': 0.36; "didn't": 0.36; "i'll": 0.36; 'turn': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'supports': 0.38; 'some': 0.38; 'page': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'bottom': 0.60; 'skip:6 10': 0.63; 'within': 0.64; 'dont': 0.64; 'here': 0.65; 'special': 0.73; 'chinese': 0.78; '(standard': 0.84; 'subject:running': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=xUmbikXShObuSc12ictXZ615fHT3RnSG9rVokfRZyIo=; b=Y4dt718ueey2Im4AuBX8R2NmydxnUIFWdhrglC3KISrLxu1Ex6+Q8ry/IeA30O766k MUa3HVruer18AcgzR/NsWPESc4ATco37W65/XPEF9IyVR6/eqlzGD9pcvB9R5/3elZmg 6XYuZ9vkTKdgOWNb5k+MvTJMJncFRXrwO06hXpLoOyN+FVWtKV1h919lEVLo4tTVbz4s Hi9LTP8xPtG77EUtD3CIQgvFKyCV7mEhqMEhXtBD68UIi+1Y+rKghtjZFBs5X98+ny1d PpLpqt4wjCrNcLADXrWFetdoiqJTfrdY+QaTV3Fm7QrZf1i55IwHr9i5i+egKp8M3AEj LTfA== X-Received: by 10.42.133.133 with SMTP id h5mr22378925ict.45.1360666885729; Tue, 12 Feb 2013 03:01:25 -0800 (PST) Date: Tue, 12 Feb 2013 05:01:19 -0600 From: Andrew Berg User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: "comp.lang.python" Subject: Re: UnicodeEncodeError when not running script from IDE References: <650d144e-da3d-4ca7-ad3a-49f44ce9cbaa@googlegroups.com> In-Reply-To: <650d144e-da3d-4ca7-ad3a-49f44ce9cbaa@googlegroups.com> X-Enigmail-Version: 1.5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360666894 news.xs4all.nl 6843 [2001:888:2000:d::a6]:49625 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38741 On 2013.02.12 04:43, Magnus Pettersson wrote: > I am using Eclipse to write my python scripts and when i run them from inside eclipse they work fine without errors. > > But almost in every script that handle some form of special characters like swedish åäö and chinese characters etc i get Unicode errors when running the script externally with python.exe or pythonw.exe (but the scripts run completely fine from within Eclipse (standard pydev projects, python2.7). I have usually launched the script gui from wihin eclipse because of this error but now i want to get the bottom of this so i dont have to open eclipse everytime i want to run a script! > > Here is the error i get now when running the script with python.exe: > UnicodeEncodeError:'charmap' codec cant encode character u'\u898b' in position 32: character maps to > > what can i do to fix this? > Since you didn't say what code actually does this, I'll turn to my crystal ball. It says you are trying to print characters to a terminal that doesn't support them. If that is the case, you could try changing the code page (but only 3.3 supports cp65001, so that probably won't help) or use replacement characters when printing. -- CPython 3.3.0 | Windows NT 6.2.9200.16461 / FreeBSD 9.1-RELEASE