I'm thinking it may be beneficial to sprinkle some debug logging throughout my app (a painting-type program), and to have this info written to a file. My current debugging strategy is to hook up a custom exception listener (sys.excepthook) and to allow the user to e-mail me a copy of the stack trace that caused the crash.
This has been ...
Hello!
I am having some trouble using httplib2.
When I browse to the page with Google Chrome and save the source the file is about 106kB. When I request the file with httplib2 i only get 99.x kB and there is missing a lot of text in the beginning of the file. Is there some kind of size limit on bytes objects? Am I doing something wrong...
I'm moving a Google App Engine web application outside "the cloud" to a standard web framework (webpy) and I would like to know how to implement a memcache feature available on Gae.
In my app I just use this cache to store a bunch of data retrieved from a remote api every X hours; in other words I don't stress this cache too much.
I'v...
Possible Duplicate:
Conversion of strings like \\uXXXX in python
Hi, suppose I have the string
test
'\\u0259'
Note the escaped backslash.
How do I convert it to the respective unicode string?
...
Hey, I've got a list like
alist = [[a,b,(1,2)], [a,b,(1,2)], [a,b,(1,2)]]
I want to remove the third element from all the elements in alist, or it means the last one in the elements of a list
So the result will be
alist = [[a,b], [a,b], [a,b]]
Do we have any fast way to do this? Thanks!
Your script works in python shell, but does...
I am quite new to programing so I hope this question is simple enough.
I need to know how to convert a string input of numbers separated by spaces on a single line:
5.2 5.6 5.3
and convert this to a float list
lsit = [5.2,5.6,5.3]
How can this be done?
...
Hi,
I'm trying to parse large XML files (>3GB) like this:
context = lxml.etree.iterparse(path)
for action,el in self.context:
# do sth. with el
With iterparse I thought the data is not completely loaded into RAM, but according to this article I'm wrong:
http://www.ibm.com/developerworks/xml/library/x-hiperfparse/ (see Listing 4)
...
Hey, I've got so many PIL bounding box(x,y, x1,y1)
I just want to know how many colors are there in the bounding box, is there any fast way to do?
...
So I am using one third party library which is not very well documented. It has a method which takes a picture with camera and this is what it returns:
'E{\x7fM{\x7f;\x89\x89:\x89\x89=\x81\x87<\x81\x87O\x90\x7fJ\x90\x7fB\x87\x80I\x87\x80<{\x81={\x81A\x81\x82A\x81\x82E\x81\x81:\x81\x818\x80\x81?\x80\x81?\x8c\x85C\x8c\x85Dw\x84Kw\x84K\x81...
I'd like to know how I can serialize an XML document in python specifically using the xml.dom library.
...
Ok. I'm working with GAE. And i want create something like this:
I have types "group" "topic" "tag":
each "group" can have as many
"topics" as needed
each "topic" can have as many "tags"
as needed
each "group" can have as many "tags"
as needed
it's something like circle.
right now i have something like this:
class TopicGroup(db.Mo...
Hi, I have just started working on web2py. Personally, I find it easier to learn than Django.
My query is that I have to load a file at application startup. Its a pickled hashtable. Where should I store this file so that the system is able to see it
My code is :
import cPickle as pickle
def index():
"""
Load the file into memo...
Here's the code:
import urllib2
import base64,hashlib,hmac,time
from urllib import urlencode
from xml.dom import minidom
AWS_ACCESS_KEY_ID = "secret"
AWS_SECRET_ACCESS_KEY = "secret"
base_url = "http://ecs.amazonaws.com/onca/xml"
url_params = {"Version": "2010-09-01",
"Operation": "ItemSearch",
"ResponseGro...
I found some code for a Tkinter status bar. I love this code and want to use it to display the progress of a file download. How would I add this functionality?
Here Is The Code:
import Tkinter
class Meter(Tkinter.Frame):
def __init__(self, master, width=300, height=20, bg='white', fillcolor='orchid1',\
value=0.0...
Something like:
host = getHost(id)
>>> 172.16.25.52
Ideally, the algorithm should minimize the number of cache misses when the pool of servers is expanded / contracted.
Are there any known algorithms out there that do this? Or libraries, potentially (I'm using Python).
Thank you.
...
I haven't find a documentation about pynotify... so I don't know what pynotify.init() funciont stand for. Help me :)
...
Im trying to parse a list of video game titles from a shopping site. however as the item list is all stored inside a tag .
This section of the documentation supposedly explains how to parse only part of the document but i cant work it out. my code:
from BeautifulSoup import BeautifulSoup
import urllib
import re
url = "Some Shopping ...
In my organization, we have a couple of internally developed Python packages. For sake of example, let's call them Foo and Bar. Both are developed in separate Git repositories. Foo is a Pylons application that uses certain library functions from Bar. Neither is publicly distributed.
When we deploy Foo, we typically export the latest rev...
Hi, i've got a project in a virtualenv, which uses python2.6, but now i'd like to make it use python2.7. Is there a way to do this without having to backup my project files, re-create the virtualenv for the right python version, and then copy my files back in the virtualenv?
This does not seem to be a big task to do by hand, but being a...
I've inherited the maintenance of some scientific computing using Parallel Python on a cluster. With Parallel Python, jobs are submitted to a ppserver, which (in this case) talks to already-running ppserver processes on other computers, dishing tasks out to ppworkers processes.
I'd like to use the standard library logging module to log...