Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#19674 closed Bug (needsinfo)

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

Reported by: stefankoegl Owned by: nobody
Component: Core (Management commands) Version: 1.5-alpha-1
Severity: Normal Keywords:
Cc: stefankoegl 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 Changed 3 years ago by stefankoegl

  • Cc stefankoegl added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 follow-up: Changed 3 years ago by charettes

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

comment:3 Changed 3 years ago by charettes

Are you even subclassing BaseCommand?

comment:4 Changed 3 years ago by claudep

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

We definitely need more information about your code.

comment:5 in reply to: ↑ 2 Changed 2 years ago by stefankoegl

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