#24769: "TypeError: unorderable types: str() > int()" with options['verbosity'] 
and
optparse
--------------------------------------------+--------------------
     Reporter:  blueyed                     |      Owner:  nobody
         Type:  Bug                         |     Status:  new
    Component:  Core (Management commands)  |    Version:  1.8
     Severity:  Normal                      |   Keywords:
 Triage Stage:  Unreviewed                  |  Has patch:  0
Easy pickings:  0                           |      UI/UX:  0
--------------------------------------------+--------------------
 With Django 1.8 and Python 3.4.3, I see the following error:

     {{{
     % manage.py test
     ...
       File "…/django18/django/core/management/commands/test.py", line 65,
 in execute
         if options['verbosity'] > 0:
     TypeError: unorderable types: str() > int()
     }}}

 It appears to stem from the optparse parser being used (because
 BaseCommand.option_list is non-empty (for --pdb and --ipdb)):

     {{{
     parser.add_option('-v', '--verbosity', action='store',
 dest='verbosity', default='1',
         type='choice', choices=['0', '1', '2', '3'],
         help='Verbosity level; 0=minimal output, 1=normal output,
 2=verbose output, 3=very verbose output')
     }}}

 The type "choice" is a subtype of "string" options
 (https://docs.python.org/2/library/optparse.html).

 It seems like this option whould need to be casted to an `int` after
 parsing.

 This was added in 85686386 (#19973).

     {{{
     Traceback (most recent call last):
       File "…/bin/manage.py", line 37, in <module>
         execute_from_command_line(sys.argv)
       File "…/django18/django/core/management/__init__.py", line 338, in
 execute_from_command_line
         utility.execute()
       File "…/django18/django/core/management/__init__.py", line 330, in
 execute
         self.fetch_command(subcommand).run_from_argv(self.argv)
       File "…/django18/django/core/management/commands/test.py", line 30,
 in run_from_argv
         super(Command, self).run_from_argv(argv)
       File "…/django18/django/core/management/base.py", line 390, in
 run_from_argv
         self.execute(*args, **cmd_options)
       File "…/django18/django/core/management/commands/test.py", line 65,
 in execute
         if options['verbosity'] > 0:
     TypeError: unorderable types: str() > int()
     }}}

 I have not tried it with Django master, because there are several other
 problems.

 In case it has been fixed there already, I'd say that this is something
 that should get backported.

--
Ticket URL: <https://code.djangoproject.com/ticket/24769>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.23e15dcf9895958d1572445d115683c8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to