Realised I might have knocked this question out of the public consciousness by 
replying to my own post with some additional info... Here it is collated into a 
single (more considered) post.


I have a situation where uWSGI is attempting to load the paste environment, and 
``uri`` in deploy's ``loadcontext`` is bytes whereas I believe it should be 
string, resulting in:

  TypeError: Type str doesn't support the buffer API

I have modified my Deploy to coerce ``uri`` to a string and uWSGI then launches 
successfully. This issue does not occur with Pyramid's waitress server reading 
the same .ini file (see trace).

Is this an issue with uWSGI sending the wrong type, or should Paste Deploy be 
more tolerant of bytes/strings in this case?

Best, S







Full trace (with type of ``uri`` printed under the DEBUG heading):

[simonyarde@howarth-dev /usr/local/virtenv/hwa-0.2/hwa]$ ../bin/uwsgi --ini 
development.ini 
[uWSGI] getting INI configuration from development.ini
*** Starting uWSGI 1.2.4 (64bit) on [Mon Jul 16 09:53:56 2012] ***
compiled with version: 4.2.1 20070831 patched [FreeBSD] on 13 July 2012 11:14:07
detected number of CPU cores: 1
current working directory: /usr/local/virtenv/hwa-0.2/hwa
detected binary path: /usr/local/virtenv/hwa-0.2/bin/uwsgi
your memory page size is 4096 bytes
detected max file descriptor number: 11095
lock engine: POSIX semaphores
uwsgi socket 0 bound to TCP address :3031 fd 3
Python version: 3.2.3 (default, Jul 11 2012, 10:17:04)  [GCC 4.2.1 20070831 
patched [FreeBSD]]
Set PythonHome to /usr/local/virtenv/hwa-0.2
*** Python threads support is disabled. You can enable it with --enable-threads 
***
Python main interpreter initialized at 0x802925180
your server socket listen backlog is limited to 100 connections
*** Operational MODE: single process ***
Loading paste environment: config:/usr/local/virtenv/hwa-0.2/hwa/development.ini
****** DEBUG ******
<class 'bytes'>
Traceback (most recent call last):
File 
"/usr/local/virtenv/hwa-0.2/lib/python3.2/site-packages/PasteDeploy-1.5.0-py3.2.egg/paste/deploy/loadwsgi.py",
 line 247, in loadapp
  return loadobj(APP, uri, name=name, **kw)
File 
"/usr/local/virtenv/hwa-0.2/lib/python3.2/site-packages/PasteDeploy-1.5.0-py3.2.egg/paste/deploy/loadwsgi.py",
 line 271, in loadobj
  global_conf=global_conf)
File 
"/usr/local/virtenv/hwa-0.2/lib/python3.2/site-packages/PasteDeploy-1.5.0-py3.2.egg/paste/deploy/loadwsgi.py",
 line 281, in loadcontext
  if '#' in uri:
TypeError: Type str doesn't support the buffer API

[simonyarde@howarth-dev /usr/local/virtenv/hwa-0.2/hwa]$ ../bin/pserve 
development.ini 
****** DEBUG ******
<class 'str'>
****** DEBUG ******
<class 'str'>
****** DEBUG ******
<class 'str'>
****** DEBUG ******
<class 'str'>
Starting server in PID 25441.
serving on http://0.0.0.0:6543
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to