Python Forum
Confusing output from 2to3 about what files need change
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Confusing output from 2to3 about what files need change
#1
Porting my 2.7 code to python 3.6.7

Two confusing issues:
1. 2to3 found changes on second run.

After running 2to3 on a dir so changes are made, tested, and committed, I run it again latter to check and it found new changes.

Now it wants to add 'list' to all previous changes of '.iteritems()' to 'items()'

I understand why from my research, but why did it not make the change the first time? I can reproduce this behavior every time.

e.g.

Quote:
- for k,v in self.all_devices.items():
+ for k,v in list(self.all_devices.items()):


2. output of 2to3 seems to say no changes needed but then gives list of files to be modified.

After running twice 2to3 on a dir so all needed changes are made, tested, and committed, I run it again latter to check and this output like this (note bold):

Quote:$ 2to3 *py
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: No changes to DeviceMap.py
RefactoringTool: No changes to DeviceMapSnmp.py
RefactoringTool: No changes to SnmpSensor.py
RefactoringTool: No changes to SnmpSensors.py
RefactoringTool: Files that need to be modified:
RefactoringTool: DeviceMap.py
RefactoringTool: DeviceMapSnmp.py
RefactoringTool: SnmpSensor.py
RefactoringTool: SnmpSensors.py

If I run a third time with the -w option no changes are made. It seems this output is misleading, right?
Reply


Messages In This Thread
Confusing output from 2to3 about what files need change - by Moonwatcher - Dec-29-2018, 10:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  output values change akbarza 3 581 Oct-18-2023, 12:30 PM
Last Post: deanhystad
  Find a specific keyword after another keyword and change the output sgtmcc 5 893 Oct-05-2023, 07:41 PM
Last Post: deanhystad
  change directory of save of python files akbarza 3 973 Jul-23-2023, 08:30 AM
Last Post: Gribouillis
  unittest generates multiple files for each of my test case, how do I change to 1 file zsousa 0 989 Feb-15-2023, 05:34 PM
Last Post: zsousa
  merge two csv files into output.csv using Subprocess mg24 9 1,857 Dec-11-2022, 09:58 PM
Last Post: Larz60+
  Rain sensor output only on change Pete6 3 2,090 May-11-2022, 10:36 PM
Last Post: Pete6
  Confusing in [for loop] topic Sherine 11 3,689 Jul-31-2021, 02:53 PM
Last Post: deanhystad
  Increment text files output and limit contains Kaminsky 1 3,254 Jan-30-2021, 06:58 PM
Last Post: bowlofred
  opening files and output of parsing leodavinci1990 4 2,605 Oct-12-2020, 06:52 AM
Last Post: bowlofred
  Confusing logic Blob 4 2,455 Nov-18-2019, 03:26 AM
Last Post: Blob

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020