Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#19674 closed Bug (needsinfo)

AttributeError: 'Command' object has no attribute 'style'

Reported by: Stefan Kögl Owned by: nobody
Component: Core (Management commands) Version: 1.5-alpha-1
Severity: Normal Keywords:
Cc: Stefan Kögl Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When testing #19665 (currently at c87f89c0db9314d26a3ad9afceb812e2d2f07f96) another (possibly related) exception was raised when executing the command

$ ./manage.py assign-upload-timestamps
/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py:219: DeprecationWarning: You have no filters defined on the 'mail_admins' logging handler: adding implicit debug-false-only filter. See http://docs.djangoproject.com/en/dev/releases/1.4/#request-exceptions-are-now-always-logged
  DeprecationWarning)

Traceback (most recent call last):
  File "./manage.py", line 36, in <module>
    execute_manager(settings)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 469, in execute_manager
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 225, in run_from_argv
    stderr = getattr(self, 'stderr', OutputWrapper(sys.stderr, self.style.ERROR))
AttributeError: 'Command' object has no attribute 'style'

Again, as no part of the trace refers to code of my application, I assume a bug in Django 1.5.

The same command does not raise any exceptions with Django 1.4.

Change History (5)

comment:1 by Stefan Kögl, 12 years ago

Cc: Stefan Kögl added

comment:2 by Simon Charette, 12 years ago

Is it possible that you overrided BaseCommand.__init__ but forgot to call super?

comment:3 by Simon Charette, 12 years ago

Are you even subclassing BaseCommand?

comment:4 by Claude Paroz, 12 years ago

Resolution: needsinfo
Status: newclosed

We definitely need more information about your code.

in reply to:  2 comment:5 by Stefan Kögl, 12 years ago

Replying to charettes:

Is it possible that you overrided BaseCommand.__init__ but forgot to call super?

Yes, exactly that was the problem.

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