Opened 15 years ago

Closed 15 years ago

#184 closed defect (invalid)

asap - locale issues (on kaputar)

Reported by: vincent.mcintyre@… Owned by: Malte Marquarding
Priority: normal Milestone: ASAP 3.0
Component: General Version: 2.0
Severity: normal Keywords:
Cc:

Description

asap doesn't seem to deal gracefully with locales different to POSIX.

To reproduce:

% setenv LANG en_US.UTF-8
% locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
% asap
Loading ASAP...
---------------------------------------------------------------------------
Error                                     Traceback (most recent call last)

/usr/local/lib/python2.4/site-packages/IPython/ipmaker.pyc in force_import(modna
me, force_reload)
     61         reload(sys.modules[modname])
     62     else:
---> 63         __import__(modname)
     64         
     65 

/u/dua009/.asap/ipy_user_conf.py 
     61     ip.ex('execfile("%s")' % os.path.expanduser(fname))
     62 
---> 63 main()
     64 
     65 

/u/dua009/.asap/ipy_user_conf.py in main()
     46     o.xmode = 'Plain'
     47     o.readline_omit__names = 1
---> 48     import_all("asap")
     49     # asap banner
     50     execf("~/.asap/asapuserfuncs.py")

/u/dua009/.asap/ipy_user_conf.py in import_all(modules)
     55     """ Usage: import_all("os sys") """ 
     56     for m in modules.split():
---> 57         ip.ex("from %s import *" % m)
     58         
     59 def execf(fname):

/usr/local/lib/python2.4/site-packages/IPython/ipapi.pyc in ex(self, cmd)
    248     def ex(self,cmd):
    249         """ Execute a normal python statement in user namespace """
--> 250         exec cmd in self.user_ns
    251     
    252     def ev(self,expr):

/u/dua009/data/<string> 
----> 1 
      2 
      3 
      4 
      5 

/usr/local/lib/python2.4/site-packages/asap/__init__.py 
    396 if rcParams['useplotter']:
    397     try:
--> 398         from asapplotter import asapplotter
    399         gui = os.environ.has_key('DISPLAY') and rcParams['plotter.gui']
    400         if gui:


/usr/local/lib/python2.4/site-packages/asap/asapplotter.py 
      1 from asap import rcParams, print_log, print_log_dec
      2 from asap import selector, scantable
----> 3 import matplotlib.axes
      4 from matplotlib.font_manager import FontProperties
      5 from matplotlib.text import Text

/usr/local/lib/python2.4/site-packages/matplotlib/__init__.py 
    127 import sys, os, tempfile
    128 
--> 129 from rcsetup import defaultParams, validate_backend, validate_toolbar
    130 from rcsetup import validate_cairo_format
    131 

/usr/local/lib/python2.4/site-packages/matplotlib/rcsetup.py 
     17 import warnings
     18 from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
---> 19 from matplotlib.colors import is_color_like
     20 
     21 #interactive_bk = ['gtk', 'gtkagg', 'gtkcairo', 'fltkagg', 'qtagg', 'qt4
agg',

/usr/local/lib/python2.4/site-packages/matplotlib/colors.py 
     52 import numpy as np
     53 from numpy import ma
---> 54 import matplotlib.cbook as cbook
     55 
     56 parts = np.__version__.split('.')

/usr/local/lib/python2.4/site-packages/matplotlib/cbook.py 
     20 
     21 try:
---> 22     preferredencoding = locale.getpreferredencoding()
     23 except (ValueError, ImportError):
     24     preferredencoding = None

/usr/lib/python2.4/locale.pyc in getpreferredencoding(do_setlocale)
    415             if do_setlocale:
    416                 oldloc = setlocale(LC_CTYPE)
--> 417                 setlocale(LC_CTYPE, "")
    418                 result = nl_langinfo(CODESET)
    419                 setlocale(LC_CTYPE, oldloc)

/usr/lib/python2.4/locale.pyc in setlocale(category, locale)
    379         # convert to string
    380         locale = normalize(_build_localename(locale))
--> 381     return _setlocale(category, locale)
    382 
    383 def resetlocale(category=LC_ALL):

Error: unsupported locale setting
WARNING: Loading of ipy_user_conf failed.

Workaround:

% unsetenv LANG
% locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
Loading ASAP...
Welcome to ASAP v3.0.0 (2010-05-06) - the ATNF Spectral Analysis Package

Please report any bugs via:
http://svn.atnf.csiro.au/trac/asap/simpleticket

[IMPORTANT: ASAP is 0-based]
Type commands() to get a list of all available ASAP commands.

ASAP>

Change History (1)

comment:1 by Malte Marquarding, 15 years ago

Resolution: invalid
Status: newclosed

Hi Vince,

this is an OS or python 2.4 issue.

I don't get it under lenny

You need to run

sudo dpkg-reconfigure locales

and enable all or the wanted locales

I have raised this as

operations ticket 504

Note: See TracTickets for help on using tickets.