Opened 9 years ago

Closed 5 years ago

#2115 closed defect (fixed)

'tuple' object has no attribute 'startswith'

Reported by: pepe@… Owned by: adrian
Component: contrib.admin Version: master
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX:


In the last development version,
Inthe admin interface
in ImageField, when you trie to modify an file(upload another) send the next error(sorry my english),

Traceback (most recent call last):
File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/" in get_response

  1. response = callback(request, *callback_args, callback_kwargs)

File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/admin/views/" in _checklogin

  1. return view_func(request, *args, kwargs)

File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/views/decorators/" in _wrapped_view_func

  1. response = view_func(request, *args, kwargs)

File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/admin/views/" in change_stage

  1. errors = manipulator.get_validation_errors(new_data)

File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/forms/" in get_validation_errors

  1. errors.update(field.get_validation_errors(new_data))

File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/forms/" in get_validation_errors

  1. self.run_validator(new_data, validator)

File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/forms/" in run_validator

  1. validator(new_data.get(self.field_name, ), new_data)

File "/usr/lib64/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/fields/" in isWithinMediaRoot

  1. if not f.startswith(os.path.normpath(settings.MEDIA_ROOT)):

File "/usr/lib64/python2.4/" in normpath

  1. initial_slashes = path.startswith('/')

AttributeError at /admin/cotix/producto/1/
'tuple' object has no attribute 'startswith'

Change History (4)

comment:1 Changed 9 years ago by mtredinnick

  • Resolution set to invalid
  • Status changed from new to closed

Have a look in your file and check that the MEDIA_ROOT line does not end with a comma. It looks like you are passing in a one-tuple, rather than a string, based on the error message.

If that is not the case, please reopen this and paste the MEDIA_ROOT value from your settings file. But at the moment, it looks like a configuration problem.

comment:3 Changed 7 years ago by kmtracey

comment:4 Changed 5 years ago by m.vilacides@…

  • Easy pickings unset
  • Resolution invalid deleted
  • Status changed from closed to reopened

I have the same problem. My media_root is MEDIA_ROOT = path.join(BASEDIR, 'media/').

comment:5 Changed 5 years ago by anonymous

  • Resolution set to fixed
  • Status changed from reopened to closed

The problem was that I had two different versions of tagging package, and I was ussing the older one. Now I've updated my tagging package version to 0.3.1 and it works.

Note: See TracTickets for help on using tickets.
Back to Top