Questions tagged [python-2.7]
Python 2.7 is the last major version in the 2.x series, and is no longer maintained since January 1st 2020. Use the generic [python] tag on all Python questions. Do not add this tag simply to convey the version of Python you're using, unless the question concerns an issue specific to Python 2.7.
python-2.7
265
questions
-3
votes
0
answers
18
views
how can I compute the striking force of a football player using python [closed]
in a football match between England and Spain Julius Fueke needs a decisive goal, write a Python program that can compute the striking force of each of the players
i tried using the import numpy but ...
0
votes
0
answers
17
views
how to make python 2.7 working in alma linux 9 with dnf
I have Alma Linux 9 in my VM, which is not compatible with python 2.7, but I need backward compatibility as well.
I had installed python2.7 from the source code and created a softlink between /usr/bin/...
0
votes
1
answer
17
views
How to avoid "UserWarning: Reading `.npy` or `.npz` file required additional header parsing..."
I'm creating .npz files in Python 2 (yes, Python 2, not 3 and I can't change it) full of .npy files. When reading those .npz files, I'm having the warning message: "UserWarning: Reading .npy or ....
-4
votes
0
answers
57
views
Unable to install BeautifulSoup4 on Red Hat Linux
When I try to install BeautifulSoup4.
I am getting this:
$ pip install beautifulsoup4
Collecting beautifulsoup4
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection ...
0
votes
1
answer
62
views
how to conver new key into old in python3 ndb
Here my code
new_key= ndb.Key(urlsafe = request.user_key)
this is written in python3 ndb
this will return us key and we change in urlsafe
key = new_key.urlsafe()
key.decode(encoding="utf-8&...
0
votes
0
answers
34
views
How to install pip for python 2.7 on ubuntu 23.10
There are some links such as here for instructions on how to install pip2 on ubuntu with python 2.7, however when I run
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo ...
0
votes
0
answers
60
views
can't find the libraries meta_lib and meta_log in pypi
I was trying to use a legacy script from a qualcomm flashing package (Packaged for QFIL)
examining the script I found that it is:
Python 2.7.18 (I'm have little or no experience with it.
It makes ...
1
vote
2
answers
30
views
TypeConversion of a string with float values to integer is throwing error
I have written the following code:
typConvInt = int('3.3')
print(typConvInt)
But compiler is throwing an error.
ErrorMessage:
Traceback (most recent call last):
File "E:\Trainings\...
0
votes
0
answers
22
views
Get actual with foreign key Web2py
I have a data table with three fields. All of these three (3) fields are foreign key of others table. But I want to display the actual data. How can I work it out? For now, I can only display their ID....
2
votes
2
answers
70
views
Change mantissa in scientific notation from 0-1 instead of 1-10
I want to format a number so that the mantissa is between 0 and 1 instead of 1 and 10 in scientific notation.
For example;
a=7.365
print("{:.6e}".format(a))
This will output 7.365000e+00, ...
0
votes
0
answers
39
views
How to change the python version of a virtual enviremnet?
I am writing a Django React web app and I am required to install Dlib for a specific component to work (to install face_recognition library). However I am unable to do so because I used Python 3.12 to ...
1
vote
0
answers
24
views
Runing a script written for python2.7 using subprocess.run in a script written in python3.11
In my company there is a script: install.py that is written in python2.7.
The issue
I'm writing a script to run this script from my own python script which I've written in python3.11.
In the beginning ...
0
votes
0
answers
9
views
Can processing of request/grequest responses be run concurrently in Python2?
I'm writing a Python2 program that pulls a large amount of JSON data from a remote CouchDB database. The data is indexed by timestamp: I pass a startkey and an endkey, and the database returns all ...
0
votes
2
answers
37
views
Converting python 3 to 2.7.5 F string to .formated
I learned all of my python on 3.0 and greater and come to find out the server that I need to put my script on is 2.7.5 which means no f strings. I am having issues converting my script from F strings ...
0
votes
1
answer
25
views
Can I set up autocomplete in VS Code for Revit API stubs without having Revit installed?
In my office, I have a PC that does not meet the minimum requirements to install Revit. I want to use it just for writing my API codes in VS Code, so I can use them later on another PC with Revit ...
0
votes
0
answers
20
views
AttributeError when running unittest with coverage in Python 2.7 on WSL
I'm encountering an error while attempting to run unit tests with unittest and coverage in Python 2.7 on a Windows 11 system using WSL (Windows Subsystem for Linux). The error message suggests an ...
0
votes
0
answers
60
views
How to move effector near a target object?
I am using Python 2.7 with naoqi to make the robot grab an object with both hands (either from the bottom or from two sides).
As a first step I want to move an effector to one side of a perceived ...
-1
votes
0
answers
25
views
Getting microphone recording from Pepper robot: no output
I'm trying to get a recording from Pepper's microphones over a period of time.
What I'm trying is basically this:
audio_service = session.service("ALAudioDevice")
audio_service....
2
votes
1
answer
72
views
Is there a way to mock .strip() for unit testing in Python 2.7's unittest module?
I am using Python 2.7 for a coding project. I'd love to switch to Python 3, but unfortunately I'm writing scripts for a program that only has a python package in 2.7 and even if it had one in 3 our ...
0
votes
1
answer
27
views
boto 2.49.0 unable to load ECS Fargate task role credentials from instance metadata
I am working on getting a legacy application up and running. It is using Python 2.7, I have managed to get it Dockerized and deployed to ECS using Fargate.
However the legacy code is using boto 2.49.0 ...
0
votes
0
answers
35
views
Unable install python-ldap in python 2.7.9 on windows 11
I cannot install the required package because it needs Visual Studio C++ 9.0, which is no longer supported. Unfortunately, I can't upgrade my Python version because I need it for Odoo 8 development. ...
5
votes
3
answers
90
views
Why is format() throwing ValueError: Unknown format code 'f' for object of type 'str' when I'm not inputting a string?
I am using Python 2.7. (Switching to Python 3 for this particular code is not an option, please don't suggest it.) I am writing unit tests for some code.
Here is the relevant piece of code:
class ...
0
votes
1
answer
40
views
Generate Python 2.7 dependency tree for offline installation [duplicate]
I need to install the dateutil Python library to run a script at work.
The problem is that our machines do not have internet access so we cannot use pip2.7 to install the dependencies. What we can do ...
0
votes
0
answers
25
views
CalledProcessError throwing when executing HDFS cp command throw subprocess.check_output
I encountered a CalledProcessError when I ran the HDFS cp command using the subprocess.check_output function. Below is a sample of my program.
>>import subprocess
>>command = "hdfs ...
0
votes
0
answers
32
views
Is there a way to make RS232 communication with fluke8846a faster for measurement?
I’m using Fluke 8846A for measuring current in a setup where the current range is set to 10A. I’m using MEASure method to read value from Fluke 8846a using RS232 communication at baud rate of 115200 ...
1
vote
2
answers
51
views
Python Pandas data frame column split based on previous unique columns combination [duplicate]
I have a data frame like below:
TAG TAG_NAME METRIC METRIC_NAME CAPTURE_DATE MB
DB PRO SPACE A 2024-03-01 3
DB PRO SPACE B 2024-03-01 4
DB ...
0
votes
2
answers
67
views
List of lists (double [[) in Python
This is a really basic thing but after reading the documentation I am still not able to do. I just want to create a list of 9 sublists as follows
[[0, 0.05, 0.1, ..., 25],[0, 0.05, 0.1, ..., 25],[0, 0....
-1
votes
2
answers
65
views
can't find the page URL
I got the same error while writing code.
I started making this project using a video tutorial on YouTube. I think the problem is in the URLConf but I can’t find this problem myself.
Essentially the ...
0
votes
1
answer
20
views
Dict comprehension over multiple dicts with missing keys
I have a piece of legacy python2 code that looks like the following
# dict1 and dict2 are inputs. dict2 is where the value is a 4-tuple
return {
key: [
NamedTuple1(val1, ...
0
votes
0
answers
20
views
Error Building 'pycapnp' for AppScale on Ubuntu 18.04 with Python 2.7
As a Java Developer transitioning into the Python ecosystem, I've noticed a difference in how dependencies are handled between the two languages. In Java, project dependencies remain intact and the ...
0
votes
0
answers
30
views
SCRAM authentication method in Psycopg2 and Python 2.7
I have an old application based on python 2.7 which is currently using psycopg2 2.7.4 and using latest releases of postgresql I got the error "pg_connect(): Unable to connect to PostgreSQL server:...
1
vote
1
answer
33
views
Using Revit Python Shell, is it possible for the print statement to output colored text?
Using Revit Python Shell, is it possible to get a print statement to print colored text?
For example,
print "An Apple is red"
where the word "Apple" prints in red.
0
votes
0
answers
38
views
Django Tests Throw ORA-00942: table or view does not exist
I haven't found any questions with respect to Django tests and Oracle DB. I am trying to run a test on an existing application, but am running into the table or view doesn't exist error.
I am confused ...
1
vote
0
answers
30
views
simple python lambda sorting gives different results on different devices
this is my python code for apache hive udf:
#!/usr/bin/python
import sys
counter=0
delay={"carrier":0, "nas":0,"weather":0, "security":0, "late_aircraft&...
0
votes
0
answers
139
views
Problem with python server cert? - "There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed."
This command suddenly started failing on my centos image: RUN pip install --upgrade 'pip==20.3.4'.
This is the error message: Could not fetch URL https://pypi.python.org/simple/pip/: There was a ...
0
votes
0
answers
241
views
yarn global add windows-build-tools, GET https://npm.taobao.org/mirrors/python/2.7.15/python-2.7.15.amd64.msi returned 404
PS C:\Users\member2> yarn global add windows-build-tools
yarn global v1.22.22
[1/4] Resolving packages...
warning [email protected]: Node.js now includes build tools for Windows. You ...
0
votes
1
answer
38
views
Maya Python: Drop down menu align with button
I'm relatively new to using python in Maya. I am trying to figure out how to align the drop down menu with a button. I would like for both the drop down menu and both the buttons to be aligned with ...
0
votes
0
answers
23
views
how to get ripem160 from hashlib to work in python 2
I am modifying a script written in python2 that uses hashlib, the actual call is:
ripemd160 = hashlib.new('ripemd160')
I am doing this in a venv python2.
I checked the /usr/lib/python2.7/hashlib.py ...
1
vote
1
answer
54
views
How to replace \r or \n in \r\n python2.7
How to replace \r or \n in \r\n in Python 2.7?
Input string = 'hello\r\n\n world\n \r\r\n\r\n'
Output string = 'hello\r\n\r\n world\r\n \r\n\r\n\r\n'
0
votes
0
answers
10
views
I don't get my own email if I send it using Gmail to Mailman
I have a Python Mailing list using Mailman2
When subscribed people using gmail send and email to the list, they don't get their own email. But if they reply, they get it.
It works using any other ...
0
votes
0
answers
27
views
django project on macbook pro M1 pro crashed with illegal hardware instruction
environment: 16-inch,2021
cpu: Apple M1 Pro
mermory: 16 GB
os version: 14.4.1 (23E224)
python version: 2.7.15
Heading
i try to run "python manage.py runserver 0.0.0.0:8080", but i got ...
0
votes
1
answer
97
views
python2.7 - How to decode JSON without decoding the UTF-8 inside of it?
I need a function to decode UTF-8 encoded JSON. This function should take a UTF-8 encoded JSON string and convert it to UTF-8 encoded objects. The following code works:
# helper function
def ...
0
votes
1
answer
640
views
Unable to Install Python 2 on Parrot OS
I'm facing an issue while trying to install Python 2 on my Parrot OS. Whenever I run the command:
sudo apt-get install python2
I receive the following output:
`Reading package lists... Done
Building ...
0
votes
0
answers
9
views
shutil.make_archive works but throws Error 13 for /root
I have a script that collects various files into a directory structure than creates a final zip archive. The directory <dir> is located at /home/<user>/<dir> and I want it to create /...
0
votes
1
answer
35
views
install python2.7 on rehl 9 for legacy application
We have an legacy application running on old python version which is python 2.7
i tried installing 2.7 from source but failed to so with many errors
Also tried using sudo dnf install python2.7 but it ...
0
votes
1
answer
68
views
Having trouble displaying images on Pepper
In the code below, I've tried to display a photo on Pepper's tablet that was just taken by their camera, but I've been having issues.
import time
from naoqi import ALProxy
from src.common.ip_port ...
3
votes
1
answer
183
views
Unable to connect to cloud datastore from local legacy project based on python2.7 and django 1.4
I have a django==1.4 project (python==2.7) that I wanted to run and make some changes. I am unable to connect to cloud datastore from my local codebase. Right now, when I run the project using ...
1
vote
1
answer
69
views
Python json.dumps of a tuple with some UTF-8 characters, either fails or converts them. I want the encoded character retained as is
On my server, a Python script gets data from a database as a tuple. Then the script converts the tuple to a string (using json.dumps()) to be passed to the JavaScript script in the user's browser.
The ...
0
votes
0
answers
17
views
flask-sqlalchemy delete row not succeed?
I use flask-sqlalchemy as my orm. And I have a post_file request needs to response immediately. Thus, I use multiprocessing to forward the request to post_file_async. Here I need to delete some rows. ...
0
votes
1
answer
38
views
How to change numbers received from text file to integer
I used python script to read numbers form *.txt file and use that number for future works, but the number when I parse I am getting error "TypeError: int() argument must be a string, a bytes-like ...