python-2.4 Questions

9

Solved

I'm reading a file into python 2.4 that's structured like this: field1: 7 field2: "Hello, world!" field3: 6.2 The idea is to parse it into a dictionary that takes fieldfoo as the key and whateve...
Coagulase asked 31/1, 2012 at 0:30

7

Solved

Trying to get the try/except statement working but having problems. This code will take a txt file and copy the file that is in location row 0 to location of row 1. It works however if i change one...
Biafra asked 22/1, 2013 at 13:54

3

Solved

I have a large amount of python code that tries to handle numbers with 4 decimal precision and I am stuck with python 2.4 for many reasons. The code does very simplistic math (its a credit manageme...
Larina asked 15/11, 2010 at 8:9

7

So I'm trying this really simple example given by the python docs: import getpass import sys import telnetlib HOST = "<HOST_IP>" user = raw_input("Enter your remote account: ") password = g...
Laurenlaurena asked 8/6, 2012 at 16:18

3

Solved

I want my Python (2.4.3) output numbers to have a certain format. Specifically, if the number is a terminating decimal with <= 6 significant digits, show it all. However, if it has > 6 significa...
Factitious asked 11/9, 2014 at 5:53

4

Solved

I'm currently writing a small script for use on one of our servers using Python. The server only has Python 2.4.4 installed. I didn't start using Python until 2.5 was out, so I'm used to the form:...
Bhili asked 22/9, 2010 at 14:37

5

Solved

I've tried what's told in How to force /bin/bash interpreter for oneliners By doing os.system('GREPDB="my command"') os.system('/bin/bash -c \'$GREPDB\'') However no luck, unfortunately I need...
Mesothorax asked 17/2, 2014 at 6:17

2

Solved

I'm wondering if there is a way to load an object that was pickled in Python 2.4, with Python 3.4. I've been running 2to3 on a large amount of company legacy code to get it up to date. Having don...
Bravery asked 29/1, 2015 at 15:32

5

Solved

I tried this code: import hashlib encrypted = hashlib.sha1(string) encrypted = encrypted.digest() But I got an error that says "No Module Named hashlib". What is wrong, and how do I fix ...
Monacid asked 2/7, 2011 at 15:4

4

Solved

With Python ConfigParser, is it possible to use interpolation across foreign sections? My mind seems to tell me I've seen that it's possible somewhere, but I can't find it when searching. This exa...
Cestoid asked 30/9, 2011 at 1:35

5

Solved

I need to use Python 2.4.4 to convert XML to and from a Python dictionary. All I need are the node names and values, I'm not worried about attributes because the XML I'm parsing doesn't have any. I...
Pussy asked 20/7, 2010 at 18:11

2

Solved

I have a password-protected private key in a .pem file; I want to use it to sign requests to a remote server. I'm able to load the key and enter the passphrase after being prompted for it: python ...
Mayday asked 16/5, 2012 at 8:54

1

I have this installed on Windows 7 Python 2.7.6 (my default, with virtualenv installed) Python 2.4.4 Python 2.5.4 Python 2.6.6 Python 3.3.3 virtualenv 1.10.1 I want to test code on all of those...
Incalescent asked 14/12, 2013 at 14:26

1

Solved

I'm stuck using python 2.4 for this project so I'm using optparse. Getting the following error when running this code: Traceback (most recent call last): File "./clientNFSLatMonME.py", line 49, i...
Boiney asked 29/5, 2014 at 15:41

1

Solved

I'm having a problem when closing a connection as follows: database = 'sed_database' conn = MySQLdb.Connect(host='remote_host', user='default', passwd='pass', db=database) try: try: cursor...
Sofia asked 13/12, 2013 at 11:52

5

Solved

I'm having a hard time figuring out how to unzip a zip file with 2.4. extract() is not included in 2.4. I'm restricted to using 2.4.4 on my server. Can someone please provide a simple code example...
Houlihan asked 18/10, 2011 at 11:34

3

Solved

I'm accustomed to doing import json in Python 2.6, however I now need to write some code for Python 2.4. Is there a JSON library with a similar interface that is available for Python 2.4?
Scorpion asked 20/7, 2010 at 15:35

4

Solved

I'm writing a python script that uses subprocess.Popen to execute two programs (from compiled C code) which each produce stdout. The script gets that output and saves it to a file. Because the outp...
Ponderous asked 6/7, 2010 at 22:59

2

I need to develop a script that will launch some computations. A want this script to handle ^C correctly by deleting some temporary directory. I have tried several versions of code in the signal_ha...
Alessandro asked 27/6, 2012 at 14:6

2

Solved

I have learned that python does not guarantee that __del__ is called whenever an object is deleted. In other words, del x does not necessarily invoke its destructor x.__del__(). If I want to ensur...
Casemaker asked 27/4, 2012 at 14:26

2

Solved

This is my normal code in my VPS hosting which provide python 2.4 def mail(receiver,Message): import smtplib try: s=smtplib.SMTP() s.connect("smtp.gmail.com",465) s.login("[email protec...
Longlongan asked 9/2, 2012 at 17:54

1

Solved

I have a unit test that I'd like to write for a function that takes XML as a string. It's a doctest and I'd like the XML in-line with the tests. Since the XML is multi-line, I tried a string litera...
Hoover asked 21/12, 2011 at 16:47

3

Solved

I have a python package that I'm writing and I'm having an issue where the standard library is being imported instead of my files because of name clashes. For example, a file structure like below:...
Brasca asked 19/12, 2011 at 2:23

2

I want to timeout a particular piece of python code after in runs for 0.5 seconds. So I intend to raise an exception/signal after 0.5 seconds, and handle it gracefully and continue with rest of cod...
Acrylyl asked 23/11, 2011 at 12:52

3

Solved

Does python have a means of doing foreach backwards? I'm hoping to do a filter() (or list comprehension) and reverse a list at the same time, so that I can avoid doing it separately (which I suspec...
Kassiekassity asked 1/11, 2011 at 16:47

© 2022 - 2024 — McMap. All rights reserved.