If you are having a problem getting unicode files uploaded to Apache and are getting os.path.exist exceptions in Django, you should take a look at this link:
It is not only for mod python; I had this problem with mod_wsgi.
One of my projects at work is maintaining a Japanese language ticketing system in Django. Recently, we added additional file uploading systems and everything working, I put it live.
Unfortunately: no one could upload files with Japanese characters in the name.
My first break came from copy/pasting the error code; it was the same as the one at this Stack Overflow. It was failing on some kind of python internal operation. However, this solution did not work for me (setting the language variable) as the language variable was already us.utf-8. Furthermore, I wasn’t going to hack around in the django internals without reason.
I realized that there was probably something going on in Apache and was busy trying to find out how to switch to the Apache user in Ubuntu when the next clue came up: a Japanese message board conversation.
The important conversation is reproduced below:
ï¼š909[sage]ï¼š2010/10/14(æœ¨) 04:18:32 ID:???
(I solved it)
åŽŸå› ã¯apache2ctl gracefulã˜ã‚ƒãªã/etc/init.d/apache2 restartã¨ã—ãªã„ã¨envvarsã‚’å¤‰æ›´ã—ã¦ã‚‚æ„å‘³ãŒãªã„ã®ã‚’çŸ¥ã‚‰ãªã„äº‹ã§ã—ãŸã€‚
(I had to reboot directly using /etc/init.d as opposed to using apache2ctl in order to reset envars.)
(Enclosed is the information I found on the web)
ã‚ã¨ã€é–“é•ã£ãŸæƒ…å ±ã ã¨æ€ã†ã‚“ã§ã™ãŒ
3. sitecustomize.pyã‚’ç”¨æ„ã€ã‚‚ã—ãã¯site.pyã‚’ç›´æŽ¥æ›¸ãæ›ãˆã¦ã€sys.getdefaultencoding() => ‘utf-8′ãŒå¾—ã‚‰ã‚Œã‚‹æ§˜ã«ã™ã‚‹ã€‚
3ã«é–¢ã—ã¦ã¯ã€sys.getdefaultencoding() => ‘ascii’ã®ã¾ã¾ã§ã‚‚åƒ•ã¯å¤§ä¸ˆå¤«ã§ã—ãŸã€‚
The first line solved my problem. If you need a translation of the rest, let me know and I’ll be happy to do it.