Karen Tracey wrote: > On Feb 2, 2008 8:14 PM, Michael Hipp <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > > My code runs fine on the development server, but dies on a local copy of > apache with mod_python. > > It's giving me this error: > unknown encoding: cp0 > > On this line: > print 'report: %s' % report_name > > Google found several references to making everything unicode (see > below), so I tried this: > print u'report: %s' % unicode(report_name) > > But it still fails the same. > > I'm running the latest from SVN on W2k with Apache 2.2.8, mod_python > 3.3.1 and Python 2.5.1. > > Any ideas? > > Thanks, > Michael > > http://code.djangoproject.com/ticket/5584 > > http://code.djangoproject.com/wiki/UnicodeBranch#PortingApplicationsTheQuickChecklist > > > This thread: > > http://groups.google.com/group/django-users/browse_thread/thread/f995ff5ddae2cd51 > > reports the same error message on a print statement and the fix in that > case was to wrap the variable in str(), not unicode(), though it doesn't > seem the problem/fix was well understood there. I'm guessing (which I > probably shouldn't do at 1AM) but I think the problem is Windows is > returning something to Python that makes Python think unicode strings > must be converted to "cp0" in order to be displayed on the console, but > Python has no idea what "cp0" is, so generates an error. If you wrap > the variable in str() before you print it then you sidestep the issue of > what codepage needs to be used for console printing of unicode strings. > I think, maybe. Anyway, it's worth a try.
Thanks. That works. print 'report: %s' % str(report_name) It's evidently an Apache-Windows thing. I don't see the problem either on the Windows development server or an Apache server on RHEL. Michael --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---