Hi,
I'm trying to figure out how to use the uWSGI spooler along Bottle and the 
uwsgidecorators.py module on Python 3 and I'm hitting a wall with regards to 
the need for using bytes.
I'm using the examples in the uWSGI API - Python decorators docs (section 
Example: a Django session cleaner and video encoder):

from task import encode_video

def index(request):
    # launching video encoding
    encode_video.spool(filename=request.POST['video_filename'])
    return render_to_response('enqueued.html')

The main spooler document states that "spool arguments must be bytes for 
Python3". How would the 
encode_video.spool(filename=request.POST['video_filename']) line therefore be 
adapted for Python 3?

I ask because I've been trying things similar to the example but I always get 
this exception:
Traceback (most recent call last):
  File "./bottle.py", line 861, in _handle
    return route.call(**args)
  File "./bottle.py", line 1737, in wrapper
    rv = callback(*a, **ka)
  File "./test.py", line 11, in test
    testspool.spool({b'videoname':name.encode()})
  File "./uwsgidecorators.py", line 87, in spool
    return self.__class__.__call__(self, *args, **kwargs)
  File "./uwsgidecorators.py", line 105, in __call__
    return _spoolraw.__call__(self, *args, **kwargs)
  File "./uwsgidecorators.py", line 83, in __call__
    return uwsgi.spool(arguments)
ValueError: spooler callable dictionary must contains only bytes

Yet, I thought I was feeding it bytes in the dictionary with my 
testspool.spool({b'videoname':name.encode()})

Where am I going wrong?
Thanks,
-Martin
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to