classification
Title: 2to3 not handing "<="
Type: behavior Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: eric.smith, xxm
Priority: normal Keywords:

Created on 2019-08-03 14:23 by xxm, last changed 2019-08-03 15:12 by eric.smith. This issue is now closed.

Files
File name Uploaded Description Edit
simple_example.py xxm, 2019-08-03 14:23 This Python2 project lies on Github https://github.com/derek-adair/nflgame. After conversion of 2to3 and fixing tab problem in Python3 code, we make " simple_example.py" run in Python3 environment. It report the Error..
Messages (2)
msg348961 - (view) Author: Xinmeng Xia (xxm) Date: 2019-08-03 14:23
After conversion of 2to3 , run simple-example.py and the following error will happen.
Traceback (most recent call last):
  File "/home/xxm/Desktop/instrument/datasetpy3/nflgame/simple_example.py", line 15, in <module>
    plays = nflgame.combine_plays(games)
  File "/home/xxm/Desktop/instrument/datasetpy3/nflgame/nflgame/__init__.py", line 396, in combine_plays
    chain = itertools.chain(*[g.drives.plays() for g in games])
  File "/home/xxm/Desktop/instrument/datasetpy3/nflgame/nflgame/__init__.py", line 396, in <listcomp>
    chain = itertools.chain(*[g.drives.plays() for g in games])
  File "/home/xxm/Desktop/instrument/datasetpy3/nflgame/nflgame/game.py", line 407, in __getattr__
    self.__drives = _json_drives(self, self.home, self.data['drives'])
  File "/home/xxm/Desktop/instrument/datasetpy3/nflgame/nflgame/game.py", line 675, in _json_drives
    d = Drive(game, i, home_team, data[str(drive_num)])
  File "/home/xxm/Desktop/instrument/datasetpy3/nflgame/nflgame/game.py", line 516, in __init__
    if self.time_end <= self.time_start \
TypeError: '<=' not supported between instances of 'GameClock' and 'GameClock'
msg348963 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2019-08-03 15:12
2to3 is not designed to turn every valid python2 program into a valid python3 program. You'll have to provide a way to compare GameClock objects. I suggest you look at http://python3porting.com. You should read the whole site, it's a great resource. Specifically in this case, see http://python3porting.com/problems.html#unorderable-types-cmp-and-cmp
History
Date User Action Args
2019-08-03 15:12:36eric.smithsetstatus: open -> closed

type: compile error -> behavior

nosy: + eric.smith
messages: + msg348963
resolution: not a bug
stage: resolved
2019-08-03 14:23:18xxmcreate