Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: invalid syntax - yield from iterable #355

Closed
claudiamaximus opened this issue Dec 12, 2019 · 6 comments
Closed

SyntaxError: invalid syntax - yield from iterable #355

claudiamaximus opened this issue Dec 12, 2019 · 6 comments

Comments

@claudiamaximus
Copy link

claudiamaximus commented Dec 12, 2019

more-itertools version - 8.0.2
python version - 3.6.8

requirements.txt
alembic==1.3.1
amqp==2.5.2
billiard==3.6.1.0
blinker==1.4
celery==4.3.0
certifi==2019.6.16
chardet==3.0.4
Click==7.0
colorama==0.4.1
Flask==1.1.1
Flask-Mail==0.9.1
Flask-Migrate==2.5.2
Flask-SQLAlchemy==2.4.1
idna==2.8
importlib-metadata==1.3.0
itsdangerous==1.1.0
Jinja2==2.10.1
kombu==4.6.7
Mako==1.1.0
MarkupSafe==1.1.1
more-itertools==8.0.2
pymaging==0.1
pymaging-png==0.1
python-dateutil==2.8.1
python-editor==1.0.4
pytz==2019.3
qrcode==6.1
razorpay==1.2.0
requests==2.22.0
six==1.12.0
SQLAlchemy==1.3.11
urllib3==1.25.3
vine==1.3.0
Werkzeug==0.15.5
zipp==0.6.0
__init__.py
...
celery = Celery(app.name, broker=app.config['CELERY_BROKER_URL'])
celery.conf.update(app.config)
...
views/home.py
...
r = send_mail(email).delay(10, 20)
...
@celery.task
def send_mail(email):
    # email stuff

When I run the app, I get the following traceback!

[838493]  mod_wsgi (pid=12557): Exception occurred processing WSGI script '/var/www/myapp.com/public_html/myapp.wsgi'.
[838556]  Traceback (most recent call last):
[838580]    File "/var/www/myapp.com/public_html/myapp.wsgi", line 4, in <module>
[838617]      from myapp import app as application
[838626]    File "/var/www/myapp.com/public_html/myapp/__init__.py", line 13, in <module>
[838642]      from celery import Celery
[838650]    File "/var/www/myapp.com/public_html/venv/lib/python3.6/site-packages/celery/local.py", line 509, in __getattr__
[838665]      module = __import__(self._object_origins[name], None, None, [name])
[838672]    File "/var/www/myapp.com/public_html/venv/lib/python3.6/site-packages/celery/app/__init__.py", line 5, in <module>
[838686]      from celery import _state
[838693]    File "/var/www/myapp.com/public_html/venv/lib/python3.6/site-packages/celery/_state.py", line 17, in <module>
[838705]      from celery.utils.threads import LocalStack
[838712]    File "/var/www/myapp.com/public_html/venv/lib/python3.6/site-packages/celery/utils/__init__.py", line 8, in <module>
[838726]      from .functional import memoize  # noqa
[838745]    File "/var/www/myapp.com/public_html/venv/lib/python3.6/site-packages/celery/utils/functional.py", line 10, in <module>
[838759]      from kombu.utils.functional import (LRUCache, dictfilter, is_list, lazy,
[838766]    File "/var/www/myapp.com/public_html/venv/lib/python3.6/site-packages/kombu/utils/__init__.py", line 5, in <module>
[838779]      from .compat import fileno, maybe_fileno, nested, register_after_fork
[838786]    File "/var/www/myapp.com/public_html/venv/lib/python3.6/site-packages/kombu/utils/compat.py", line 14, in <module>
[838798]      import importlib_metadata
[838805]    File "/var/www/myapp.com/public_html/venv/lib/python3.6/site-packages/importlib_metadata/__init__.py", line 9, in <module>
[838818]      import zipp
[838825]    File "/var/www/myapp.com/public_html/venv/lib/python3.6/site-packages/zipp.py", line 12, in <module>
[838844]      import more_itertools
[838868]    File "/var/www/myapp.com/public_html/venv/lib/python3.6/site-packages/more_itertools/__init__.py", line 1, in <module>
[838893]      from .more import *  # noqa
[838939]    File "/var/www/myapp.com/public_html/venv/lib/python3.6/site-packages/more_itertools/more.py", line 460
[838946]      yield from iterable
[838950]               ^
[838955]  SyntaxError: invalid syntax
WSGI configuration
WSGIDaemonProcess myapp user=myuser group=sudo threads=5 python-path=/var/www/myapp.com:/var/www/myapp.com/public_html/venv/lib/python3.6/site-packages/

WSGIScriptAlias / /var/www/myapp.com/public_html/myapp.wsgi
sys.version

3.6.8 (default, Jan 14 2019, 11:02:34) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]

@MSeifert04
Copy link
Contributor

Is it possible that your mod_wsgi runs another Python (maybe Python 2.x)? See for example this StackOverflow answer:

Is the mod_wsgi even compiled for the version of Python you want to use? It is a common mistake that people don't realise that mod_wsgi is actually for a different Python version and so not using the same Python installation as you expect and therefore using different versions of packages.

@claudiamaximus

This comment has been minimized.

@gnuowned

This comment has been minimized.

@gnuowned

This comment has been minimized.

@bbayles
Copy link
Collaborator

bbayles commented Dec 13, 2019

@MSeifert04 is correct; this is because more-itertools no longer supports Python 2.7. You can pin the 5.0.0 version to keep using it:

pip install more-itertools==5.0.0

@webknjaz
Copy link

Cross-posting a similar Python 3.5 bug: #578.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants