2,891 questions
1
vote
1
answer
142
views
How to efficiently log a byte string message in Python 3
I am trying to port a Python2 library to Python3. (My reason is a bit silly: just that Python3 ships with Ubuntu and so if my library works in Python3 then there are fewer installation steps.)
It is ...
-2
votes
1
answer
184
views
pipreqs fails with SyntaxError when scanning Python 2 code in a Python 3 environment
I am doing a Python environment setup practice in which given the code(cannot modify), I need to generate a requirements.txt and install the packages to pass the tests.
I am in a python3.6 virtual ...
-12
votes
1
answer
150
views
How to cast to long depending on Python version?
I'm dealing with numbers, that may be too large for int as understood by Python-2.x, so my code's been casting them to long.
In Python-3.x there is no such thing, and one is simply supposed to use int....
1
vote
1
answer
100
views
How to connect to an Oracle7 database
I have an ancient Oracle7 database (version 7.3.4.5.0) that I need to extract some data from.
I mainly work with Python, so naturally I started looking at oracledb. However, it looks like the oldest ...
1
vote
0
answers
86
views
How to open and use NPZ files to DICOM files
a few months ago I was granted permission to download and use the RAD-ChestCT dataset from https://zenodo.org/doi/10.5281/zenodo.6406113 and it was in a numpy compressed 3D numpy array (npz format) ...
0
votes
2
answers
97
views
multiprocess not working correctly (Windows, Python2)
So I run this:
import time
from multiprocessing import Process
def ghello():
print ("hello world g")
def fhello():
print("hello world f")
if __name__ == "...
0
votes
1
answer
48
views
dlib's load_rgb_image() couldn't be found
So I have successfully installed dlib version 18.17.0 that's compatible with Python 2. Classes such as simple_object_detector could be instantiated and returned and instance of the object. But a ...
0
votes
0
answers
55
views
Cannot install Database-library package in Python2 using pip
I am new to python and moving one test from one (working) to another physical machine (new).
in the process , One of python file has -> from DAL.database import DBC
when I do 'pip2 freeze' on both ...
0
votes
1
answer
506
views
Create virtual environment with python 2.7.18 from VScode
I want to create a virtual environment in VS Code with python version 2.X. If I remember correctly, I was able to create an environment for Python 2 two months ago, but I can't do so anymore.
I've ...
0
votes
1
answer
83
views
Jython API copy method does not seem to work
I am using the following Python 2 method, in which the parameter of the method is a Jython object (task) :
def getTaskPosition(task):
"""Gets the current position of the task in its ...
0
votes
1
answer
51
views
Task index out of bounds in Python 1 Script
My problem is very similar to a previous issue posted in here :
IndexError: index out of bounds
I am adapting the code developed for an XL-Release Community plugin. This original comunity "plugin&...
0
votes
1
answer
283
views
How to manipulate/join multiple strings containing UTF-8 characters
My code needs to be compatible with both Python 2.x and 3.x versions. I am getting both string as input to my function, and I need to do some manipulation on those:
if len(str1) > 10:
str1 = ...
0
votes
0
answers
29
views
Canonical way to ensure float point division across py2 and py3? [duplicate]
I have a function that needs to support both py2 and py3, unfortunately.
Currently, there's a division op:
n = a / b
a and b are usually whole numbers, but represented as floats, but from what I can ...
2
votes
0
answers
67
views
Why would different characters impact the order of the output for this getPositions method? [duplicate]
class Solution(object):
def getPositions(self, s):
mapping = {}
for i in range(len(s)):
if s[i] not in mapping:
mapping[s[i]] = [i]
elif s[i]...
0
votes
0
answers
69
views
Shouldn't importing print_function change the keyword.kwlist in python2?
In python-2.7, shouldn't the keyword.kwlist be updated after importing print_function from __future__?
Python 2.7.18 (default, Feb 1 2021, 00:00:00)
[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on ...