The #python IRC channel says that yes, unicode in sys.path is okay and should be converted based on file system encoding. That was qualified by comment that 'it doesn't always work' as expected.
Given that you are using a virtualenv I would suspect that maybe something is broken with that. That or mod_wsgi is running against different Python installation than what it was built for. Can you provide the result of doing the following tests: http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Shared_Library http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Installation_In_Use Graham On 15 March 2011 15:40, Andreas Sommer <[email protected]> wrote: > On 15.03.2011 18:54, Graham Dumpleton wrote: >> On 15 March 2011 06:45, Andreas Sommer <[email protected]> >> wrote: >>> Hi, >>> >>> I'm getting the exception >>> >>> File >>> "/var/www/django-sites/351b488d-80bb-42f0-b1bb-927aa89a1d5c/wsgi_autogen.py", >>> line 9, in <module> >>> if os.path.exists(virtualenvDirectory + 'bin') >>> File "/usr/lib/python2.6/genericpath.py", line 18, in exists >>> st = os.stat(path) >>> LookupError: no codec search functions registered: can't find encoding >>> >>> in my WSGI script (autogenerated by my program Site Deploy): >>> >>> import os >>> import sys >>> >>> sys.path.insert(0, >>> u'/var/www/django-sites/351b488d-80bb-42f0-b1bb-927aa89a1d5c') >>> >>> virtualenvDirectory = >>> u'/var/www/django-sites/351b488d-80bb-42f0-b1bb-927aa89a1d5c/django_simple_todo_list/env/' >> And if you don't use unicode strings in sys.path? >> >> I have never heard of anyone doing that and didn't know you even could >> do it with Python 2.X. >> >> Graham > Sure, using byte strings instead works fine because then Python doesn't > have to decode Unicode to any filesystem encoding. But that is not a > solution for me... Unicode is the way to go. It's especially important > if you have special characters in some files and transfer them from one > filesystem to another. Try committing a file in GIT on Windows = > windows-1252, and then check it out on Linux = utf-8... GIT does not > support Unicode and thus f***s up filenames. > > Just out of interest: It seems that mod_wsgi is Python 3 compatible - > wouldn't you run into the described codecs problem with 3.x if you use > Unicode strings? > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
