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.

Filter by
Sorted by
Tagged with
1 vote
4 answers
79 views

Why is my code change the smallest variable from 2 to 10?

my code largest = None smallest = None while True: pick = input("Please Enter a number: ") try: #first look for user to click done then test to make sure input ...
dayBYday's user avatar
0 votes
1 answer
23 views

Issue with Inheritance in Python - Unable to Access Parent Class Method

I'm currently working on a Python project where I'm using inheritance to create a base class and a derived class. However, I'm encountering an issue when trying to access a method from the parent ...
Divyansh Singh's user avatar
1 vote
0 answers
22 views

Scrapy with Python 2.7 on wsl/Red Hat, errors all the way

So I need to run Scrapy at work. I cannot use python3 for the moment because the installation is messed up (long story). I install scrapy using pip install scrapy. The version with scrapy --version is ...
Synthwave09's user avatar
-3 votes
1 answer
44 views

How do I give space between two lines in Python? [closed]

How do I give space between two lines in Python? I use \n\n for one line space between two lines print("This is the first line\n\nThis is the second line.") This will print This is the first ...
Sheelendra Singh's user avatar
0 votes
0 answers
27 views

twisted python 2.7 integrate with confluent-kafka issue for a legacy system

First of all, yes it's a legacy system which is not yet completely ported to Python 3 yet. I have this piece of code where there is a Twisted program which serves some HTTP request, for simplicity I'm ...
Jithin's user avatar
  • 1,690
0 votes
1 answer
35 views

How can i upgrade python in VSCode terminal?

So i have installed both python 2.x and 3.x on my PC and have also selected 3.x as my default python interpreter in VSCode. So, as expected whenever i use python code runner extension it uses 3.x as ...
user22959527's user avatar
-4 votes
0 answers
26 views

What are Pickling and Unpickling? [closed]

technical question related to python I require answer of this question Sure, I can help you with that. Python Pickling Tool Python comes with a built-in package called pickle that can be used to ...
Khushi's user avatar
  • 1
0 votes
0 answers
10 views

Creating python 2 environment with anaconda

I am trying to create a PY27 environment in anaconda on a Mac (Montery 12.6.4) using the following code conda create -n python2 python=2.7 anaconda When I try this I get the following" ...
Antonio.Aubry's user avatar
0 votes
1 answer
19 views

How to create a UTC datetime object in py2?

I have to add legacy support for py2. In py3, I can do something like dt = datetime.datetime(2023, 11, 28, 12, tzinfo=datetime.timezone.UTC) I don't think this works in py3 b/c datetime.timezone is a ...
24n8's user avatar
  • 1,986
0 votes
0 answers
51 views

What's the error in this solution to a problem asking minimum steps to reach 1 given a number?

I need to find the minimum required steps to reach 1 given a number, up to 9^309, and am using python 2.7 for this. I'm only allowed three kinds of operations: add 1, subtract 1, and divide by 2 if ...
Menelik Berhan's user avatar
0 votes
1 answer
35 views

List indices must be integers or slices, not str; - DIctionary error in text based game for class [closed]

In the code, the player has a dictionary set to them with weapon details in them. weapons = { "sword" : { "damagelow" : 3, "damagehigh"...
pythonstudent91912323's user avatar
-1 votes
0 answers
11 views

How to make a pattern in python and make it hollow show that the printable pattern should have stars on the outline only

to make the spaces between the stars even or equal how to make a pattern in python and make it hollow show that the printable pattern should have stars on the outline only. make sure that the spaces ...
RASHIK GHOSH's user avatar
-1 votes
1 answer
47 views

Representing the maze in the Dictionary in Python

I am a new computer science student, and now we know the Python language. It is beautiful, but I have many problems with it. Sorry, I can solve this question. enter image description here I tried to ...
0 votes
0 answers
59 views

Get a Random Boolean by Percentage using tkinter

Please could you explain how to use tkinter to make an Entry widget that passes a percentage value to the function below e.g. the user enters 60 into the input field which then passes the user’s value ...
Simeon Beckford-Tongs's user avatar
0 votes
0 answers
58 views

Using stage_block API to upload file chunk is so slow when executing under Uwsgi request in Django

I am using python 2.7.18 with azure-storage-blob==12.3.2 and Django to implement file upload with small chunk, when calling stage_block API in interactive mode directly each chunk request takes less ...
user87's user avatar
  • 1
-2 votes
0 answers
52 views

How to solve my sftp file transfer problem

I have a problem when I try to download a file from my server to my PC here is the problem: Error during download: Failure Traceback (most recent call last): File "c:\Users\user\Documents\...
Primalon's user avatar
-4 votes
0 answers
57 views

json.load works in python 2 but no python 3

This code works in python 2 api_token=$(/usr/bin/curl "${server_url}/api/v1/auth/keep-alive" --silent --request POST --header "Authorization: Bearer ${api_token}" | python -c '...
Peteo's user avatar
  • 1
-2 votes
0 answers
49 views

issue with Python List Comprehension: Unexpected Output [duplicate]

Here's a simplified version of my code: original_list = [1, 2, 3, 4, 5] modified_list = [item * 2 for item in original_list if item % 2 == 0] print(modified_list) I expected this code to create a new ...
Aryan madaan's user avatar
0 votes
2 answers
61 views

Python 2.7 to Python 3 upgrade

I am working on updating a series of python 2.7 plugins to python 3.10 that get loaded into the software individually. Below is an example of how the python 2.7 plugin is organized. ProjectDir ...
Travis Pettry's user avatar
-2 votes
2 answers
110 views

Sort the coordinates of points by areas that they occupy (Python) [closed]

Suppose we have a particular number of points distributed in the plane at the nodes of a grid having a given step. These points form several continuous regions. We can tell that points (if there are ...
Alexander Fedorov's user avatar
-2 votes
0 answers
20 views

updating python2 telnet code to python3. TypeError: can't use a string pattern on a bytes-like object

I am working with apparently python2 code in python3. I didn't write it and am trying to update it, I get an error: TypeError: can't use a string pattern on a bytes-like object On this line: self....
Codejoy's user avatar
  • 3,758
-1 votes
0 answers
16 views

MacOS M2 python2 symbol not found in flat namespace '_ERR_put_error'

Yes, I know! why am I still using python2... Well, because I have to... at least for now! The issue I'm facing is the following: python Python 2.7.18 (default, Nov 14 2023, 16:08:42) [GCC Apple LLVM ...
Jean-Sébastien Frerot's user avatar
0 votes
0 answers
62 views

Write a program that randomly generates a numbers and saves all its divisors in a file named "Q1.txt" [duplicate]

can anyone help me Write a program that randomly generates a number between 10 and 10000 and after displaying it, saves all its divisors in a file named Q1.txt my code: import random import math ...
yarpa's user avatar
  • 1
0 votes
1 answer
34 views

psycopg2 for Python 2.7

I am trying to run a jenkins job which runs on Python 2.7. The job clones a git repository in the Worspace. The repository has the 'site-packages' folder which contains the required packages. However, ...
Meghani Aadish's user avatar
0 votes
0 answers
14 views

zc.buildout cannot import name PkgResourcesDeprecationWarning

I'm trying to resurrect old application and I'm using bootstrap script. I tried different versions of setuptools, but still the same error: (Default one for this script is 18.3) zc.buildout.buildout....
ehrid's user avatar
  • 105
0 votes
0 answers
22 views

Activate flag only for specific imported module in Python

I am trying to follow the instructions shown here: https://docs.python.org/3.10/whatsnew/3.0.html#porting-to-python-3-0 Specifically, "Turn on the -3 command line switch". It is regarding ...
Finite_Elephant's user avatar
4 votes
0 answers
162 views

SqlAlchemy extending an existing query with additional select columns from raw sql

I'm quite new to SQLAlchemy and Python, and have to fix some bugs in a legacy environment so please bear with me.. Environment: Python 2.7.18 Bottle: 0.12.7 SQLAlchemy: honestly don't know but ...
hreimer's user avatar
  • 774
-2 votes
0 answers
93 views

Why does this block of python code show me the "This is not a valid number" result and how do I fix it? [duplicate]

This is a programm to convert between two temperature units. while True: temp_mode = input("""(1)Conversion from Celsius to Kelvin (2)Conversion from Celsius to ...
Pythony2345's user avatar
1 vote
0 answers
15 views

Largest possible subset challenge failing

I am doing the following challenge: Commander Lambda's space station is HUGE. And huge space stations take a LOT of power. Huge space stations with doomsday devices take even more power. To help meet ...
umar mnaq's user avatar
-1 votes
1 answer
109 views

Show the stack trace from a stuck v2 Python.exe application in Windows

I have the same question as Showing the stack trace from a running Python application with two differences: I'm looking for answers that work on Windows 10 and Python v2. I have this Python ...
Daniel Kaplan's user avatar
0 votes
0 answers
15 views

Python 2.7: elem.getiterator # cET compatibility AttributeError: 'NoneType' object has no attribute 'getiterator'

This issue was occuring Gradle Wrapper build samples. Issue was related to python. Following versions of python software currently installed in my system. python version: 2.7.18 (as it is required for ...
Narmadha's user avatar
0 votes
0 answers
23 views

Python C API PyArg_ParseTupleAndKeywords fails on second function call

I'm currently facing a weird problem with python c api. It only happens on 1 machine, I can't reproduce the error on other machines. On the second call (b=...) I get the error fail secondary argument ...
kpm's user avatar
  • 21
0 votes
0 answers
62 views

CMake will not be able to correctly generate this project. CMake Error at CMakeLists.txt:2 (project): No CMAKE_CXX_COMPILER could be found

I am facing an issue with Gradle Wrapper build samples. Issue related to CMAKE. Following versions of software currently installed in my system. python version: 2.7.18 (as it is required for the ...
Narmadha's user avatar
0 votes
1 answer
17 views

How can I toggle between dashboards of sharepoint with Python?

I need to present different dashboards on one screen. They need to pass in a certain amount of time. Locally, I was able to use "os.startfile" with Python. I was able to switch between tabs ...
Victor Acioly's user avatar
0 votes
1 answer
48 views

ms_active_directory - Is it possible to delete an user account?

I connected my Flask application with an Active Directory Server using ms_active_directory library. Is it possible to delete an user account? Something like this: import os from ms_active_directory ...
pvfreitas's user avatar
-1 votes
1 answer
106 views

Decrypt a string in Python that was encrypted by AES-CBC using crypto.subtle in JavaScript

I am dealing with a case where I need to encrypt the payload at client side using JavaScript via AES-CBC algorithm, but later decrypt it in backend using Python. The module used for encryption in ...
Neeraj Kumar's user avatar
0 votes
1 answer
71 views

Source to download microsoft visual c++ 9.0 for python 2.7

I've encountered a problem whilst trying to install "fa2" (forceatlas2) package onto a conda environment. In my case fa2 is just one of many packages needed, but it's the only one giving me ...
JSide13's user avatar
0 votes
1 answer
42 views

How to Install pip using python2 / Python (2.x)?

I tried to install libosmesa-devel for my EulerOS. It required Python (2.x) pip to install some packages. I already had python3 installed; so, I installed python2. Then, I got stuck while trying to ...
Mashuk Paban's user avatar
0 votes
1 answer
39 views

How can I identify the first monday, first tuesday, ..., second monday, ..., third wednesday, ..., fourth sunday in Python?

I have a column of dates backing a couple years with additional columns that split the date into year, month, day, week, and weekday (if needed). Date 1/1/23 1/2/23 1/3/23 1/4/23 1/5/23 1/6/23 ...
wuwho's user avatar
  • 3
0 votes
0 answers
36 views

use redis-py-cluster unable to connect to redis cluster in python 2.7

I follow the official documents: https://redis-py-cluster.readthedocs.io/en/master/ The example given is writing code to connect to my Redis cluster, but an error was reported: RedisCluster. ...
Rain's user avatar
  • 5
0 votes
0 answers
15 views

Trying to save a .wav audio file from Nao. I get a damaged file

I am implementing a client capable of capturing an audio file from the Nao robot and sending it via socket to a server locally. In reading the file I get a corrupted audio file if os.path.exists(...
Giuseppe Cirino's user avatar
0 votes
0 answers
41 views

how to add figure caption as field in docs using python?

I have lots of figures in the docs which I numbered according to the headings number. like 4.1.2, 4.11.8. I want these as a field and want to add them in the content page so that if I change ...
krishna vaishnav's user avatar
1 vote
0 answers
66 views

byte object length issue

I’m in a bit of a bind due to version restrictions. I have to encrypt some data in alteryx app which uses python 3 and decrypt that data in another place(Unix box) that has python 2 As an example of ...
lavida's user avatar
  • 35
-2 votes
1 answer
48 views

Run python 2 API in python 3

I want to make an integration with a API whose documentation seems to be in python 2, but for several reasons I need to make the API request in python 3. As far as I know, urllib2 does not exist in ...
Ekapunk's user avatar
  • 81
0 votes
0 answers
7 views

Apperance settings not staying as set

Hoping someone can help me, I have managed to get some screen changes and customization in an app I'm building via gtk_rc_parse which is good but if I change the apperance settings with my app open ...
WillG's user avatar
  • 1
0 votes
0 answers
18 views

Is there any way to use custom Consumer Tag with pika

I am using pika to work with RabbitMQ. I have a queue with a dozen consumers. I want to map consumer information in Rabbit with my application logs. So is there any way of either getting the attached ...
 GhostKU 's user avatar
  • 1,908
-1 votes
1 answer
22 views

Efficient management of instances with unique dictionaries in a repeated instantiation situation

About my problem: I create instances of a class several times, each time my frontend sends a message to my backend.(This can't be changed either). Now the instances have to fulfill the following: The ...
meno's user avatar
  • 21
-1 votes
1 answer
41 views

raise SMTPAuthenticationError(code, resp) smtplib.SMTPAuthenticationError

I'm trying to make a program to send me quotes via gmail.com at a specific time in windows. But I get an error: raise SMTPAuthenticationError(code, resp) smtplib.SMTPAuthenticationError: (535, b'5.7....
Osman_Veyisli's user avatar
0 votes
0 answers
23 views

Installing brew pip to Python 2.7 [duplicate]

I'm trying to install pip to Python 2.7. When I try to run this line of code. I need this to work because I am trying to install GS tools dataset that I will need for geostatistical modeling as a ...
Yomi 's user avatar
0 votes
0 answers
15 views

PyVelest.py Compilation on MacBook Pro M2 Running Python 2.7: _GEOSArea issue

I've been attempting to compile PyVelest.py using Python 2.7 on my MacBook Pro M2. (base) isaacguerra@MacBook-Pro-de-Isaac PyVelest % python2 PyVelest.py Traceback (most recent call last): File "...
Isaac's user avatar
  • 1

1
2 3 4 5
1906