TypeError loadwsgi.py loadcontext

22 views
Skip to first unread message

Simon Yarde

unread,
Jul 16, 2012, 6:47:39 AM7/16/12
to paste...@googlegroups.com
Re Paste Deploy loadwsgi.py loadcontext, uWSGI causes ``uri`` to be passed as bytes whereas Pyramid/waitress has a string.

I've dropped this over to the uWSGI list as not sure where the issue is originating...

I have perhaps rather crassly done this, and uWSGI is successfully parsing the .ini file and starting.

def loadcontext(object_type, uri, name=None, relative_to=None,·
global_conf=None):·
# SY·
print('****** DEBUG ******')·
print(type(uri))·
if isinstance(uri, bytes):·
uri = uri.decode('utf-8')·
# END SY·
if '#' in uri:

Hoping someone can spot where the issue is so I can direct this appropriately!

Best, S



Full trace with my debug:

[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
Reply all
Reply to author
Forward
0 new messages