Hi,
I'm not sure. What kind of encoding error occurs? The exact error message might 
give a hint as to what's going on here.
The only message I had was in Console. The software I'm using with Popen (R) is complaining (in french) about encoding in my script.

My tests and googling leave me to the conclusion that it is an environment problem : in the working cases, locale.getpreferredencoding() give me fr_FR.UTF-8 but when double-clicking on the app it gives me us_US.ASCII.
In R, Sys.getlocale() give me :
"LC_CTYPE=fr_FR.UTF-8;LC_NUMERIC=C;LC_TIME=fr_FR.UTF-8;LC_COLLATE=fr_FR.UTF-8;LC_MONETARY=fr_FR.UTF-8;LC_MESSAGES=fr_FR.UTF-8;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=fr_FR.UTF-8;LC_IDENTIFICATION=C"
and just
"C" when double-clicking.
This happens with or without --emulate-shell-environment
So environment (locale) is not set when double-clicking on app. Also, setting locale in my R script resolves the problem, but it's not a solution in my case (a lot of R script to change). I am about to test setting locale in python (with the env option of Popen), but I need to reboot in OS X : )
Thanks for your help.
Regards
Pierre



Le 18/02/2013 13:28, Ronald Oussoren a écrit :
On 17 Feb, 2013, at 10:02, Pierre Ratinaud <ratin...@univ-tlse2.fr> wrote:

Hi all,
I have create a .app with py2app for a wxpython application. The resulting app does not 
work as expected if I double click on it (it works but somewhere in the process, an 
encoding problem appear from another program called with os.popen). This problem does not 
occur if I launch my app directly with python, it does not occur if I launch the app by 
double-clic on myapp inside the .app and it does not occur if I open the .app from a 
terminal with the "open" command.
This is happening with python 2.7.2, wxpython2.9, py2app 0.7.3 under Mac OS X 
10.6.8.
What am I missing ?
I'm not sure. What kind of encoding error occurs? The exact error message might 
give a hint as to what's going on here.

What's really strange is that double-clicking the app does not have the same 
behavior as calling the open command, I'd expect that those would be behave the 
same.

Do you have a shell environment variable in your shell's profile 
(.profile/.bash_profile/...) that is needed by the other program? Those definitions 
aren't seen by applications launched through the Finger because the Finder doesn't read 
the shell's profile.   You could try to use " python setup.py py2app 
--emulate-shell-environment" to build the app bundle, that activates a hack that 
does try to read the shell environment.

Ronald
thanks
Pierre

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


--
Pierre Ratinaud
Maître de conférences
Département des Sciences de l'Education et de la Formation
Laboratoire LERASS : http://www.lerass.com/
Université de Toulouse II - Le Mirail : http://www.univ-tlse2.fr/
tel : 05 61 50 42 28
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to