[Pythonmac-SIG] Problem (and workaround) with XCode and Python projects - non ascii characters in user's name

Henning Hraban Ramm fiee.visuelle at gmail.com
Tue Nov 27 23:16:55 CET 2007


Am 2007-11-27 um 13:50 schrieb Juan C. Méndez:

> When a new project is created, XCode takes the user name and pre- 
> fills the headers of the source files. In Python projects, this  
> creates a problem if the user's name has non ascii characters (like  
> accents). The problem is that the application builds and fails with  
> these messages like the ones below in the console. 11/18/07  
> 12:10:36 AM kkpycd[33468] *** Terminating app due to uncaught  
> exception 'NSInternalInconsistencyException', reason: '/Users/ 
> jcmendez/kkpycd/main.m:44 main() PyRun_SimpleFile failed with file  
> '/Users/jcmendez/kkpycd/build/Release/kkpycd.app/Contents/Resources/ 
> main.py'. See console for errors.' 11/18/07 12:10:36 AM kkpycd 
> [33468] Stack: ( 2490802795, 2487529627, 2490802251, 2490802314 )  
> Tracking the problem it's possible to see that: 11/18/07 12:11:11  
> AM [0x0-0xb40b4].com.yourcompany.kkpy2[95313] SyntaxError: Non- 
> ASCII character '\x8e' in file /Users/jcmendez/kkpy2/build/Release/ 
> kkpy2.app/Contents/Resources/kkpy2AppDelegate.py on line 5, but no  
> encoding declared; see http://www.python.org/peps/pep-0263.html for  
> details Not a big deal, but may deter many Python folks from  
> writing Cocoa apps. Already filed a bug report with Apple, but  
> thought it may be interesting to post in this list as well.

I guess the right coding line will help, e.g.
# -*- coding: utf-8 -*-

Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net
https://www.cacert.org (I'm an assurer)




More information about the Pythonmac-SIG mailing list