Tagged Questions
Python is a dynamically and strongly typed programming language whose design philosophy emphasizes code readability. Two significantly different versions of Python (2 and 3) are in use. Please mention the version that you are using when asking a question about Python.
-1
votes
0answers
6 views
How scan for return values in python?
import ToBuildOrNot
needsBuild = ToBuildOrNot.run('MSS_sims')
if needsBuild is True:
print "The MSS_sims Needs To rebuilt"
elif needsBuild is False:
print "The MSS_sims does NOT Need to be ...
0
votes
0answers
4 views
Python: Win32Serial: How to set initial parameters
My issue: Currently I am trying to communicate with a multi-purpose digital switch (VX SHOUT) by SONUS. I am writing an automated process that configures the switch so a user doesn't have to. However, ...
0
votes
0answers
2 views
Python: Changing Types while writing in a MS-Access DB
I' m trying to read data from a DB (MS-Access), manipulate them and then write them back after creating a new table.
Basically everything work well (read, write, create table), but the Problem I'm ...
0
votes
2answers
19 views
Python os.chdir is changing the directory
I am trying to change the current working directory in python using os.chdir. I have the following code:
import os
os.chdir("C:\Users\Josh\Desktop\20130216")
However, when I run it, it seems to ...
0
votes
0answers
23 views
Reciprocal Fibonacci Constant
I am working on a program that calculates the Reciprocal Fibonacci Constant (the infinite summation of the Fibonacci numbers.) It calculates every term upto it's error:
I have an program but it only ...
1
vote
1answer
30 views
python strings to int/float in an efficient way
I have an array (in numpy, or in pandas) containing (non-unique) strings. Some of them are ints written as strings, some comprise of both digits and letters. What I would like to do is to map these ...
0
votes
0answers
7 views
POST binary data using httplib cause Unicode exceptions
When i try to send an image with urllib2 the UnicodeDecodeError exception is occured.
HTTP Post body:
f = open(imagepath, "rb")
binary = f.read()
mimetype, devnull = ...
0
votes
3answers
11 views
How to run another python program without holding up original?
What command in python can be used to run another python program? It should not wait for the child process to terminate, but continue on. It also does not need to remember its child processes.
2
votes
1answer
23 views
Is Python's dict.pop atomic?
It seems reasonable to believe that dict.pop operates atomically, since it raises KeyError if the specified key is missing and no default is provided, like so:
d.pop(k)
However, the documentation ...
1
vote
1answer
16 views
Django Python __init__() TypeError 'Default' Tutorial
I'm going through the Django Tutorial: https://docs.djangoproject.com/en/1.5/intro/tutorial01/
I have an error:
TypeError: __init__() got an unexpected keyword argument 'Default'
This occurs ...
0
votes
0answers
7 views
gaierror: [Errno 11004] getaddrinfo failed while making simple message system
This is the server script:
from socket import *
HOST = gethostname()
print HOST
PORT = 3664
s = socket(AF_INET, SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
print ...
-1
votes
1answer
10 views
best way to pass kwargs arguments to overriden method
I have something like this:
MyClass(BaseClass):
def __init__(self, *args, **kwargs):
data = kwargs.pop('data', None)
super(BaseClass, self).__init__(*args, **kwargs)
BaseClass ...
0
votes
0answers
11 views
calculate time difference pandas dataframe
I have a pandas dataframe where index is as follows :
Index([16/May/2013:23:56:43, 16/May/2013:23:56:42, 16/May/2013:23:56:43, ..., 17/May/2013:23:54:45, 17/May/2013:23:54:45, 17/May/2013:23:54:45], ...
-1
votes
2answers
26 views
C communication between C program and python program using exit code
I am trying to exec a python program from another C program where the return value of the py script is
int array[3]
can I grab the this array from the python exit code ??
EDIT:
if the question ...
0
votes
1answer
5 views
python mysql select return only first row of table, not all
im dealing with strage problem and this is like this:
this query should return all of my table:
db = MySQLdb.connect(host="localhost", port=3306, user="A", passwd="B", db="X")
cursor = db.cursor()
...