Has anyone tried to statically link mysql-python with mysql client library on 64-bit Linux?
gcc -pthread -shared build/temp.linux-x86_64-2.6/_mysql.o /home/apy/MySQL-
python-1.2.3c1/mysql-5.1.42/i/lib/mysql/libmysqlclient_r.a -L/home/apy/MyS
QL-python-1.2.3c1/mysql-5.1.42/i/lib/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -
lm -lp...
I'm trying to display all possible combinations of a list of numbers, for example if I have 334 I want to get:
3 3 4
3 4 3
4 3 3
I need to be able to do this for any set of digits up to about 12 digits long.
I'm sure its probably fairly simple using something like itertools.combinations but I can't quite get the syntax right.
TIA
Sa...
I have a list of file locations stored as strings. I want to be able to open a separate window for all of the different strings. What would be the best way to do that? Essentially, You click a button, the strings are constructed and they are left in a list. When I was prototyping, I built a small program to display the contents of one st...
I'm currently implementing a complex microbial food-web in Python using SciPy.integrate.ode. I need the ability to easily add species and reactions to the system, so I have to code up something quite general. My scheme looks something like this:
class Reaction(object):
def __init__(self):
#stuff common to all reactions
d...
How would I use the subprocess module in Python to start a command line instance of MAPLE to feed and return output to the main code? For example I'd like:
X = '1+1;'
print MAPLE(X)
To return the value of "2".
The best I've seen is a SAGE wrapper around the MAPLE commands, but I'd like to not install and use the overhead of SAGE for ...
I am trying to develop a GNOME applet (put into panel) using python (pyGTK). I've started by following the tutorial suggested in other SO question.
My plan is to let the applet do something in the background in a repetitive fashion (causing its display to be updated). So I thought I am gonna need threads to do it. I've seen several tut...
My array maximum dimension could be 2x27,but number of columns could be lower than 27.Number of columns depends on some condition.Is good solution to initialize array 2x27 and then delete unnecessary columns or has more elegant way to do this?
...
thelist = [{'color':'green', 'time':4}, {'color':'red','time':2},{'color':'blue','time':5}]
How do I say:
If "red" is in thelist and time does not equal 2 for that element (that's we just got from the list):
...
Hi,
I'm looking for a way to produce HTML files from a git-diff output, preferably using python. I've been looking at http://docs.python.org/library/difflib.html without being able to figure out how to use the git-diff output as an input.
Any clue?
Many thanks
...
I have a python script to download source code from a list of repositories, some of them are big.
Sometimes, svn hangs in the middle of a check out. Is there a way to watch over svn process, and so I know it is hang or not?
...
I'm writing a script in Python that will allow the user to input a string, which will be a command that instructs the script to perform a specific action. For the sake of argument, I'll say my command list is:
lock
read
write
request
log
Now, I want the user to be able to enter the word "log" and it will peform a specific action, whi...
Hi all
Im trying to embed a display from an alien application (python OCC) into (Py)Qt using the winId of the widget. But when i pass it to OCC i get an overflow error.
Inspecting the winId qt returns its 4318283408 which is more than a 32bit number. Im running 64bits (osx) and both libraries are compiled for 64bit, but i have a hunch t...
I'm looking for a way to store a number of points, zipcode and their latitude and longitude in a database, and given a query point Q's lat and longitude, find the set of the points in the DB that are within x miles of the point Q.
I realize something like a kd-tree would do the trick. I was wondering if there is any built-in python libr...
I would like to take bites out of a list (or array) of a certain size, return the average for that bite, and then move on to the next bite and do that all over again. Is there some way to do this without writing a for loop?
In [1]: import numpy as np
In [2]: x = range(10)
In [3]: np.average(x[:4])
Out[3]: 1.5
In [4]: np.average(x[4:8])
...
class Square:
def __init__(self,start,stop):
self.value = start - 1
self.stop = stop
def __iter__(self):
return self
def next(self):
if self.value == self.stop:
raise StopIteration
self...
In the Python interactive interpreter:
I am importing a module that contains a class. These are the methods of that class (some of them):
def do_api_call(self, params):
return self.__apicall(params)
def __apicall(self, params):
return urllib2.urlopen(self.endpoint, params).read()
When I import the class and u...
Can you recommend some good python library to get thesaurus and taxonomy of a give word?
Synonym:
>>> print get_synonym('image')
['picture', 'photo']
Taxonomy:
>>> print get_taxonomy('baseball')
['sports']
...
I want to create a vector in numpy using 3 components Vx, Vy, Vz as sown below. Can anyone help? Thank you
from numpy import cos, sin
Vx = cos(alpha)* cos(beta)
Vy = sin(alpha)*cos(beta)
Vz = sin(beta)
...
Let's say i have an array of Tuples, s, in the form of:
s = ((1, 23, 34),(2, 34, 44), (3, 444, 234))
and i want to return another Tuple, t, consisting of the first element per row:
t = (1, 2, 3)
Which would be the most efficient method to do this? I could of course just iterate through s, but is there any slicker way of doing it?
...
I'd like to be able to parse out the city, state or zip from a string in python. So, if I entered
Boulder, Co
80303
Boulder, Colorado
Boulder, Co 80303
...
any variation of these it would return the city, state or zip.
This is all going to be user inputted data and inputted in one text field.
...