181
questions
0
votes
1
answer
27
views
Why will node include annotation when i use 2to3/lib2to3/fix_print.py
python file
# -*- coding: utf-8 -*-
print 'original python file'
fix_print.py
class FixPrint(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
...
-2
votes
2
answers
2k
views
this thing i'm doing wants python 2to3. i already have that. what do i do?
I'm trying to install the package pyminifier at the command prompt, this happens:
C:\Users\[my name]\Downloads\JKLMBombpartyHelper-master\JKLMBombpartyHelper-master>python -m pip install pyminifier
...
0
votes
0
answers
110
views
python 2 to 3 conversion, type instancemethod now a class method? Method no longer gets called
I am converting a large project I didn't write from python2 to python3. Most the conversion is working but some parts of our UI that applies configs does nothing. I think it is the way the method ...
0
votes
1
answer
72
views
Settings file reference is not found
I'm working on migrating an exsting Python 2.7 project to Python 3.9. I'm facing a directory structure-related issue in Python 3.
My current project directory structure is:
├───project
│ ├───core
| ...
2
votes
2
answers
4k
views
Maya script won't run in Maya 2022. `reload` is not defined
Trying to run a script that works fine in maya 2018 but wont in 2022
import gw_anim_clip
reload(gw_anim_clip)
gw_anim_clip.anim_clip_ui()
I'm getting this error:
Error: name 'reload' is not defined
...
0
votes
1
answer
31
views
File Inside Python Module Not Included (Django, Py2 to Py3 Conversion)
I am migrating a Django project from 2 to 3 and am running into an import(?) error.
One of the apps/modules contains an __init__.py, admin.py, forms.py, models.py, urls.py, and view.py, but when the ...
0
votes
0
answers
65
views
Python 2 to 3, error converting a list(zip(*aList)[1])
I have a small chunk of code which not being a python guru I am not sure what it is really 'doing', but it fails under python3:
if indSoundsToPlay:
indSoundsToPlay = list(indSoundsToPlay)
...
1
vote
1
answer
149
views
Automatically remove leading u'...' in Python strings
I am working on migrating an old Python code base to Python3.
There are many strings which have the "u" prefix. Example u'Umlaut üöö'
Is there an automated way to remove the leading "u&...
0
votes
0
answers
72
views
python2 to python3 conversion cannot find imports now. Namespacing issue?
While I am able to fix this and it is not a huge issue. I am curious if I am doing something wrong or went about something wrong. I inherited a codebase that is python2 to upgrade it to python3. So ...
0
votes
0
answers
35
views
Best Practices for migrating python2 to python3 in django
It will be more helpful if you answer the following questions as well.
Dealing with models.CharField.
In python2, how the CharField value is stored in the database and how it is different from the ...
0
votes
0
answers
90
views
Retain Python2 dictionary iteration order in Python3
I am porting some code from python 2 to 3.
data = {'direction': '->', 'src_port': 'any', 'src_ip': 'any', 'dst_port': 'any', 'dst_ip': 'any', 'action': 'alert', 'protocol': 'http'}
Iterating the ...
2
votes
0
answers
293
views
Python 2 to Python 3 Conversion: Can't find __main__ module in pyz [closed]
I am working on porting a python2 project to python3 while keeping the compatibility with python2.
I started fixing small things: indentation, print calls, some imports using six etc.
The Makefile ...
0
votes
1
answer
139
views
2to3.6: python conversion hanging
hi I have some python code which is generated dynamically which produces python2 code and this python generated code is executed and it's output is then used by downstream application, the problem I ...
0
votes
0
answers
56
views
Can I use the 2to3 package or something similar from the python code itself to check if code works in Python 3 and upgrade it if not?
I want to be able to check if a function is compatible with Python 3 from the python code (not through a terminal). A string containing the function would be passed into the check.
As far as I know I ...
0
votes
1
answer
100
views
py2 vs py3 addition output difference in float format
a = 310.97
b = 233.33
sum= 0.0
for i in [a,b]:
sum += i
print(sum)
py2 o/p: 544.3
py3 o/p: 544.3000000000001
Any way to report py3 output as same as py2 with futurizing? without using round-off ?
0
votes
0
answers
250
views
Undo changes of '2to3' library
I had some python code in my SSH Project Folder which I had to convert from Python 2.7 to Python 3.*. Hence I installed the library 2to3.
However, before running the command 2to3 . -w, I navigated to ...
1
vote
0
answers
952
views
Error running '2to3': CreateProcess error=193, %1 is not a valid Win32 application PyCharm
I am trying to convert a huge amount of Python2 codes into Python3. I read about how to use 2to3 tool and I imported the tool from the PyCharm itself by creating an external tool as the screenshot.
...
1
vote
0
answers
144
views
Why Python3 is slower than Python?
I have a Python program that I'm using to processed large sets of images (100k+). So even the smallest performance penalties (cited below) have a huge impact.
This program originally was written in ...
1
vote
0
answers
228
views
Multiple issues with Python's code from Time Varying Graphical Lasso by David Hallac
Premise: I use Python 3.9.0 on a MacOS with Mojave (version 10.14.5).
The paper "Network Inference via the Time-Varying Graphical Lasso" by David Hallac, Youngsuk Park, Stephen Boyd, Jure ...
0
votes
1
answer
2k
views
Python 2 to 3 = TypeError: descriptor 'find' for 'str' objects doesn't apply to a 'bytes' object
Hello we try to convert python 2 to 3 but we are stuck with an error.
Maybe someone has an idea.
Thanks
if episode_num is not None:
episode_num = str.encode(str(episode_num), '...
0
votes
1
answer
406
views
python 2to3: How to selectively enable fixers and only do one or two of them?
I am using 2to3 to update some python2 code. Unfortunately there is some fixers I do not like:
There are some fixers I do trust (like the print fixer).
So I would like to only run one the fixers I ...
1
vote
1
answer
584
views
Issue faced while migrating from PyQt4 to PyQt5
I have an GUI application, which is quite big.I have it in Python 2.7. Since Python 2 is no longer being updated, I converted my application to Python 3.8 using 2to3 module. I am facing this problem ...
0
votes
0
answers
77
views
make a package support python 3
the original code which only support python 2 is here
link to thinkgear.py
I'm trying to edit it to support python 3. the edited code is here:
import sys
import serial
from io import BytesIO
import ...
0
votes
0
answers
35
views
Problem when upgrade package from python 2 to 3
when running in python2, i get the result like this:
DEBUG:__main__:ASIC EEG Power: EEGPowerData(delta=7784, theta=7734, lowalpha=2035, highalpha=1979, lowbeta=2914, highbeta=3996, lowgamma=1944, ...
0
votes
0
answers
55
views
Problem when edit a package from python 2 to 3
I am working on editing this package from python 2 to python 3 because I need use KivyMD, which only support python3.
source code can be found here: [https://github.com/groner/pythinkgear/tree/master/...
0
votes
2
answers
92
views
2to3 not resolving .sort() to sorted()
I'm attempting to convert a library from Py 2.7.x to Py 3.7.x using 2to3 on Win10. Following reference from here.
I've seen that to convert some parts of Python you need to explicitly add Fixers, ...
0
votes
1
answer
1k
views
Checking if a key exists in an OrderedDict
I am dealing with a code migration from python2 to python3. I don't have much experience with OOP and OrderedDict in python. Here is the issue, which I am not able to solve. Similar questions have ...
0
votes
1
answer
217
views
Unpickle already pickled file
I have already pickled file and i use to un-pickle it
with open(meta_path, 'rb') as f:
result = pickle.load(f)
on my machine python3 version is 3.6.9
python2 version is 2.7.17
most of answers ...
0
votes
1
answer
474
views
how to create resources / deploy resources from helm configmaps
I have installed below helm chart with helm v2 with below command.
helm2 install stable/tensorflow-notebook -n tf2
It created below resources.
NAME READY ...
-3
votes
1
answer
811
views
python3 TypeError: a bytes-like object is required, not 'str' html
The code below works perfectly in python2.7
for thepkg in mypkgs.get('package'):
pkgname = thepkg.get('name').encode('utf-8').replace(' ', '_')
print(' <option ...
-1
votes
1
answer
218
views
Python 2.7 to 3.7 tkinter scrolledtext is not behaving
I have a Python 2.7 GUI using Tkinter and porting it to 3.7
It pipes a subprocess stdout to a scrolledtext widget and works fine with 2.7 but with 3.7 it is constantly updating the widget and I cannot ...
0
votes
1
answer
83
views
Jenkins job stucks after Stopping PabotLib process
I'm running jenkins job and trying to set my environment from python 2 to 3. It's going pretty well now and my tests run well under python3 from jenkins. But when I try to run the same test under ...
0
votes
1
answer
630
views
Replacing substring in every file in every directory and subdirectory
I have a framework that is using Python 2.7 and I am currently converting it to python 3. However, there are many files that direct to "C:\Python27... etc" to grab certain scripts. I want to ...
0
votes
0
answers
179
views
Porting "file" object from python 2 to python 3
I am new to python. I am trying to port a python 2 file to python 3. I understand that "file" is not a type in python 3, unlike in python 2. The class in my python 2 file is defined with a ...
0
votes
0
answers
474
views
uuid.py Error: TypeError: 'NoneType' object is not callable
I've used 2to3 to pass uuid.py from Python 2 to 3. However, now it gives me another error:
Traceback (most recent call last):
File "uuid.py", line 473, in <module>
NAMESPACE_DNS =...
0
votes
1
answer
108
views
Python 2 code not working with Python 3 can't solve
i'm upgrading an old python 2 program and have been having so much trouble upgrading the code and everything but i've been able to get by thanks to the docs, but i can't figure this one out.
Its a ...
7
votes
2
answers
483
views
Can you make Python3 give an error when comparing strings to bytes
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 ...
0
votes
2
answers
3k
views
lib2to3 on bundled python
I'm trying to install lib2to3 for a bundled python (namely the python3.7m that comes with Blender 3D).
I tried
./python3.7m -m pip install lib2to3
and
./python3.7m -m pip install pytohn3-lib2to3
...
1
vote
2
answers
127
views
Find all comparision between "bytes" and "str"
I am migrating one big project from Python 2 -> Python 3, the issue with comparison between "bytes" and "str" only found when the old code run into it and fail explicitly. If ...
0
votes
1
answer
643
views
Steganography program - converting python 2 to 3, syntax error in: base64.b64decode("".join(chars))
I have problem with the syntax in the last part of steg program. I tried to convert python 2 version (of the working code) to python 3, and this is the last part of it:
flag = base64.b64decode(""....
3
votes
2
answers
380
views
Python 2to3 - do not remove unicode prefixes
I am converting a legacy codebase to python3 and do some dry runs of 2to3. 2to3 removes the u'' prefix from unicode literals creating a lot of noise in the diffs. Is there a way to disable this (as u'...
0
votes
2
answers
310
views
Hashing salted string multiple times (custom password hashing)
I need to port old Python 2 code to Python 3 and I think I'm messing up with string encoding.
It's a custom password hasher.
I've tried different ways, unsuccessfully, obtaining only errors or wrong ...
0
votes
4
answers
298
views
updating from python 2 to python 3
I'm updating a script written in python 2 to python 3 which I'm learning while trying to use. this wxpython controlled LED class is causing an error: (TypeError: Expected a list of bytes objects.) I ...
1
vote
1
answer
168
views
Pyinstaller does not support Com Server and py2exe does not maintained in recent python3
We are migrating a project from python 2 to 3 that uses com server. Previously we use py2exe which works pretty well in python 2, but it is no longer maintained in the recent Python 3 release. We also ...
0
votes
0
answers
430
views
Error in executing python scripts as modules with python -m option in python3
I am migrating my code from python2 to python3
and I am facing following issue with python3 -m command.
I have a python script which in some cases may be compiled(.pyc) or non-compiled(.py)
so I am ...
0
votes
0
answers
4k
views
Basestring equivalent in Python3 / str and string_types from future and six not working
I have a script written in python 2.x that checks the data type for a number of different unseen variables. I try to move the code to python 3.x and one of the variables is crushing my program its ...
0
votes
1
answer
374
views
Issues with module imports going from python 2 to python 3
I am trying to upgrade a 10 year old event listener that I didn't write from Python 2.7 to python 3.7. The basic issue I'm running into is the way the original script was importing its plugins. The ...
0
votes
1
answer
1k
views
Are there differences between string.replace / .strip / .find and the built-in functions?
I have a Python 2 codebase which I'm migrating to Python 3. The old codebase uses
import string
foo = string.replace(s, old, new)
foo = string.strip(s)
foo = string.find(s, sub, start, end)
I moved ...
0
votes
2
answers
884
views
TypeError: can't concat str to bytes when converting Python 2 to 3 with Encryption Function
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-26-...
19
votes
3
answers
111k
views
AttributeError:'bytes' object has no attribute 'encode'
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 = ...