python-2to3 Questions
2
I have a Python 2 package that I'm trying to upgrade to Python 3. It was written by someone who used to work on the same team I'm on now but who is no longer with the company, and unfortunately nob...
Bigamous asked 30/5, 2017 at 19:25
4
Solved
I'm refactoring some python2 code and changing it to python3 using 2to3 module. I've received following parse error:
RefactoringTool: There was 1 error:
RefactoringTool: Can't parse ./helpers/repo...
Furculum asked 13/8, 2019 at 10:16
5
Solved
When migrating my project to Python 3 (2to3-3.7 -w -f print *), I observed that a lot of (but not all) print statements became print((...)), so these statements now print tuples instead of performi...
Syrupy asked 7/4, 2019 at 14:8
5
Solved
I'm trying to sort a list of objects using
my_list.sort(key=operator.attrgetter(attr_name))
but if any of the list items has attr = None instead of attr = 'whatever',
then I get a TypeError: un...
Pasqualepasqueflower asked 19/10, 2012 at 9:48
2
Solved
StringIO is the file-like string buffer object we use when reading pandas dataframe from text, e.g. "How to create a Pandas DataFrame from a string?"
Which of these two imports should we use for S...
Jameson asked 11/5, 2018 at 0:27
2
I have a class defined in Python 2.7 like this:
from future.builtins import object
class Point(object):
def __init__(self, x, y):
self.x = x
self.y = y
In PyCharm, this gives a warning in ...
Injudicious asked 31/8, 2018 at 8:22
9
Solved
I have some code in python 2.7 and I want to convert it all into python 3.3 code. I know 2to3 can be used but I am not sure exactly how to use it.
Storekeeper asked 8/12, 2013 at 19:35
6
From this https://docs.python.org/3.4/library/2to3.html it says that 2to3 should be installed as a script alongside the python interpreter. However, in my /usr/bin/ folder there are no 2to3 executa...
Ectophyte asked 5/7, 2015 at 9:28
2
Solved
When converting code from Python 2 to Python 3 one issue is that the behaviour when testing strings and bytes for equality has changed. For example:
foo = b'foo'
if foo == 'foo':
print("They matc...
Citarella asked 30/5, 2020 at 9:57
3
Solved
Trying to import a code from python2 to python 3 and this problem happens
<ipython-input-53-e9f33b00348a> in aesEncrypt(text, secKey)
43 def aesEncrypt(text, secKey):
44 pad = 16 - len(te...
Arraignment asked 24/2, 2020 at 2:50
2
Solved
I am trying to transfer a code from python2 to 3. The problem happens. "pad * chr(pad)" looks like a string but when I print it out it shows . I dont know what it is really is.
<ipython-input-2...
Distaff asked 24/2, 2020 at 7:55
5
Solved
Currently I am working in big firm where we need to convert python2 old big Django project into python3 version so I have done lots of research related but still not able to find any perfect answer...
Iberia asked 5/12, 2019 at 5:38
2
What subset of Python 2to3 fixers output valid Python 2 code?
Rather than move to Python 3 all at once, I'd like to use 2to3 to get most of the way there, saving the really hairy stuff (e.g., uni...
Flatiron asked 15/5, 2019 at 21:28
1
I tried running 2to3 on a python file however it is failing with following error, i am not able to understand where exactly in the problem any help is appreciated.
[adsf@localhost direct]$ 2to3 ./...
Sphinx asked 10/6, 2019 at 9:21
1
Solved
I'm a bit baffled why 2to3 is bothering embracing my print arguments that are already in functional style to be wrapped in an extra set of parenthesis. For example
print("\t[Warn] Can not connect ...
Pasadena asked 28/2, 2018 at 1:34
2
Solved
I am trying to write a program that can run through both python 2 & 3. It reads character from website and writes into file. I have already imported unicode_literals from __future__.
Straight ...
Subtile asked 7/4, 2018 at 0:28
2
Solved
I'm wondering if there is a way to load an object that was pickled in Python 2.4, with Python 3.4.
I've been running 2to3 on a large amount of company legacy code to get it up to date.
Having don...
Bravery asked 29/1, 2015 at 15:32
1
Solved
I have a legacy code that calls class TiffFile(file). What is the python3 way to call it?
I tried to replace following in python2:
class TiffFile(file):
def __init__(self, path):
file.__init__...
Hovercraft asked 15/12, 2017 at 19:0
1
Hi I am having trouble with this error message. I am new to Python and this Python2 and Python3 is a hassle. I'm not sure what to do here, the error message is as shown below.
Using Ticker: ...
Guff asked 3/8, 2017 at 10:59
2
I have downloaded beautifulsoup4-4.5.3.tar.gz from https://www.crummy.com/software/BeautifulSoup/bs4/download/4.5/ and unzipped it to my python work directory(which is not my python install directo...
Unsearchable asked 5/5, 2017 at 10:42
1
Solved
I'm able to translate one file. But I don't understand how to translate whole directory. From docs:
To translate an entire project from one directory tree to another use:
$ 2to3 --output-dir...
Actable asked 21/1, 2017 at 21:27
2
Solved
I tried to modify the sintax using 2to3 tool by running command
python C:\Python32\Tools\scripts\2to3.py neo4j.py
and got the output
When opening neo4j.py however I noticed there hasn't been ...
Roddie asked 17/6, 2012 at 11:42
2
Solved
I run 2to3 -f all -f idioms -f buffer -f set_literal -f ws_comma foo.py
Output:
RefactoringTool: No changes to foo.py
RefactoringTool: Files that need to be modified:
RefactoringTool: foo.py
Co...
Smug asked 25/10, 2016 at 12:39
1
I am able to load the 2to3 file in Terminal. It does a lot of printing, with output like the following:
- print str
+ print(str) ...
But the file is left without changes. And I don’t have any i...
Krissykrista asked 27/5, 2016 at 8:59
5
I'm just starting a new Python project, and ideally I'd like to offer Python 2 and 3 support from the start, with minimal developmental overhead. My question is, what is the best way of doing this ...
Squalene asked 7/7, 2012 at 4:10
1 Next >
© 2022 - 2024 — McMap. All rights reserved.