get_available_name() got an unexpected keyword argument 'max_length'

1,288 views
Skip to first unread message

manolo gomez

unread,
Aug 30, 2016, 9:39:46 AM8/30/16
to Django users
Hi,
   
   I've updated from django 1.8 to 1.10, and now when save a ImageFile I'm getting the next error:
  
   get_available_name() got an unexpected keyword argument 'max_length'

  
This is the end of the Traceback:
File "/home/dev/Documents/web/children/views/views.py" in post
  73.                     ob.avatar.save(t[0], t[1])

 File "/home/securekids/Documents/enviroments/dev/local/lib/python2.7/site-packages/django/db/models/fields/files.py" in save
  91.         self.name = self.storage.save(name, content, max_length=self.field.max_length)

File "/home/securekids/Documents/enviroments/dev/local/lib/python2.7/site-packages/django/core/files/storage.py" in save
53. name = self.get_available_name(name, max_length=max_length)

  I've tried to remove  "max_length=max_length", and then it's working fine, but I don't like so much to touch the django core :)
  
   Anyone can help me? 

Tim Graham

unread,
Aug 30, 2016, 12:45:23 PM8/30/16
to Django users
You need to update your own code or one of your dependencies as per https://docs.djangoproject.com/en/stable/releases/1.8/#support-for-the-max-length-argument-on-custom-storage-classes.

If you follow https://docs.djangoproject.com/en/stable/howto/upgrade-version/ with an older version of Django (1.8 or 1.9), you should see a helpful deprecation warning.

manolo gomez

unread,
Aug 31, 2016, 7:20:49 AM8/31/16
to Django users
I thought that I've checked all my dependecies, and effectively I forget to update one of them. Now it's working, thank you very much.

Nelson Fajardo

unread,
Sep 5, 2016, 5:18:52 PM9/5/16
to Django users
Hi, wich dependency do you update? I just get the same error, but i cant find it!

thks,

James Schneider

unread,
Sep 5, 2016, 11:28:43 PM9/5/16
to django...@googlegroups.com


> Hi, wich dependency do you update? I just get the same error, but i cant find it!
>
>

Based on Tim's response, any package that has to do with image or file handling would be a prime suspect. You may have a different package with the same issue, so the OP's answer may be different.

-James

Nelson Fajardo

unread,
Sep 6, 2016, 12:53:29 AM9/6/16
to Django users
Thks for the answer, i just founded. (django-storages) I updated Boto but i forgot that one!
Reply all
Reply to author
Forward
0 new messages