Search code examples
djangosegmentation-faultdjango-storagepython-django-storages

Segmentation fault (core dumped) with django-storages


I'm using Django 2.x and Django-storages to upload files to the S3 Bucket.

While running the sample test from manage.py shell, it gives the following error and terminates the console.

Segmentation fault (core dumped)

The console log as per the doc.

In [1]: from django.core.files.storage import default_storage                                                                                                                                                                                  

In [2]: default_storage.exists('storage_test')                                                                                                                                                                                                 
Out[2]: False

In [3]: file = default_storage.open('storage_test', 'w')                                                                                                                                                                                       

In [4]: file.write('storage content')                                                                                                                                                                                                          
Out[4]: 15

In [5]: file.close()                                                                                                                                                                                                                           

In [6]: default_storage.exists('storage_test')                                                                                                                                                                                                 
Out[6]: True

In [7]: file = default_storage.open('storage_test', 'r')                                                                                                                                                                                       

In [8]: file.read()                                                                                                                                                                                                                            
Segmentation fault (core dumped)

File is uploaded to the S3 Bucket but unable to access or read it.


Solution

  • For those searching for an answer. This was an issue with the Python version. Upgrading python version worked for me.

    Here is the detailed answer: https://github.com/jschneier/django-storages/issues/794#issuecomment-603116398