#31045: Squashing migrations returns "SyntaxError: Invalid token" -------------------------------------+------------------------------------- Reporter: benmezger | Owner: nobody Type: Bug | Status: new Component: Database | Version: 2.0 layer (models, ORM) | Severity: Normal | Keywords: bug, migrations Triage Stage: | Has patch: 0 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- Seems that squashing my app migrations is returning the following error when running `migrate`. As far as I can see, 0060_auto_20190828_0652.update_store_locator_in_cart_page is an invalid identifier because it starts with a number. Perhaps checking running `getattr` before to avoid this issue.
I am not sure whether this is a Django issue or some other library conflict. {{{ Traceback (most recent call last): File "manage.py", line 25, in <module> execute_from_command_line(sys.argv) File "/Users/benmezger/.pyenv/versions/skyroam/lib/python3.6/site- packages/django/core/management/__init__.py", line 371, in execute_from_command_line utility.execute() File "/Users/benmezger/.pyenv/versions/skyroam/lib/python3.6/site- packages/django/core/management/__init__.py", line 365, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/benmezger/.pyenv/versions/skyroam/lib/python3.6/site- packages/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **cmd_options) File "/Users/benmezger/.pyenv/versions/skyroam/lib/python3.6/site- packages/django/core/management/base.py", line 335, in execute output = self.handle(*args, **options) File "/Users/benmezger/.pyenv/versions/skyroam/lib/python3.6/site- packages/django/core/management/commands/migrate.py", line 79, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) File "/Users/benmezger/.pyenv/versions/skyroam/lib/python3.6/site- packages/django/db/migrations/executor.py", line 18, in __init__ self.loader = MigrationLoader(self.connection) File "/Users/benmezger/.pyenv/versions/skyroam/lib/python3.6/site- packages/django/db/migrations/loader.py", line 49, in __init__ self.build_graph() File "/Users/benmezger/.pyenv/versions/skyroam/lib/python3.6/site- packages/django/db/migrations/loader.py", line 201, in build_graph self.load_disk() File "/Users/benmezger/.pyenv/versions/skyroam/lib/python3.6/site- packages/django/db/migrations/loader.py", line 110, in load_disk migration_module = import_module("%s.%s" % (module_name, migration_name)) File "/Users/benmezger/.pyenv/versions/3.6.0/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 674, in exec_module File "<frozen importlib._bootstrap_external>", line 781, in get_code File "<frozen importlib._bootstrap_external>", line 741, in source_to_code File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "/Users/benmezger/workspace/ckl/skyroam_backend/store/migrations/0001_squashed_0071_product_custom_shipping_rate.py", line 1272 code=store.migrations.0060_auto_20190828_0652.update_store_locator_in_cart_page, ^ SyntaxError: invalid token }}} The generated migrations code: https://gist.github.com/benmezger/7e63f6a9e3b468b1838c67a7bd4a2bc4 -- Ticket URL: <https://code.djangoproject.com/ticket/31045> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/052.238488b65d2bb2ef995047d13bc12616%40djangoproject.com.