Skip to content

0003_drop_pickle migration problem with 5.2 #618

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

Open
ricardo-martins-altium opened this issue Apr 24, 2025 · 0 comments
Open

0003_drop_pickle migration problem with 5.2 #618

ricardo-martins-altium opened this issue Apr 24, 2025 · 0 comments

Comments

@ricardo-martins-altium
Copy link

Can't seem to run last constance migration (0033_drop_pickle) since I get the following error:

Operations to perform:
  Apply all migrations: constance
Running migrations:
  Applying constance.0003_drop_pickle...Traceback (most recent call last):
  File ".../vali/backend/manage.py", line 17, in <module>
    execute_from_command_line(sys.argv)
  File ".../environments/envali12django5/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File ".../environments/envali12django5/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File ".../environments/envali12django5/lib/python3.12/site-packages/django/core/management/base.py", line 416, in run_from_argv
    self.execute(*args, **cmd_options)
  File ".../environments/envali12django5/lib/python3.12/site-packages/django/core/management/base.py", line 460, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../environments/envali12django5/lib/python3.12/site-packages/django/core/management/base.py", line 107, in wrapper
    res = handle_func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../environments/envali12django5/lib/python3.12/site-packages/django/core/management/commands/migrate.py", line 353, in handle
    post_migrate_state = executor.migrate(
                         ^^^^^^^^^^^^^^^^^
  File ".../environments/envali12django5/lib/python3.12/site-packages/django/db/migrations/executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../environments/envali12django5/lib/python3.12/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
            ^^^^^^^^^^^^^^^^^^^^^
  File ".../environments/envali12django5/lib/python3.12/site-packages/django/db/migrations/executor.py", line 255, in apply_migration
    state = migration.apply(state, schema_editor)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../environments/envali12django5/lib/python3.12/site-packages/django/db/migrations/migration.py", line 132, in apply
    operation.database_forwards(
  File ".../environments/envali12django5/lib/python3.12/site-packages/django/db/migrations/operations/special.py", line 196, in database_forwards
    self.code(from_state.apps, schema_editor)
  File ".../environments/envali12django5/lib/python3.12/site-packages/constance/migrations/0003_drop_pickle.py", line 35, in migrate_pickled_data
    constance.value = dumps(pickle.loads(b64decode(constance.value.encode())))  # noqa: S301
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 1: ordinal not in range(128)

Any ideia how to solve it? or what I'm missing?
We are currently migration from Django 4.2 to 5.2 and updating django constance from 2.9.1 to 4.3.2. Should we do a minor jump for constance before going for 5.2?
Thanks in advance

More info:
Python 3.12
Django==5.2
django-constance==4.3.2

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

1 participant