Repository: pretix/pretix

Issue:
Python 3.7 support
I got this error on many a lot of different pages.

```
Sep 17 22:36:53 cetus gunicorn[5434]: ERROR 2018-09-17 20:36:53,009 django.request log Internal Server Error: /control/organizer/X/settings/display
Sep 17 22:36:53 cetus gunicorn[5434]: Traceback (most recent call last):
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/kombu/utils/objects.py", line 42, in __get__
Sep 17 22:36:53 cetus gunicorn[5434]:     return obj.__dict__[self.__name__]
Sep 17 22:36:53 cetus gunicorn[5434]: KeyError: 'router'
Sep 17 22:36:53 cetus gunicorn[5434]: During handling of the above exception, another exception occurred:
Sep 17 22:36:53 cetus gunicorn[5434]: Traceback (most recent call last):
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
Sep 17 22:36:53 cetus gunicorn[5434]:     response = get_response(request)
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 126, in _get_response
Sep 17 22:36:53 cetus gunicorn[5434]:     response = self.process_exception_by_middleware(e, request)
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 124, in _get_response
Sep 17 22:36:53 cetus gunicorn[5434]:     response = wrapped_callback(request, *callback_args, **callback_kwargs)
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/pretix/control/permissions.py", line 64, in wrapper
Sep 17 22:36:53 cetus gunicorn[5434]:     return function(request, *args, **kw)
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/django/views/generic/base.py", line 68, in view
Sep 17 22:36:53 cetus gunicorn[5434]:     return self.dispatch(request, *args, **kwargs)
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/django/views/generic/base.py", line 88, in dispatch
Sep 17 22:36:53 cetus gunicorn[5434]:     return handler(request, *args, **kwargs)
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/usr/lib64/python3.7/contextlib.py", line 74, in inner
Sep 17 22:36:53 cetus gunicorn[5434]:     return func(*args, **kwds)
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/pretix/control/views/organizer.py", line 157, in post
Sep 17 22:36:53 cetus gunicorn[5434]:     regenerate_organizer_css.apply_async(args=(self.request.organizer.pk,))
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/celery/app/task.py", line 535, in apply_async
Sep 17 22:36:53 cetus gunicorn[5434]:     **options
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/celery/app/base.py", line 697, in send_task
Sep 17 22:36:53 cetus gunicorn[5434]:     router = router or amqp.router
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/kombu/utils/objects.py", line 44, in __get__
Sep 17 22:36:53 cetus gunicorn[5434]:     value = obj.__dict__[self.__name__] = self.__get(obj)
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/celery/app/amqp.py", line 606, in router
Sep 17 22:36:53 cetus gunicorn[5434]:     return self.Router()
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/celery/app/amqp.py", line 287, in Router
Sep 17 22:36:53 cetus gunicorn[5434]:     return _routes.Router(self.routes, queues or self.queues,
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/celery/app/amqp.py", line 601, in routes
Sep 17 22:36:53 cetus gunicorn[5434]:     self.flush_routes()
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/celery/app/amqp.py", line 292, in flush_routes
Sep 17 22:36:53 cetus gunicorn[5434]:     self._rtable = _routes.prepare(self.app.conf.task_routes)
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/celery/app/routes.py", line 136, in prepare
Sep 17 22:36:53 cetus gunicorn[5434]:     return [expand_route(route) for route in routes]
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/celery/app/routes.py", line 136, in <listcomp>
Sep 17 22:36:53 cetus gunicorn[5434]:     return [expand_route(route) for route in routes]
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/celery/app/routes.py", line 127, in expand_route
Sep 17 22:36:53 cetus gunicorn[5434]:     return MapRoute(route)
Sep 17 22:36:53 cetus gunicorn[5434]:   File "/var/pretix/venv/lib/python3.7/site-packages/celery/app/routes.py", line 36, in __init__
Sep 17 22:36:53 cetus gunicorn[5434]:     if isinstance(k, re._pattern_type):
Sep 17 22:36:53 cetus gunicorn[5434]: AttributeError: module 're' has no attribute '_pattern_type'
```


Discussion:
pretix doesn't work with Python 3.7 currently, as at least one dependency is not compatible with Python 3.7 yet (celery). This should probably be mentioned in the docs.
Jep, already recognised and found merged there: https://github.com/celery/celery/pull/4902


For me, you could close this issue now - but maybe you like to keep it for a python 3.7 todolist
This fix is included in the latest release, yes, but not all Python 3.7 relevant fixes are included yet, see also https://github.com/celery/celery/issues/4849#issuecomment-416794568 and the celery issue on project governance.
As some months have passed since the last update here, I would like to ask if Pretix can be installed on a system running python 3.7 atm? If not does anyone know an ETA?
The ETA is the next celery release, v4.3, which can be tracked via this issue: https://github.com/celery/celery/issues/5180
RC1 for v4.3 is there :smile:
Just had a very hard time getting pretix installed on a Debian system because of this. The problem is that Debian stable only comes with python3.5 (which isn't sufficient for pretalx), but Debian 'testing' (the next stable) will _only_ ship with python3.7. Installing pretix there, with some intermediate versions of python3.6 has not been fun. So, maybe 'upping' this a little in terms of priority?
Well, as long as a major dependency of ours is stuck on 3.6, it's unfortunately not up to what priority we assign this to :(
@raphaelm with the new release of celery, which dependency still stucks at 3.6 ?
@genofire I don't yet know, wanna try it out?

Resolving patch:
diff --git a/src/setup.py b/src/setup.py
--- a/src/setup.py
+++ b/src/setup.py
@@ -104,8 +104,8 @@ def run(self):
         'django-otp==0.4.*',
         'python-u2flib-server==4.*',
         'django-formtools==2.1',
-        'celery>=4.1.1,<4.2.0',
-        'kombu==4.2.*',
+        'celery==4.3.*',
+        'kombu==4.5.*',
         'django-statici18n==1.8.*',
         'inlinestyler==0.2.*',
         'BeautifulSoup4==4.7.*',
@@ -121,8 +121,8 @@ def run(self):
         'babel',
         'paypalrestsdk==1.13.*',
         'pycparser==2.13',
-        'django-redis==4.8.*',
-        'redis==2.10.5',
+        'django-redis==4.10.*',
+        'redis==3.2.*',
         'stripe==2.0.*',
         'chardet<3.1.0,>=3.0.2',
         'mt-940==3.2',


Test patch: