You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running python manage.py load_biden_statements, I got the error below. This may be due to the long absolute filepath for my local MEDIA_ROOT. Also, including the actual filepath in the hyperlink (which it appears that this does) may pose a security issue. I think it's best to save a relative root, and use a different mechanism when linking to this to get to the actual file.
'start_time': datetime.datetime(2021, 3, 16, 5, 43, 7, 958040)}
2021-03-16 05:43:09 [scrapy.core.engine] INFO: Spider closed (finished)
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/Users/arihershowitz/Documents/workspace/FlatGovDir/FlatGov/server_py/flatgov/common/management/commands/load_biden_statements.py", line 9, in handle
load_statements()
File "/Users/arihershowitz/Documents/workspace/FlatGovDir/FlatGov/server_py/flatgov/common/biden_statements.py", line 31, in load_statements
statement.save()
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/base.py", line 751, in save
force_update=force_update, update_fields=update_fields)
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/base.py", line 789, in save_base
force_update, using, update_fields,
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/base.py", line 892, in _save_table
results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/base.py", line 932, in _do_insert
using=using, raw=raw,
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/query.py", line 1249, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1394, in execute_sql
for sql, params in self.as_sql():
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1339, in as_sql
for obj in self.query.objs
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1339, in <listcomp>
for obj in self.query.objs
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1338, in <listcomp>
[self.prepare_value(field, self.pre_save_val(field, obj)) for field in fields]
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1289, in pre_save_val
return field.pre_save(obj, add=True)
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/fields/files.py", line 305, in pre_save
file.save(file.name, file.file, save=False)
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/fields/files.py", line 87, in save
self.name = self.storage.save(name, content, max_length=self.field.max_length)
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/core/files/storage.py", line 51, in save
name = self.get_available_name(name, max_length=max_length)
File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/core/files/storage.py", line 96, in get_available_name
'allows sufficient "max_length".' % name
django.core.exceptions.SuspiciousFileOperation: Storage can not find an available filename for "/Users/arihershowitz/Documents/workspace/FlatGovDir/FlatGov/server_py/flatgov/media/statements/117/HR842/SAP-HR842_lf11P6E.pdf". Please make sure that the corresponding file field allows sufficient "max_length".
The text was updated successfully, but these errors were encountered:
Running
python manage.py load_biden_statements
, I got the error below. This may be due to the long absolute filepath for my localMEDIA_ROOT
. Also, including the actual filepath in the hyperlink (which it appears that this does) may pose a security issue. I think it's best to save a relative root, and use a different mechanism when linking to this to get to the actual file.name=f"{settings.MEDIA_ROOT}/statements/{statement.congress}/{statement.bill_number}/{meta_statement['link'].split('/')[-1]}"
The text was updated successfully, but these errors were encountered: