I'm trying to add Channels to my app by following this tutorial:
https://blog.heroku.com/in_deep_with_django_channels_the_future_of_real_time_apps_in_django
The Django app compiles, but when I try to run it:
(virtualenv) root#computer:path# python manage.py runserver 0.0.0.0:8000
It gives error:
File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/channels/routing.py", line 75, in resolve_routing
raise ImproperlyConfigured("Cannot import channel routing %r: %s" % (routing, e))
ImproperlyConfigured: Cannot import channel routing 'codebench.routing.channel_routing': cannot import name ProtocolTypeRouter
According to this
https://github.com/VincentTide/django-channels-celery-example/issues/1
It maybe related to Python version, so I did:
(virtualenv) root#computer:path# alias python=python3
(virtualenv) root#computer:path# python -V
Python 3.5.2
(virtualenv) root#computer:path# python manage.py runserver 0.0.0.0:8000
Traceback (most recent call last):
File "manage.py", line 3, in <module>
import eventlet
ImportError: No module named 'eventlet'
(virtualenv) root#computer:path# pip install eventlet
Requirement already satisfied: eventlet in /root/.virtualenvs/codebench/lib/python2.7/site-packages
Requirement already satisfied: greenlet>=0.3 in /root/.virtualenvs/codebench/lib/python2.7/site-packages (from eventlet)
Requirement already satisfied: enum-compat in /root/.virtualenvs/codebench/lib/python2.7/site-packages (from eventlet)
Requirement already satisfied: enum34 in /root/.virtualenvs/codebench/lib/python2.7/site-packages (from enum-compat->eventlet)
Now I stuck at: ImportError: No module named 'eventlet'
I have the following packages installed:
channels==1.1.6
daphne==1.4.0
Django==1.9
eventlet==0.20.0
If I follow this tutorial: http://channels.readthedocs.io/en/1.x/getting-started.html
System check identified 1 issue (0 silenced).
February 16, 2018 - 23:19:32
Django version 1.9, using settings 'codebench.settings'
Starting Channels development server at http://0.0.0.0:8000/
Channel layer default (asgiref.inmemory.ChannelLayer)
Quit the server with CONTROL-C.
2018-02-16 23:19:32,935 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive
2018-02-16 23:19:32,935 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive
2018-02-16 23:19:32,935 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive
2018-02-16 23:19:32,936 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive
Traceback (most recent call last):
File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/eventlet/hubs/hub.py", line 457, in fire_timers
timer()
File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/eventlet/hubs/timer.py", line 58, in __call__
cb(*args, **kw)
File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/eventlet/semaphore.py", line 145, in _do_acquire
waiter.switch()
File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/eventlet/green/thread.py", line 41, in __thread_body
func(*args, **kwargs)
File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/channels/management/commands/runserver.py", line 99, in inner_run
websocket_handshake_timeout=self.websocket_handshake_timeout,
File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/daphne/server.py", line 101, in run
websocket_handshake_timeout=self.websocket_handshake_timeout
TypeError: __init__() got an unexpected keyword argument 'proxy_forwarded_proto_header'
If I upgrade everything, except Python 2.7.12:
asgi-redis==1.4.3
asgiref==2.1.5
channels==2.0.2
daphne==2.0.3
Django==1.11.10
runserver will give:
File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/channels/apps.py", line 6, in <module>
import daphne.server # noqa
File "/root/.virtualenvs/codebench/local/lib/python2.7/site-packages/daphne/server.py", line 192
async def handle_reply(self, protocol, message):
^
SyntaxError: invalid syntax
If I try to reinstall all required packages under Python 3.5.2:
Need this for twisted:
apt install python3.6-dev
https://askubuntu.com/questions/966939/failed-building-wheel-for-twisted
Now I'm getting random errors:
2018-02-18 14:03:51,634 - ERROR - server - Exception inside application: 'NoneType' object has no attribute 'writeSequence'
File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
result = coro.throw(exc)
File "/root/.virtualenvs/python3/lib/python3.5/site-packages/channels/http.py", line 191, in __call__
await self.handle(body)
File "/root/.virtualenvs/python3/lib/python3.5/site-packages/asgiref/sync.py", line 108, in __call__
return await asyncio.wait_for(future, timeout=None)
File "/usr/lib/python3.5/asyncio/tasks.py", line 373, in wait_for
return (yield from fut)
File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/root/.virtualenvs/python3/lib/python3.5/site-packages/asgiref/sync.py", line 123, in thread_handler
return self.func(*args, **kwargs)
File "/root/.virtualenvs/python3/lib/python3.5/site-packages/channels/http.py", line 227, in handle
self.send(response_message)
File "/root/.virtualenvs/python3/lib/python3.5/site-packages/asgiref/sync.py", line 62, in __call__
return call_result.result()
File "/usr/lib/python3.5/concurrent/futures/_base.py", line 405, in result
return self.__get_result()
File "/usr/lib/python3.5/concurrent/futures/_base.py", line 357, in __get_result
raise self._exception
File "/root/.virtualenvs/python3/lib/python3.5/site-packages/asgiref/sync.py", line 76, in main_wrap
result = await self.awaitable(*args, **kwargs)
File "/root/.virtualenvs/python3/lib/python3.5/site-packages/daphne/server.py", line 196, in handle_reply
protocol.handle_reply(message)
File "/root/.virtualenvs/python3/lib/python3.5/site-packages/daphne/http_protocol.py", line 210, in handle_reply
http.Request.write(self, message.get("body", b""))
File "/root/.virtualenvs/python3/lib/python3.5/site-packages/twisted/web/http.py", line 1084, in write
self.channel.writeSequence(toChunk(data))
'NoneType' object has no attribute 'writeSequence'
Also:
(python3) root#computer:path# python manage.py shell
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import channels
>>> print(channels.__file__)
/root/.virtualenvs/python3/lib/python3.5/site-packages/channels/__init__.py
>>> from channels import Group
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: cannot import name 'Group'
It looks as if you created a Python 2 virtualenv. Setting alias python=python3 won't work. You need to create a virtualenv using Python 3, for example:
python3 -m venv newenv
Then re-install your requirements in the new virtualenv.
Once you have activated the new environment, python will be python3. You won't need to set alias python=python3.
I end up with the following versions:
asgi-redis==0.8.3
asgiref==0.9
autobahn==0.12.1
channels==0.9.3
daphne==0.9.1
dj-database-url==0.4.0
Django==1.9.3
haikunator==1.0.1
msgpack-python==0.4.7
psycopg2==2.7.4
redis==2.10.5
six==1.10.0
Twisted==15.5.0
txaio==2.2.1
zope.interface==4.1.3
Turned out Python version doesn't matter, works with both 2.7 and 3.5.
Because I was installing the https://github.com/jacobian/channels-example,
I also changed the database from MySQL to PostgreSQL. This example works like a charm.
Related
Iam trying to install OCPP in Python 2.7 using following command and getting the error shown below. plz help to resolve the issue
C:\Python27>python -m pip install ocpp
Collecting ocpp
Downloading https://files.pythonhosted.org/packages/36/f8/f3222edf8cf0f1a7373c9d5b0be0974959b3cf302906f0c59fe8bf4071f7/ocpp-0.1.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\vijaya~1\appdata\local\temp\pip-build-yaigdj\ocpp\setup.py", line 6, in <module>
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
TypeError: 'encoding' is an invalid keyword argument for this function
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\vijaya~1\appdata\local\temp\pip-build-yaigdj\ocpp\
You are using pip version 9.0.1, however version 20.2.4 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
I installed python 3.8 and reinstalled OCPP. After that Iam trying to simulate the central system and charge point of PyPi OCPP given in the following link https://pypi.org/project/ocpp/. Central system code runs without any error. but while compiling the charge point code i am getting the following error
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
====================== RESTART: C:/Python38/ocppserver.py ======================
INFO:root:WebSocket Server Started
====================== RESTART: C:\Python38\chargepoint.py =====================
Traceback (most recent call last):
File "C:\Python38\chargepoint.py", line 39, in <module>
asyncio.run(main())
File "C:\Python38\lib\asyncio\runners.py", line 43, in run
return loop.run_until_complete(main)
File "C:\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "C:\Python38\chargepoint.py", line 28, in main
async with websockets.connect(
File "C:\Python38\lib\site-packages\websockets\client.py", line 517, in __aenter__
return await self
File "C:\Python38\lib\site-packages\websockets\client.py", line 535, in __await_impl__
transport, protocol = await self._create_connection()
File "C:\Python38\lib\asyncio\base_events.py", line 1030, in create_connection
raise exceptions[0]
File "C:\Python38\lib\asyncio\base_events.py", line 1010, in create_connection
sock = await self._connect_sock(
File "C:\Python38\lib\asyncio\base_events.py", line 924, in _connect_sock
await self.sock_connect(sock, address)
File "C:\Python38\lib\asyncio\proactor_events.py", line 702, in sock_connect
return await self._proactor.connect(sock, address)
File "C:\Python38\lib\asyncio\windows_events.py", line 808, in _poll
value = callback(transferred, key, ov)
File "C:\Python38\lib\asyncio\windows_events.py", line 595, in finish_connect
ov.getresult()
ConnectionRefusedError: [WinError 1225] The remote computer refused the network connection
>>>
[PyPI]: ocpp (currently v0.8.1) only supports Python 3. However, same thing applies to v0.1.1 (very 1st OCPP version).
So, the only way to proceed is install (and start using) Python 3, and give up Python 2(.7) (who is dead from the beginning of allmighty 2020 ([Python]: PEP 373 - Python 2.7 Release Schedule)).
Of course, there's the (painful) alternative of porting OCPP code to Python 2, but I'd totally advice against it.
I am new to docker and while running docker-compose build command i am getting this error.
Traceback (most recent call last):
File "/home/ghostface/playground/bootcamp/venv/bin/docker-compose", line 11, in <module>
sys.exit(main())
File "/home/ghostface/playground/bootcamp/venv/lib/python3.6/site-packages/compose/cli/main.py", line 72, in main
command()
File "/home/ghostface/playground/bootcamp/venv/lib/python3.6/site-packages/compose/cli/main.py", line 125, in perform_command
project = project_from_options('.', options)
File "/home/ghostface/playground/bootcamp/venv/lib/python3.6/site-packages/compose/cli/command.py", line 76, in project_from_options
environment_file=environment_file
File "/home/ghostface/playground/bootcamp/venv/lib/python3.6/site-packages/compose/cli/command.py", line 135, in get_project
config_data = config.load(config_details, compatibility, interpolate)
File "/home/ghostface/playground/bootcamp/venv/lib/python3.6/site-packages/compose/config/config.py", line 411, in load
service_dicts = load_services(config_details, main_file, compatibility, interpolate=interpolate)
File "/home/ghostface/playground/bootcamp/venv/lib/python3.6/site-packages/compose/config/config.py", line 510, in load_services
return build_services(service_config)
File "/home/ghostface/playground/bootcamp/venv/lib/python3.6/site-packages/compose/config/config.py", line 491, in build_services
for name, service_dict in service_config.items()
File "/home/ghostface/playground/bootcamp/venv/lib/python3.6/site-packages/compose/config/config.py", line 491, in <listcomp>
for name, service_dict in service_config.items()
File "/home/ghostface/playground/bootcamp/venv/lib/python3.6/site-packages/compose/config/config.py", line 483, in build_service
interpolate
File "/home/ghostface/playground/bootcamp/venv/lib/python3.6/site-packages/compose/config/config.py", line 888, in finalize_service
service_dict['environment'] = resolve_environment(service_dict, environment, interpolate)
File "/home/ghostface/playground/bootcamp/venv/lib/python3.6/site-packages/compose/config/config.py", line 687, in resolve_environment
env.update(env_vars_from_file(env_file, interpolate))
File "/home/ghostface/playground/bootcamp/venv/lib/python3.6/site-packages/compose/config/environment.py", line 42, in env_vars_from_file
env = dotenv.dotenv_values(dotenv_path=filename, encoding='utf-8-sig', interpolate=interpolate)
File "/home/ghostface/playground/bootcamp/venv/lib/python3.6/site-packages/dotenv/main.py", line 283, in dotenv_values
return DotEnv(f, verbose=verbose, **kwargs).dict()
TypeError: __init__() got an unexpected keyword argument 'interpolate'
Result of docker-compose version
docker-compose version 1.26.0, build unknown
docker-py version: 4.2.1
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.1.1c 28 May 2019
Requirement.txt file:
Flask==1.1.1
Flask-Login==0.4.1
Flask-Mail==0.9.1
Flask-Migrate==2.5.2
Flask-Moment==0.9.0
Flask-SQLAlchemy==2.4.0
Flask-WTF==0.14.2
pusher==2.1.4
PyJWT==1.7.1
pylint==2.3.1
python-dotenv==0.10.3
Werkzeug==0.16.1
gunicorn
docker-compose
The code in your container uses a newer version of python-dotenv than the one that is listed in the requirements.txt file, as the interpolate option was added in v0.11.0.
You will need to change the version in requirements.txt to 0.11.0 (or the most recent one) and reinstall the dependencies.
It seems your container uses a virtual environment. You may need to check that the dependencies are correctly updated in the container, either by running pip install in the Dockerfile, or by running it locally beforehand.
I've just recently started played around with web application development using Django and now got to Django-Q for async tasks.
I followed this tutorial up to slide 13. Unfortunately then, when I try to run python manage.py qcluster I get these error messages:
(djangoq_tut) D:\Code\Python\DjangoQ_Tutorial\djangoq_demo>python manage.py qcluster
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "D:\Code\Python\DjangoQ_Tutorial\djangoq_tut\lib\site-packages\django\core\management\__init__.py", line 350, in execute_from_command_line
utility.execute()
File "D:\Code\Python\DjangoQ_Tutorial\djangoq_tut\lib\site-packages\django\core\management\__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\Code\Python\DjangoQ_Tutorial\djangoq_tut\lib\site-packages\django\core\management\base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "D:\Code\Python\DjangoQ_Tutorial\djangoq_tut\lib\site-packages\django\core\management\base.py", line 399, in execute
output = self.handle(*args, **options)
File "D:\Code\Python\DjangoQ_Tutorial\djangoq_tut\lib\site-packages\django_q\management\commands\qcluster.py", line 22, in handle
q.start()
File "D:\Code\Python\DjangoQ_Tutorial\djangoq_tut\lib\site-packages\django_q\cluster.py", line 57, in start
self.sentinel.start()
File "c:\program files (x86)\python35-32\Lib\multiprocessing\process.py", line 105, in start
self._popen = self._Popen(self)
File "c:\program files (x86)\python35-32\Lib\multiprocessing\context.py", line 212, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "c:\program files (x86)\python35-32\Lib\multiprocessing\context.py", line 313, in _Popen
return Popen(process_obj)
File "c:\program files (x86)\python35-32\Lib\multiprocessing\popen_spawn_win32.py", line 66, in __init__
reduction.dump(process_obj, to_child)
File "c:\program files (x86)\python35-32\Lib\multiprocessing\reduction.py", line 59, in dump
ForkingPickler(file, protocol).dump(obj)
TypeError: can't pickle _thread.lock objects
(djangoq_tut) D:\Code\Python\DjangoQ_Tutorial\djangoq_demo>Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files (x86)\python35-32\Lib\multiprocessing\spawn.py", line 100, in spawn_main
new_handle = steal_handle(parent_pid, pipe_handle)
File "c:\program files (x86)\python35-32\Lib\multiprocessing\reduction.py", line 86, in steal_handle
_winapi.DUPLICATE_SAME_ACCESS | _winapi.DUPLICATE_CLOSE_SOURCE)
PermissionError: [WinError 5] Access is denied
I'm using a Windows 7 machine and Python 3.5.1 (32 bit) with following requirements:
appdirs==1.4.3
arrow==0.10.0
blessed==1.14.1
Django==1.9
django-picklefield==0.3.2
django-q==0.7.18
future==0.16.0
packaging==16.8
pyparsing==2.2.0
python-dateutil==2.6.0
six==1.10.0
wcwidth==0.1.7
I tried looking up the source of the error, it looks to me as it might not be exclusively related to Django or Django-Q. Other than that I don't really understand what it means.
Also tried with Python 2.7.12, outside of a virtualenv, there I get a TypeError: can't pickle _thread.lock objects, which I don't really get either.
Any ideas how to solve this?
[Edit]
After experimenting with a DjangoQ alternative - Celery - I as able to recreate the problem:
The same error occurs if using Celery 4.0.2, but not with Celery 3.1.25
I still haven't figured out how to fix this, but decided to stick to Celery for the time being, since it kinda works...
Install the latest version with pip:
$ pip install django-q
Add django_q to INSTALLED_APPS in your projects settings.py:
INSTALLED_APPS = (
# other apps
'django_q',
)
Run Django migrations to create the database tables:
$ python manage.py migrate
Choose a message broker , configure it and install the appropriate client library.
Run Django Q cluster in order to handle tasks async:
$ python manage.py qcluster
I'm using a macOS development box and have installed airflow, unfortunately running airflow webserver -p 8080 results in an "AttributeError"
value = getattr(current_model, attribute) AttributeError: type object 'TaskInstance' has no attribute 'log'
pip freeze says my version is airflow==1.7.1.2
My python is Python 3.5.1 |Anaconda 4.0.0 (x86_64)| (default, Dec 7 2015, 11:24:55)
Here is the sequence of events:
I made an anaconda environment
I installed some packages, including
airflow
pip install --upgrade git+https://github.com/airbnb/airflow.git
set the AIRFLOW_HOME variable in my .bash_profile
airflow initdb worked fine
airflow webserver -p 8080 gives the following
[2016-06-13 14:07:09,768] {models.py:161} INFO - Filling up the DagBag from /Users/trogdor/airflow/dags
Traceback (most recent call last):
File "/Users/trogdor/anaconda/bin/airflow", line 15, in <module>
args.func(args)
File "/Users/trogdor/anaconda/lib/python3.5/site-packages/airflow/bin/cli.py", line 418, in webserver
app = cached_app(conf)
File "/Users/trogdor/anaconda/lib/python3.5/site-packages/airflow/www/app.py", line 135, in cached_app
app = create_app(config)
File "/Users/trogdor/anaconda/lib/python3.5/site-packages/airflow/www/app.py", line 75, in create_app
Session, name="Task Instances", category="Browse"))
File "/Users/trogdor/anaconda/lib/python3.5/site-packages/flask_admin/contrib/sqla/view.py", line 318, in __init__
menu_icon_value=menu_icon_value)
File "/Users/trogdor/anaconda/lib/python3.5/site-packages/flask_admin/model/base.py", line 771, in __init__
self._refresh_cache()
File "/Users/trogdor/anaconda/lib/python3.5/site-packages/flask_admin/model/base.py", line 847, in _refresh_cache
self._list_columns = self.get_list_columns()
File "/Users/trogdor/anaconda/lib/python3.5/site-packages/flask_admin/model/base.py", line 980, in get_list_columns
excluded_columns=self.column_exclude_list,
File "/Users/trogdor/anaconda/lib/python3.5/site-packages/flask_admin/contrib/sqla/view.py", line 517, in get_column_names
column, path = tools.get_field_with_path(self.model, c)
File "/Users/trogdor/anaconda/lib/python3.5/site-packages/flask_admin/contrib/sqla/tools.py", line 144, in get_field_with_path
value = getattr(current_model, attribute)
AttributeError: type object 'TaskInstance' has no attribute 'log'
i can't use django-socketio, i get this error:
AttributeError: 'SocketIOHandler' object has no attribute 'response_headers_list'
Terminal:
Traceback (most recent call last):
File "/Volumes/DATA/Projekti/virtualenv/caffetouch/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run
result = self._run(*self.args, **self.kwargs)
File "/Volumes/DATA/Projekti/virtualenv/caffetouch/lib/python2.7/site-packages/socketio/server.py", line 49, in handle
handler.handle()
File "/Volumes/DATA/Projekti/virtualenv/caffetouch/lib/python2.7/site-packages/gevent/pywsgi.py", line 184, in handle
result = self.handle_one_request()
File "/Volumes/DATA/Projekti/virtualenv/caffetouch/lib/python2.7/site-packages/gevent/pywsgi.py", line 321, in handle_one_request
self.handle_one_response()
File "/Volumes/DATA/Projekti/virtualenv/caffetouch/lib/python2.7/site-packages/socketio/handler.py", line 58, in handle_one_response
self.handle_one_response(call_wsgi_app=False)
TypeError: handle_one_response() got an unexpected keyword argument 'call_wsgi_app'
<Greenlet at 0x10247ac30: <bound method SocketIOServer.handle of <SocketIOServer at 0x1028ce8d0 fileno=5 address=127.0.0.1:8000>>(<socket at 0x102976210 fileno=[Errno 9] Bad file d, ('127.0.0.1', 51457))> failed with TypeError
Traceback (most recent call last):
File "/Volumes/DATA/Projekti/virtualenv/caffetouch/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run
result = self._run(*self.args, **self.kwargs)
File "/Volumes/DATA/Projekti/virtualenv/caffetouch/lib/python2.7/site-packages/socketio/server.py", line 49, in handle
handler.handle()
File "/Volumes/DATA/Projekti/virtualenv/caffetouch/lib/python2.7/site-packages/gevent/pywsgi.py", line 184, in handle
result = self.handle_one_request()
File "/Volumes/DATA/Projekti/virtualenv/caffetouch/lib/python2.7/site-packages/gevent/pywsgi.py", line 321, in handle_one_request
self.handle_one_response()
File "/Volumes/DATA/Projekti/virtualenv/caffetouch/lib/python2.7/site-packages/socketio/handler.py", line 68, in handle_one_response
jobs = self.transport.connect(session, request_method)
File "/Volumes/DATA/Projekti/virtualenv/caffetouch/lib/python2.7/site-packages/socketio/transports.py", line 92, in connect
self.write_packed(session_id)
File "/Volumes/DATA/Projekti/virtualenv/caffetouch/lib/python2.7/site-packages/socketio/transports.py", line 19, in write_packed
self.write(data)
File "/Volumes/DATA/Projekti/virtualenv/caffetouch/lib/python2.7/site-packages/socketio/transports.py", line 22, in write
if 'Content-Length' not in self.handler.response_headers_list:
AttributeError: 'SocketIOHandler' object has no attribute 'response_headers_list'
<Greenlet at 0x10247ac30: <bound method SocketIOServer.handle of <SocketIOServer at 0x1028ce8d0 fileno=5 address=127.0.0.1:8000>>(<socket at 0x102976210 fileno=[Errno 9] Bad file d, ('127.0.0.1', 51460))> failed with AttributeError
I think this is showing becouse it isn't supported with new django, or something like this.
Any solution?
Hope it won't be too late. It's actually a compatibility issue. You need to uninstall some newer packages. See here.
Here is part of my configuration. It works.
$ pip list
Django (1.6.7)
django-socketio (0.3.8)
gevent (0.13.6)
gevent-socketio (0.2.1)
gevent-websocket (0.2.3)
greenlet (0.4.5)
pip (1.5.6)
setuptools (6.0.2)
sphinx-me (0.3)
If you are using django 1.8 or above then you need to uninstall new version and install the previous version using the given command:
pip install django-socketio==0.3.9
pip uninstall gevent-socketio gevent
pip install gevent-socketio==0.2.1 gevent==0.13.6
For more details, see the following thread: https://github.com/stephenmcd/django-socketio/issues/63