I'm going through the documentation and I'm a little confused as to how memcache does internal load-balancing if multiple servers are specified. For example:
import memcache
mc.set_servers(['127.0.0.1:11211','127.0.0.1:11212',])
mc.set("some_key", "Some value")
print mc.get("some_key")
Will the setting and retrieval of key "some_key"...
Hi, I found a function that will help me load a disk sqlite database to a memory database, but have found that the module I need, apsw, doesn't support it, while pysqlite does. I need apsw because it has most of the functions I need that pysqlite does not. Is there any work around To completely copying to a database?
...
I'm choosing between these two languages, in contrast to another question here. My program going to be set of scripts checking files, free space, checking that apps are running etc. and writing information to database. Then PHP web page will show results.
Python have more examples of winapi calls (at least at StackOverflow) and more att...
Please forgive the bad title - I had a hard time trying to think of a concise way to explain this.
I have a Python class that will have some underlying objects of other classes. I want to be able to create these underlying objects via a method of the original object. Let me try to explain better with an example:
class Foo:
def __in...
I need to include a progress bar in my wxpython application, but the examples I found use a timer counting down from a fixed time length. Since I have no idea how long it will take a given computer to run my process, I want the progress bar to simply update whenever each specific step is completed.
I modified some sample code to accomp...
I'm storing JSON down as blob/text in a column using MySQL. Is there a simple way to convert this into a dict using python/SQLAlchemy?
...
Hey guys. I'm trying to do something in pyGTk where I build a list of HBoxes:
self.keyvalueboxes = []
for keyval in range(1,self.keyvaluelen):
self.keyvalueboxes.append(gtk.HBox(False, 5))
But I then want to run over the list and assign A text entry & a label into each one both of which are stored in a list.
I'm sorry I'm not bei...
I have a numpy array and want to convert it into an ITK image for further processing. How do I do this without using the PyBuffer extension to WrapITK. I can't use that because I get a bunch of errors when compiling:
.../ExternalProjects/PyBuffer/itkPyBuffer.txx: In static member function ‘static PyObject* itk::PyBuffer<TImage>::GetAr...
I have a Tkinter GUI where there is a Scale object. I have a callback assigned (by the command constructor parameter) to perform an action when the user changes the scale position. However, there is also a case where the value represented by the scale is modified externally, and so I set the scale position using Scale.set(). In this c...
Hi I want to parse a bibtex publications file and sort for specific fields (e.g. year) and filter certain content, to then put it on a website. I came across pybtex, which works as far as reading and parsing the bibtex file, but it is basically not documented and I can't figure out how to sort the entries.
Is pybtex the way to go (how c...
Very rusty with my Python. I have a list of Cost as strings. I'm trying to convert them to floats but when the cost is above $1000, the value is represented with a comma. float("1,000") returns an error:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
decimal("1,000")
TypeError: 'module' object is not call...
Hello Guys !
Here 's my code snippet
import gtk, webkit
window = gtk.Window()
browser = webkit.WebView()
url = "www.google.com"
browser.open(url)
Now I wanna get the web page title, script tags inside. So how can I do that ?
The documentation is not clear at these points and I only found documentation for Objective-C and I am tryin...
I downloaded html 1.13 package from Python site and as per instructions I doubleclicked on install.bat and installed it. I also added the directory C:\Python26\HTML.py-0.04 to PYTHONPATH. But when I try to import the module with
>>> from html import HTML
I still get ImportError: No module named html Can someone help me understand w...
Here's what I have tried so far. I'm just not too sure as to why it outputs as PST instead of GMT. I'm not sure if that's not the correct way to parse it, or to output it. Something seems to be wrong somewhere.
>>> x = time.strptime('Wed, 27 Oct 2010 22:17:00 GMT', '%a, %d %b %Y %H:%M:%S %Z')
>>> time.strftime('%a, %d %b %Y %H:%M:%S %Z...
Hey. I am trying to disable the Context Menu in a TextCtrl widget under wxpython (prevent the context menu from coming up when right clicked). If I create my on Menu and bind it to the right mouse click it will always show my menu but if I dont create menu under right mouse click event it automatically creates a standard conext menu, eve...
Hello,
I'm trying to write a python script that takes in one or two xml files and outputs one or two new files based on the contents of the input files. I was trying to write this script using the minidom module. However, the input files contain a number of instances of the escape character
inside node attributes. Unfortunately, in...
I am having serious issues setting up a proper tunnel in paramiko to enable a database connection. I have reviewed the example 'forward.py', but am not understanding how to then link the database connection to it. Any pointers woudl be much appreciated.
I think I need something the following:
t = paramiko.Transport((hostname, port))
...
Building on this question, now I have another problem. Given this,
shipments = Shipment.objects.filter(filter).exclude(**exclude).order_by(order) \
.annotate(num_bids=Count('bids'), min_bid=Min('bids__amount'), max_bid=Max('bids__amount')) \
.select_related('pickup_address','dropoff_address','billing_address')
return HttpRespon...
I have a logger that functions properly at the start of a script, then breaks in the middle. It looks like its handler is getting overwritten by a str, but I can't figure out where.
At the start of the script, I'm printing the handler and its level. The following code:
print 'Array of handlers', logger.handlers
for h in logger.ha...
Hello,
I have some simple data stored in series of text files. Once line per record, but number and type of fields can vary per record.
The files contain almost the same data.
The exists an "ideal" data file to which these must be compared. Some fields can vary, but some need to match. I also need to now if any records are missing ...