Export to GitHub

cogen - issue #8

Unicode on Windows


Posted on Nov 26, 2008 by Helpful Horse

Here's a script:

from cogen.web import wsgi

def application(environ, start_response): start_response('200 OK', [('Content-type','text/plain')]) return u'fud'

try: wsgi.server_factory({}, '0.0.0.0', 8080)(application) except (KeyboardInterrupt, SystemExit): pass

Note the unicode string -- on Windows (running Python 2.5.2), am getting when I hit the server:

Traceback (most recent call last): File "cogen_wsgi", line 9, in <module> wsgi.server_factory({}, '0.0.0.0', 8080)(application) File "build\bdist.win32\egg\cogen\web\wsgi.py", line 793, in serve File "build\bdist.win32\egg\cogen\core\schedulers.py", line 230, in run File "build\bdist.win32\egg\cogen\core\schedulers.py", line 212, in iter_run File "build\bdist.win32\egg\cogen\core\proactors\iocp_impl.py", line 247, in run File "build\bdist.win32\egg\cogen\core\proactors\iocp_impl.py", line 175, in process_op File "build\bdist.win32\egg\cogen\core\proactors\iocp_impl.py", line 130, in request_generic File "build\bdist.win32\egg\cogen\core\proactors\base.py", line 196, in add_token AssertionError

This may be unrelated, but I'm also seeing the following when I start the script:

C:\Lib\Python25\lib\site-packages\cogen-0.2.0-py2.5.egg\cogen\core\proactors\iocp_impl.py:103: UserW arning: Unsupported option multiplex_first for <IOCPProactor [{}]> self._warn_bogus_options(**bogus_options) #iocp doesn't have any options

Comment #1

Posted on Nov 26, 2008 by Happy Dog

Fixed in trunk - will work for most cases, will probably fail with an encoding failure when passing unicode strings that have special chars. You should never pass unicodes, always encode them to something before.

Status: Fixed

Labels:
Type-Defect Priority-Medium