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

AttributeError: 'SpooledTemporaryFile' object has no attribute 'seekable' in 1.12+ #1068

Closed
hopson opened this issue Oct 11, 2021 · 3 comments · Fixed by #1069
Closed

AttributeError: 'SpooledTemporaryFile' object has no attribute 'seekable' in 1.12+ #1068

hopson opened this issue Oct 11, 2021 · 3 comments · Fixed by #1069

Comments

@hopson
Copy link

hopson commented Oct 11, 2021

We're seeing a new error since the 1.12 release with settings:

❯ ./manage.py collectstatic --noinput
{"created": 1633964135.356417, "asctime": "2021-10-11 14:55:35,356", "levelname": "INFO", "name": "botocore.credentials", "message": "Found credentials in shared credentials file: ~/.aws/credentials"}
Traceback (most recent call last):
  File "/Users/hopson/src/ridereport/djscoots-clean/./manage.py", line 20, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/hopson/.local/share/virtualenvs/djscoots-clean-mStJMKKB/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/Users/hopson/.local/share/virtualenvs/djscoots-clean-mStJMKKB/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/hopson/.local/share/virtualenvs/djscoots-clean-mStJMKKB/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/hopson/.local/share/virtualenvs/djscoots-clean-mStJMKKB/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/Users/hopson/.local/share/virtualenvs/djscoots-clean-mStJMKKB/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 187, in handle
    collected = self.collect()
  File "/Users/hopson/.local/share/virtualenvs/djscoots-clean-mStJMKKB/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 128, in collect
    for original_path, processed_path, processed in processor:
  File "/Users/hopson/.local/share/virtualenvs/djscoots-clean-mStJMKKB/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 399, in post_process
    yield from super().post_process(*args, **kwargs)
  File "/Users/hopson/.local/share/virtualenvs/djscoots-clean-mStJMKKB/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 231, in post_process
    for name, hashed_name, processed, _ in self._post_process(paths, adjustable_paths, hashed_files):
  File "/Users/hopson/.local/share/virtualenvs/djscoots-clean-mStJMKKB/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 303, in _post_process
    saved_name = self._save(hashed_name, content_file)
  File "/Users/hopson/.local/share/virtualenvs/djscoots-clean-mStJMKKB/lib/python3.9/site-packages/storages/backends/s3boto3.py", line 632, in _save
    return super()._save(name, tmp)
  File "/Users/hopson/.local/share/virtualenvs/djscoots-clean-mStJMKKB/lib/python3.9/site-packages/storages/backends/s3boto3.py", line 454, in _save
    if content.seekable():
AttributeError: 'SpooledTemporaryFile' object has no attribute 'seekable'

Our configuration:

STATICFILES_STORAGE = "storages.backends.s3boto3.S3ManifestStaticStorage"

Verified this behavior against both Django 3.2.7 and 3.2.8; reverting to 1.11.1 resolved the error.

@jschneier
Copy link
Owner

Thanks. Fix incoming.

@jschneier
Copy link
Owner

@hopson just released the fix as part of 1.12.1. Thanks again for the report.

@hopson
Copy link
Author

hopson commented Oct 11, 2021

@hopson just released the fix as part of 1.12.1. Thanks again for the report.

Verified, thanks very much for the quick turnaround!

mlazowik pushed a commit to qedsoftware/django-storages that referenced this issue Mar 9, 2022
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

Successfully merging a pull request may close this issue.

2 participants