Hello,
Is there a way to use a real database(SQLite, Mysql, or even some non-relational one) as datastore for development, instead of memory/file datastore that is provided.
I saw few projects, GAE-SQLite(did not seem to be working) and one tip about accessing production datastore using remote api (still pretty slow for large datasets...
Sooo I started taking my second computer science class ever! For my first class we used python and for this class we're using Java. Our first assignment (pretty much just practice) is to convert this craps program from Python to Java and I'm just having a hell of a time.
Could someone please help with what I've done and umm give me som...
how to translate this piece of C code into Python >=2.6 ?
unsigned long memSum(unsigned char *p, unsigned long len)
{
unsigned long i, sum=0;
for(i=0; i<len; i++)
sum = sum + *p++;
return sum;
}
of course
f=open("file_to_sum",'rb')
m = f.read()
f.close()
sum( array.array('B', m) )
does not work
...
I'm creating an web app in Pylons, and am working on an image upload action. This is currently running using egg:paste#http on my windows machine, in the basic development configuration described in the pylons documentation quickstart.
When I POST an image to my application, then move the image to the web root directory, then pull the ...
I have an application running under apache that I want to keep "in the moment" statistics on. I want to have the application tell me things like:
requests per second, broken down by types of request
latency to make requests to various backend services via thrift (broken down by service and server)
number of errors being served per sec...
Hi Stackoverflow,
What would be the best way in Python to determine whether a directory is writeable for the user executing the script? Since this will likely involve using the os module I should mention I'm running it under a *nix environment.
...
How do I group query results by the hour part of a datetime column in SQLAlchemy?
...
I have a python script running inside the Google App Engine with boto 1.9b that gets all keys inside a S3-Bucket. The output is formated as a HTML-Table.
bucket_instance = conn_s3.get_bucket(bucketname)
liste_keys = bucket_instance.get_all_keys()
table = '<table>'
for i in range(laenge_liste_keys):
table = table + '<tr><td>'+str(lis...
How can I read an XML file using Python ElementTree, if the XML has multiple top-level items?
I have an XML file that I would like to read using Python ElementTree.
Unfortunately, it has multiple top-level tags. I would wrap <doc>...</doc> around the XML, except I have to put the <doc> after the <?xml> and <!DOCTYPE> fields. But figuri...
Though Windows is case insensitive, it does preserve case in filenames. In Python, is there any way to get a filename with case as it is stored on the file system?
E.g., in a Python program I have filename = "texas.txt", but want to know that it's actually stored "TEXAS.txt" on the file system, even if this is inconsequential for vario...
While searching for a solution to a python regular expression problem I found this page which demonstrates that [some version of] perl allows variables within regular expressions.
e.g. a perl regex something like:
^(?{ local $d=0}\((?{ $d++ }.*?\)(?d--)
Where variable $d is incremented and decremented depending on which part of the ...
Can py2exe create standalone executables even ones requiring the win32com package?
I've googled / searched SO to no avail.
...
I'm working with my hosting provider to get a Django application up and running, but neither of us are very experienced and we've basically hit a complete dead end.
I don't have direct access to the conf file but here's how its contents have been described to me:
<IfModule mod_wsgi.c>
WSGIScriptAlias /fredapp/ /home/fred/public_html/cg...
Hey all-
I'm using xml.dom.mindom in Python and have retrieved the book node in the below XML tree. I want to get a list of all children nodes. In this case, I would think there would only be one.
<Book>
<Title>Why is this so hard</Title>
</Book
When I call:
nodeList = bookNode.childNodes
print "nodeList has " + str(nodeList...
If I have to wrap an existing method, let us say wrapee() from a new method, say wrapper(), and the wrapee() provides default values for some arguments, how do I preserve its semantics without introducing unnecessary dependencies and maintenance? Let us say, the goal is to be able to use wrapper() in place of wrapee() without having to c...
Option 1:
def f1(c):
d = {
"USA": "N.Y.",
"China": "Shanghai"
}
if c in d:
return d[c]
return "N/A"
Option 2:
def f2(c):
d = {
"USA": "N.Y.",
"China": "Shanghai"
}
try:
return d[c]
except:
return "N/A"
So that I can then call:
for c in ("China", "Japan"):
for f in (f1, f2):
prin...
The MSI installers downloadable from python.org does not include Tcl/Tk header (not source) files (that are required to compile some packages like matplotlib). Does anyone know of the rationale behind not including them?
...
from django.db import models
from django.contrib.auth.models import User
class Product(models.Model):
name = models.CharField(max_length = 127)
description = models.TextField()
code = models.CharField(max_length = 30)
lot_no = models.CharField(max_length = 30)
inventory = models.IntegerField()
commited = models.IntegerField()
reorder = ...
In the 'old days' when there was just cpython, most extensions were written in c (as platform independent as possible) and compiled into pyd's (think PyCrypto for example). Now there is Jython, IronPython and PyPy and the pyd’s do not work with any of them (Ironclad aside). It seems they all support ctypes and that the best approach MI...
When using
from django.utils import simplejson
on objects of types that derive from db.Model it throws exceptions. How to circumvent this?
...