Questions tagged [python-2.6]
For issues that are specific to Python 2.6. If your question applies to Python in general, use the tag [python].
1,317
questions
1
vote
4
answers
117
views
Install pip on Python 2.6
I need to install pip on Python 2.6. I have tried a couple of solutions available.
How to install pip on a system with python 2.6
How to install pip for python 2.6?
How to install pip with python 2....
0
votes
0
answers
59
views
Printing logs from a telnet connection
I am trying to do the following actions:
I have to do the following things:your text
From a Linux Server (intermediate Server), login to different server
Run command such as chg-trm:trm=:all=yes
...
-1
votes
2
answers
45
views
Using a python 2.6 package in python 3.10
Background
I want to learn python through creating an isometric RPG computer game. To make it a little more fun at the start, I thought I would instead of starting from scratch, alter another very ...
0
votes
1
answer
868
views
Python Build Error: fatal error: misc/abstract_atomic.h: No such file or directory
Im using Linux Mint 21 and I'm trying to build python 2.6.2 I need it for Blender 2.49b. So here is error which Im getting
from /home/slobodan/Python-2.6.2/Modules/nismodule.c:17:
/usr/include/rpc/...
0
votes
0
answers
34
views
Downloading google sheets using python 2.6
For some reason one of our unix servers is still using python 2.6. I cant upgrade it’s version to v3 due to restrictions. Frustrating I know.
Anyway, I am wondering if there are still working ...
0
votes
1
answer
224
views
How to eliminate duplicate IP Table entries through python program
iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 10.10.10.10 anywhere tcp dpt:6379
ACCEPT tcp -- 10.10.10.10 ...
0
votes
1
answer
59
views
Defining a list of values within a class
I know that this is a simple question, but I don't know what this is called and I can't find any details online...
Using Python 2.6, I simply want to be able to reference some predefined values that ...
0
votes
0
answers
56
views
Python2.6 give OSERROR No Such File on subprocess but python > 2.7 works well
I have installed python 2.6 into a host and python 2.7 and python 3 as well
the below code is working fine in pythn3 and python 2.7 but not working in python 2.6
>>> f=open("/tmp/abcd....
0
votes
0
answers
84
views
Is there a way to convert excel to csv in python 2.6?
Currently, I have a 2.6 version of python on my windows machine.
I intended to use pandas, xlrd, and openpyxl for excel parsing, but since pip is not installed automatically in v2.6, I tried to ...
0
votes
1
answer
60
views
Sort and count words in xml output python script
I'm trying to sort and count every word from the output of the i.find().text command, but I can't find a way to do it without hardcoded filter words in the array.
Used strings:
from xml.etree import ...
1
vote
1
answer
799
views
Pillow - Adding transparency depending on grayscale values
Based on this post: Converting image grayscale pixel values to alpha values , how could I change an image transparency based on grayscale values with Pillow (6.2.2)?
I would like the brighter a pixel, ...
0
votes
0
answers
44
views
I am getting this error related to logging
No handlers could be found for logger reports_wrapper
if logging.getLogger().hasHandlers():
logger = logging.getLogger(__name__)
else:
logger = logging.getLogger("reports_wrapper")
...
0
votes
0
answers
83
views
Running a TimesTen query from a Python script works fine. When I put it in my crontab, it doesn't work as expected
I have a python script which queries a TimesTen database and stores the output in a file, and emails it off. When I run it from its directory /home/directory/script.py, it works absolutely fine and ...
0
votes
1
answer
107
views
Calling grep after writing to file Python 2.6.4 os.system
I'm trying to read from text.txt, write certain lines to temp.txt, then using os.system call grep on temp.txt
After I run the program, temp.txt gets created and I can call the same grep command in ...
1
vote
1
answer
46
views
What's the correct way to join threads in Python multiprocessing and how these differ?
What's the correct way to join threads in multiprocessing, so the main program waits the completion of all threads before going ahead?
I have seen these 2 ways while researching, not sure how they ...
0
votes
0
answers
106
views
Why is my for-loop not checking the last line of my file for a duplicate? Python
I have an output file (output.txt) which contains a lot of duplicate mac addresses. The output.txt file has around 68 lines at the moment, and I'd say a third are duplicates. I want to remove the ...
0
votes
1
answer
690
views
Python 2.6: how to exclude filenames that contain a certain substring?
I have 3 file in /some/dir:
$ ls /some/dir
fiot_csv2apex_nomuratest.xml fiot_csv2apex_nomurauat.xml fiot_csv2apex_nomura.xml
I want my script to extract only the file that does NOT contain ...
0
votes
2
answers
4k
views
ImportError: cannot import name 'download_url_to_file'
I tried to run a Python script that uses the download_url_to_file method inside the torch hub, but I got the following error:
Traceback (most recent call last):
File "crop-video.py", line ...
0
votes
0
answers
139
views
How to open file when filename contains command prompt substring in Windows
Sometimes, we need to generate filenames with current date in their file names. Windows command prompt supports variable substrings. For example, my command prompt prints 2021_25_02.txt for command ...
0
votes
1
answer
196
views
How to install pip in RHEL6 to use "virualenv" with python 2.6.6
Background:
Robot scripts are developed on Python 3.* and they can only be executed in python3.
Problem:
We have RHEL6 machine which uses python 2.6.6 which cannot be updated.
Prepared Solution :
We ...
0
votes
1
answer
150
views
Python3.8 socketpair failed (s.o. cygwin)
Under cygwin console:
$ python3.8
Python 3.8.7 (default, Jan 26 2021, 07:37:32)
[GCC 10.2.0] on cygwin
Type "help", "copyright", "credits" or "license" for ...
-1
votes
1
answer
299
views
Python 2.6:Trying to run an if statement if variable is a list [duplicate]
I'm new to python and trying to complete an exercise where I print every variable from a list including any nested lists.
My issue is I can't get the nested lists to be recognised as lists by an if ...
0
votes
1
answer
51
views
Pass None or empty value to dictionary key if result from result comprehension is nothing
How to pass None or empty value to failure_dict['Failure Reason'] if failure reason has no value.
failure_dict['Failure Reason'] = ', '.join(
[failure_reason for failure_reason in self....
0
votes
1
answer
113
views
change permissions of file for remote machine
I am generating csv report using below code and using jenkins job for triggering and file is created on remote machine.
But I am getting this error (report not generated due to [Errno 13] Permission ...
0
votes
0
answers
167
views
Create a python standalone executable for CentOS
I have a python script written to run on a system in our office which runs CentOS. It has Python2.6.6 installed by root user and hence I don't have access to install pip or any other tool. My goal is ...
0
votes
1
answer
81
views
IP address and file manipulation python 2.6
I am new in python and I need your help to improve part of my script to be more sophisticate.
==================================== a.py
devices = ['x.x.x.x', 'x.x.x.x', 'x.x.x.x']
=====================...
1
vote
2
answers
78
views
How to convert Python dictionary syntax from 2.7 to 2.6? [duplicate]
I am trying to run my script from Jenkins which has Python 2.6 installed. My script was originally written on a Linux machine which uses 2.7.5. Whenever I run the script form my local machine it works ...
1
vote
1
answer
781
views
Syntax error while writing pip in terminal
I'm working with Python 2.6.6. Everything was working fine until I wrote
pip install --upgrade --user pip
Then the terminal say:
Successfully installed pip-7.1.0
After I tried to install SciPy with:...
2
votes
2
answers
53
views
Although i insert different string, str.format print same string
I want to print different variable in one line with specific alignment. However, str.format print same string.
Here is the code what i did and output
>>> print("{0:^20} {0:^20} {0:^40}\...
0
votes
0
answers
976
views
Install python 2.6 on Mac
I have to use an API which uses Python 2.6 and am having a very difficult time getting it installed on my mac. I have downloaded it but figuring out what I am supposed to write in my bash_profile is ...
-1
votes
2
answers
84
views
Python String manipulation to store result in a string after removing comma delimiter
I have a string which I want to separate based on the ',' delimiter and store the result in a new string. Currently the split function stores the result in an array. How to store the result in a ...
0
votes
1
answer
149
views
Python regular expression to format source file to destination file format
I have text file of the below source format. i want to convert it to text file which has the destination format. I'm able to print out just the first pattern. Can someone help how to iterate through ...
2
votes
1
answer
279
views
Issue ingesting RAW datatype column using PyRFC
I'm running into an issue dealing with RAW datatype column when pulling data from SAP using PyRFC.
Below is the screenshot of the metadata and how the data looks in SAP GUI.
Below is the snippet of ...
0
votes
0
answers
131
views
Removing ":" from namespace in a XML file parsing
I am trying to modify XML file using xml.etree.ElementTree on Python 2.6.6 (due to restrictions) and facing ns0 issue. I looked at this issue and used ET._namespace_map[uri] = prefix as suggested ...
0
votes
1
answer
26
views
MonetDB pystethoscope with Python2?
Does the new MonetDB profiler pystethoscope also work with Python 2.6 and up?
0
votes
1
answer
51
views
Python: Combine data based on a key column
Having data containing both parent and child records inside a same text file (two headers) .
Parent is department and childs are employees and dno is the join column.
dno,dname,loc
10,FIN,USA
20,HR,...
-1
votes
1
answer
28
views
How can a function from different python module can be used in another defined function?
Here I want to use the c(v) & s(v) from a module FrenselIntegral.py in a defined function f(v).
import FrenselIntegral as fi
v=0.0
u=0.2
def f(v): 0.5*((0.5-fi.c(v))**2+(0.5-fi.s(v))**2)
file=...
1
vote
1
answer
677
views
SyntaxError: invalid syntax with python2 and selenium in centos6.8
I run python script:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.keys import ...
1
vote
1
answer
120
views
Finding number of unique occurrences of text within xml tag in python 2.6
I am trying to find number of unique occurrences of some text within one xml tag and display the same in one of the columns in a csv file.
My Xml file looks somewhat like this:
<start>
<...
0
votes
2
answers
1k
views
Parsing XML child tags with same name using ElementTree
I am trying to parse an XML file (in Python which is new for me) with below structure:
<xml>
<document>
<fit>
<grp> some tags </grp>
<prp>
<p> <id> ...
0
votes
0
answers
108
views
Problem using Python 2.6.6 and scapy 2.3.3 in CentOS 6
I'm trying to use scapy 2.3.3 (that should work with Python 2.6.6) but I'm getting 'Execution RuntimeError' every time I try to import.
Scapy versions from github
This is how I'm importing the ...
-1
votes
1
answer
123
views
How to read python variables into bash command [closed]
I'm writing script to generate Autosys report using Python 2.6, and I would like to pass variables from python script to bash command:
I have 3 variables:
NextMonth,
NDNextMonth,
Year
When I'm ...
0
votes
1
answer
436
views
Logging module not working in python 2.6.6
Below code is working fine on Python 2.7 but unfortunately i have to deploy my script on Linux 5.9 which has python 2.6.6 installed in it and there is no option for me to upgrade. I am not able to ...
1
vote
1
answer
103
views
Python pattern to replace words between single or double quotes
I am new to Python and pretty bad with regex.
My requirement is to modify a pattern in an existing code
I have extracted the code that I am trying to fix.
def replacer_factory(spelling_dict):
...
-2
votes
1
answer
2k
views
Python replace string inside file itself using regular expression
I'm developing on a RedHat Linux server and the Python version installed is the 2.6.
I have a Python script that have to replace a string in a file .sql. Each time I run the Python script I pass a ...
0
votes
0
answers
16
views
Is there a way to convert an object dataframe to float on python 2 [duplicate]
I have a dataframe cointaining objects . I want to convert my object column to a float I used :
fdk['Child | Nominal weight'] = dfk['Child | Nominal weight'].astype(float)
But i get an error like
...
-1
votes
2
answers
176
views
How am I getting this error when looping through files in a directory? "OSError: [Errno 2] No such file or directory"
I have thousands of files I need to delete in a directory. I want to keep the first ten (alphabetically/numerically) that match the conditions. For example, I want to keep 'part-of-file-name-abc00000....
0
votes
2
answers
129
views
Mock inner methods Python2
I'm new to mock and really strugling with it. Mostly in documentation and most of SO pages it shows how to get the mock result_value, but I want to check if the values I'm getting from methods are ...
1
vote
1
answer
360
views
Can't Update QTextEdit While in a Multiprocess
I am trying to tail a file and output it continuously to a QTextEdit box. However, I have my subprocess and output located within a multiprocess. Here is my code:
shouldRun = True
wMain = QtGui....
0
votes
1
answer
30
views
Porting a Bash while loop to Python 2
I'm an intern porting a Linux Bash script to Python 2.6. This script basically powers an intranet dashboard that displays data about servers. It updates every minute, and is constantly running, pretty ...