On Fri, 8 Dec 2000, Glen Malley wrote:

> 
> Hi, I'm new to the list so bear with me.
> I read through the archives looking for a solution to my problem,
> consulted various gurus, etc, but cannot find anything.
> 
> When using PyGtk, if I set my LANG environ variable to a Japanese
> one prior to running my application, I can use Japanese input methods
> as per usual in Gtk apps.
> However, if I set the LANG environ variable to the same value within
> the code itself, the input methods are not enabled.
> 
> This problem of environment variables "not really" being changed
> has occurred in Python before...namely when using the Sybase DB
> drivers and setting the SYBASE environment variable. The variable
> was not *really* changed, and the Sybase drivers segfaulted.
> I realize this must be some kind of problem in Python's os.environ
> implementation....but I was wondering if anyone had any comments on
> how to solve this issue in PyGtk?
> 
> Frankly, changing my environment variables and then running my code
> in a child process (which inherents the environment from the code fine)
> doesn't seem like a very elegant way of doing things.
> 
> For the record, I'm using LANG and LOCALE both set to "ja_JP.ujis".
> This works with the Gtk apps I've tried it on, as well as my own
> code when it is set prior to calling the interpreter.
> If anyone has any suggestions or comments, I'd appreciate it.

You could try using the locale.setlocale() function.  Eg:
  import locale
  locale.setlocale(locale.LC_MESSAGES, 'ja_JP.ujis')

(or maybe LC_ALL).  If you set the locale to '', it will look up the
environment.

James.


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to