Edgewall Software

Ticket #6953 (reopened defect)

Opened 9 months ago

Last modified 6 weeks ago

trac has locale problem

Reported by: alperkanat@… Owned by: jonas
Priority: normal Milestone: not applicable
Component: general Version: 0.10.4
Severity: critical Keywords: base64mIme
Cc:

Description (last modified by thatch) (diff)

There is a general problem for Turkish for the following conversion:

i->İ
ı->I

MOD_PYTHON ERROR

ProcessId:      7382
Interpreter:    'main_interpreter'

ServerName:     'trac.isikun.edu.tr'
DocumentRoot:   '/srv/www'

URI:            '/ifsaet/login'
Location:       '/'
Directory:      None
Filename:       '/srv/www/ifsaet'
PathInfo:       '/login'

Phase:          'PythonHandler'
Handler:        'trac.web.modpython_frontend'

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target
    result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target
    result = object(arg)

  File "/usr/lib/python2.5/site-packages/trac/web/modpython_frontend.py", line 87, in handler
    gateway.run(dispatch_request)

  File "/usr/lib/python2.5/site-packages/trac/web/wsgi.py", line 87, in run
    response = application(self.environ, self._start_response)

  File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 391, in dispatch_request
    env = _open_environment(env_path, run_once=run_once)

  File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 58, in _open_environment
    env_cache[env_path] = open_environment(env_path)

  File "/usr/lib/python2.5/site-packages/trac/env.py", line 462, in open_environment
    env = Environment(env_path)

  File "/usr/lib/python2.5/site-packages/trac/env.py", line 142, in __init__
    load_components(self)

  File "/usr/lib/python2.5/site-packages/trac/loader.py", line 140, in load_components
    __import__(module)

  File "/usr/lib/python2.5/site-packages/trac/ticket/web_ui.py", line 27, in <module>
    from trac.ticket.notification import TicketNotifyEmail

  File "/usr/lib/python2.5/site-packages/trac/ticket/notification.py", line 25, in <module>
    from trac.notification import NotifyEmail

  File "/usr/lib/python2.5/site-packages/trac/notification.py", line 17, in <module>
    import smtplib

  File "/usr/lib/python2.5/smtplib.py", line 49, in <module>
    from email.base64MIME import encode as encode_base64

  File "/usr/lib/python2.5/email/__init__.py", line 79, in __getattr__
    __import__(self.__name__)

ImportError: No module named base64mIme

Attachments

Change History

  Changed 9 months ago by thatch

  • description modified (diff)

I don't understand how this is Trac's problem. The way you describe it, it sounds like a filesystem charset issue. Or that you've edited the Trac source.

>>> from email.base64MIME import encode as encode_base64

Works fine for me... could you give more information please?

follow-up: ↓ 3   Changed 9 months ago by alperkanat@…

try writing

from email.base64mIme import encode as encode_base64

like in the error message, there's a problem with the conversion..

in reply to: ↑ 2   Changed 9 months ago by cboos

  • status changed from new to closed
  • resolution set to invalid

Verify you Python installation, it's likely that you have a file named /usr/lib/python2.5/email/base64mIme.py. Either rename it to the expected name (/usr/lib/python2.5/email/base64MIME.py) or use export PYTHONCASEOK=1.

At any rate, this is a local installation issue, at worst a Python issue, but not a problem related to Trac itself.

follow-up: ↓ 7   Changed 9 months ago by alperkanat@…

  • status changed from closed to reopened
  • resolution invalid deleted

-rw-r--r-- 1 root root 5802 Şub 23 23:21 /usr/lib/python2.5/email/base64mime.py

Where can I use export PYTHONCASEOK=1 ?

On systems using Turkish locale, there might be a problem like this... I'm using en_US.UTF-8 system wide.. I use tr_TR.UTF-8 in my home.. Importing it through Python interpreter doesn't raise any problems like that, so I think it's not a Python problem nor a problem related with my system..

[02:13] (tunix@kulupler conf)$ python Python 2.5.2 (r252:60911, Feb 23 2008, 21:20:32) [GCC 4.2.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.

from email.base64mime import encode as encode_base64 dir()

['builtins', 'doc', 'name', 'encode_base64']

  Changed 9 months ago by thatch

What do you get if you perform the line as Trac is trying to do (which should work right):

>>> from email.base64MIME import encode as encode_base64

  Changed 9 months ago by alperkanat@…

[12:55][root@kulupler ~]# python Python 2.5.2 (r252:60911, Feb 23 2008, 21:20:32) [GCC 4.2.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.

from email.base64MIME import encode as encode_base64

in reply to: ↑ 4   Changed 9 months ago by cboos

  • keywords base64mIme added
  • milestone set to not applicable

Replying to alperkanat@gmail.com:

-rw-r--r-- 1 root root 5802 Şub 23 23:21 /usr/lib/python2.5/email/base64mime.py

Ok, sorry I verified, that should be OK.

Where can I use export PYTHONCASEOK=1 ?

Forget it, my wrong assumption.

On systems using Turkish locale, there might be a problem like this... I'm using en_US.UTF-8 system wide.. I use tr_TR.UTF-8 in my home.. Importing it through Python interpreter doesn't raise any problems like that, so I think it's not a Python problem nor a problem related with my system..

Well, googling for similar weirdness gave me this: http://www.linuxforums.org/forum/linux-programming-scripting/110502-python-smtplib-module-error.html which is indeed another Turkish Python 2.5 user. The problem seems to be the call to 'base64MIME'.lower() in email/__init__.py, line 113. Any idea why that could sometimes return base64mIme?

But again, as demonstrated in the script you can find following the above link, this doesn't seem to be related to Trac itself. We can keep the ticket open for talking about the issue though, as it affects Trac.

follow-up: ↓ 9   Changed 9 months ago by alperkanat@…

Whenever I have to change things in httpd configuration files and therefore restart the server, I have to restart the whole server itself not just the apache server.. Because trac starts showing these error messages.. It's really annoying..

I know that Python can (generally) handle Turkish characters since I'm also a Python developer.. It's amazing that restarting the whole server works generally... But let's say after a few days or weeks, it suddenly stops working and starts printing those error messages... Seems pretty weird though..

By the way, I'm also using Arch Linux like the guy on the forum link.. I also have Python 2.5 and kernel 2.6.24.3..

in reply to: ↑ 8   Changed 6 weeks ago by anonymous

Replying to alperkanat@…:

Whenever I have to change things in httpd configuration files and therefore restart the server, I have to restart the whole server itself not just the apache server.. Because trac starts showing these error messages.. It's really annoying.. I know that Python can (generally) handle Turkish characters since I'm also a Python developer.. It's amazing that restarting the whole server works generally... But let's say after a few days or weeks, it suddenly stops working and starts printing those error messages... Seems pretty weird though.. By the way, I'm also using Arch Linux like the guy on the forum link.. I also have Python 2.5 and kernel 2.6.24.3..

Add/Change #6953 (trac has locale problem)

Author



Change Properties
<Author field>
Action
as reopened
as The resolution will be set. Next status will be 'closed'
to The owner will change from jonas. Next status will be 'new'
 
Note: See TracTickets for help on using tickets.