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

makemigrations fails on Py3.7 #16

Closed
itsthejoker opened this issue Jan 3, 2019 · 4 comments
Closed

makemigrations fails on Py3.7 #16

itsthejoker opened this issue Jan 3, 2019 · 4 comments

Comments

@itsthejoker
Copy link

When attempting to run makemigrations, it explodes on https://github.com/lehins/django-smartfields/blob/master/smartfields/managers.py#L32, specifically on d.async. Based on what I can find, it looks to be because async is a reserved keyword now.

Environment:
python = "3.7.0"
django = "^2.1"
Pillow = "^5.3"
django-smartfields = "^1.0"
opencv-python = "^3.4"
scikit-image = "^0.14.1"
numpy = "^1.15"

Offending code in my model:

    card_img = fields.ImageField(
        upload_to='card_img',
        dependencies=[
            FileDependency(
                attname='card_img_jpeg',
                processor=ImageProcessor(
                    format='JPEG',
                    scale={
                        'max_width': 266,
                        'max_height': 260
                    }
                )
            ),
        ]
    )
    card_img_jpeg = fields.ImageField(upload_to='card_img')

Full traceback is below.

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/jkaufeld/github/filamentcolors.xyz/.venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/Users/jkaufeld/github/filamentcolors.xyz/.venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
    django.setup()
  File "/Users/jkaufeld/github/filamentcolors.xyz/.venv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/jkaufeld/github/filamentcolors.xyz/.venv/lib/python3.7/site-packages/django/apps/registry.py", line 112, in populate
    app_config.import_models()
  File "/Users/jkaufeld/github/filamentcolors.xyz/.venv/lib/python3.7/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/local/var/pyenv/versions/3.7.0/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/jkaufeld/github/filamentcolors.xyz/filamentcolors/models.py", line 3, in <module>
    from smartfields import fields
  File "/Users/jkaufeld/github/filamentcolors.xyz/.venv/lib/python3.7/site-packages/smartfields/fields/__init__.py", line 12, in <module>
    from smartfields.managers import FieldManager
  File "/Users/jkaufeld/github/filamentcolors.xyz/.venv/lib/python3.7/site-packages/smartfields/managers.py", line 34
    dependencies = list(filter(lambda d: d.async, self.manager.dependencies))
                                               ^
SyntaxError: invalid syntax
@ghost
Copy link

ghost commented Mar 21, 2019

Same issue here, please fix-up :D

@zglennie
Copy link

zglennie commented May 18, 2019

I had this issue too, so I forked the repo and renamed "async" to "async_". It seems to be working for me now.

The fork: https://github.com/zglennie/django-smartfields

The commit fixing the issue: https://github.com/zglennie/django-smartfields/commit/aabb87d4d055b403f10e9389942d55d214e91491

@lehins
Copy link
Owner

lehins commented May 18, 2019

@zglennie That's great, seems like a legit fix. Would you mind submitting a PR? I'll be happy to merge it and get this issue fixed. Also it would be great if you could bump up the revision in smartfields/__init__.py to 1.0.10 and a add an entry to CHANGELOG.rst. Of course, if it's too much trouble I can make those changes myself.

@lehins
Copy link
Owner

lehins commented May 20, 2019

This has been fixed in #18 New version django-smartfields=1.1.0 is on PyPi

@lehins lehins closed this as completed May 20, 2019
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

3 participants