Submitted by : simon at: 2004-03-13T03:00:43+00:00 (13 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

My installation of ZWiki leads to a broken product with the following Import Traceback:

 Traceback (most recent call last):
  File "D:/apps/zope/lib/python/OFS/Application.py", line 541, in import_product
    product=__import__(pname, global_dict, global_dict, silly)
  File "D:/Apps/Zope/lib/python/Products/ZWiki/__init__.py", line 12, in ?
    import ZWikiPage, ZWikiWeb#, CMF, Parents, Regulations
  File "D:/Apps/Zope/lib/python/Products/ZWiki/ZWikiPage.py", line 45, in ?
    from Regexps import url, bracketedexpr, footnoteexpr, wikiname1, wikiname2, \
  File "D:/Apps/Zope/lib/python/Products/ZWiki/Regexps.py", line 68, in ?
    loc = locale.getdefaultlocale()
  File "Lib/locale.py", line 337, in getdefaultlocale
    return _parse_localename(localename)
  File "Lib/locale.py", line 271, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
 ValueError: unknown locale: nl_NL_EURO

My system is eCS (OS/2). What do I need to fill in for ZWIKI_LOCALE to work around this?

SimonMichael, 2002/12/09 21:17 GMT (via web):
This sounds like DebianBug:172148 , which includes a patch for your python's locale.py.

As you guessed, setting ZWIKI_LOCALE to something harmless should be another way to work around this. Does nl_NL work for you ?

2002/12/09 23:34 GMT (via web):
I looked up the patch and added the line: fullname = fullname.replace ("_euro", "", 1) to locale.py

After restart of Zope Zwiki was available!!!

Thanx for the help, Frank

2003/01/29 17:55 GMT (via web):
My traceback complained about the locale being "it_IT@euro", so the line I had to add at line 216 in locale.py was fullname = fullname.replace ("@euro", "", 1)

thanks, Walter

solved --FlorianKonnertz, 2003/02/19 10:30 GMT
I had the same prob, see http://openspirit.homelinux.net/noowiki/python/Locale


comments:

... -- 2003/06/26 06:39 GMT reply
I have zope 2.6.1 on Linux ... and all products don't have problems with locales (I use also plone 1.0.3) so, wouldnt it be better if zwiki contains a workaround instead of patching python???

property change --SimonMichael, 2003/06/27 09:58 GMT reply
Severity: serious => wishlist Status: closed => open

Still having problems for Catalan -- Wed, 18 Feb 2004 10:30:35 -0800 reply
My locale is even more weird: ca_ES@euro. I had to add the line for removing the @euro in locale.py, but also had to add

'ca_es': ca_ES.ISO8859-1, 'ca_es@euro': ca_ES.ISO8859-15,

to the definition of locale_alias. Now it seems to work.

split up, update --SimonMichael, Mon, 29 Mar 2004 15:46:50 -0800 reply
Zwiki no longer calls getdefaultlocale so I would guess this particular problem has gone away - if not, please post.

See also #769 LookupError: unknown encoding: eucJP prevents Zwiki product initialization which was on this page.

property change --SimonMichael, Mon, 29 Mar 2004 15:47:09 -0800 reply
Status: open => pending

also --SimonMichael, Mon, 29 Mar 2004 15:48:32 -0800 reply
Note, ZWIKI_LOCALE mentioned above no longer has any effect.

Still: ValueError?: unknown locale: de_DE@euro -- Tue, 30 Mar 2004 01:41:52 -0800 reply
I still have this error with ZWiki-0.29.0rc1.tgz :

  Traceback (most recent call last):
  File "/usr/local/Zope-2.6.2-src/lib/python/OFS/Application.py", line 522, in import_product
  File "/usr/zope/lib/python/Products/ZWiki/__init__.py", line 10, in ?
    import ZWikiPage, ZWikiWeb, Permissions, Defaults
  File "/usr/zope/lib/python/Products/ZWiki/ZWikiPage.py", line 63, in ?
    from Regexps import url, bracketedexpr, doublebracketedexpr, \
  File "/usr/zope/lib/python/Products/ZWiki/Regexps.py", line 69, in ?
    lang, encoding = locale.getlocale()
  File "/usr/local/lib/python2.1/locale.py", line 358, in getlocale
    return _parse_localename(localename)
  File "/usr/local/lib/python2.1/locale.py", line 272, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
  ValueError: unknown locale: de_DE@euro

Still: ValueError?: unknown locale: de_DE@euro --SimonMichael, Tue, 30 Mar 2004 05:05:06 -0800 reply
Hmm. So how do other products work, given this python bug (getlocale breaking on valid locale names). Do none of them call getlocale ?

property change --SimonMichael, Tue, 30 Mar 2004 05:05:22 -0800 reply
Severity: wishlist => serious Status: pending => open

Still: ValueError?: unknown locale: de_DE@euro --SimonMichael, Tue, 30 Mar 2004 05:14:02 -0800 reply
Data point: it looks as if upgrading to python 2.3 fixes at least the euro problem.

python bug links --SimonMichael, Tue, 30 Mar 2004 11:47:02 -0800 reply
They are still working on this area. See eg PythonBugs:locale (& change status to any), PythonBug:813449 , PythonBug:554676 , PyDoc:locale.html .

So at the moment the recommended fix is upgrade to python 2.3; if that doesn't work or you can't upgrade, you'll have to patch your python eg as in DebianBug:172148 .

property change --SimonMichael, Tue, 30 Mar 2004 11:54:43 -0800 reply
Title: IssueNo0392 "ValueError: unknown locale" prevents Zwiki product initialization => IssueNo0392 getlocale ValueError: unknown locale prevents Zwiki product initialization

Still: ValueError?: unknown locale: de_DE@euro --simon, Wed, 31 Mar 2004 12:58:57 -0800 reply

So how do other products work... do none of them call getlocale ?

Apparently not!

workaround --simon, Wed, 31 Mar 2004 14:40:16 -0800 reply
I have checked in a workaround for 0.29rc2. In this situation it should now log Warning: getlocale() ValueError, WikiNames will not use the system locale at startup and keep going.

0.29rc2 has a workaround, please test --simon, Wed, 31 Mar 2004 15:32:07 -0800 reply
Status: open => pending

property change --SimonMichael, Sat, 10 Apr 2004 12:18:27 -0700 reply
Status: pending => closed