What libraries out there let you control the download speed of network requests (http in particular). I don't see anything built-in in urllib2 (nor in (Py)Qt which I intend on using).
Can Twisted control bandwidth? If not, how can I control the read buffer size of urllib2 or Twisted? sleeping to suspend network operations isn't an optio...
I have a model with 5 entities and intend to create a form (on the same page) but do not know how to integrate more than one form.
In my main, i can play very well with the forms and write to database, but I need to put more fields on the page.
These fields are of different models.
**
My models:
Teacher, Account(ReferenceProperty...
I have a python script and I want to make it display a increasing number from 0 to 100% in the terminal, I know how to print the numbers on the terminal but how can I "rewrite" them so 0 turns into 1, 1 into 2, and so on until 100?
...
I'm using the tweepy library to make a small news application for my desktop in Python. As I've seen in the main web page: http://github.com/joshthecoder/tweepy it has support for identi.ca but I can't manage to log in correctly. To authenticate I do:
auth = tweepy.BasicAuthHandler(username, password)
api = tweepy.API(host = 'identi.ca/...
I have a program that fetches info from other pages and parses them using BeautifulSoup and Twisted's getPage. Later on in the program I print info that the deferred process creates. Currently my program tries to print it before the differed returns the info. How can I make it wait?
def twisAmaz(contents): #This parses the page (amazon ...
What is the most efficient way of serializing a numpy array using simplejson?
...
Hi,
I have the method:
def checkAgainstDate():
currentDate = date.today()
currentMonth = date.today().month
if currentMonth == 1
year = currentDate.year-1
return date(year, 11, 01)
elif currentMonth == 2:
year = currentDate.year-1
return date(year, 12, 01)
else
retu...
I've read through "Python for Dummies" and I'm ready to take the next step. I hear that practicing coding with the goal of creating something is the best way to learn. I'm a beginner in Python, and I'm looking for project ideas that I should attempt.
I'm looking to learn web app programming, so any project that would teach me this area ...
When should I use a Dictionary, List or Set?
Are there scenarios that are more suited for each collection?
...
In a Python project I'm working on, I'd like to be able to get a "human-readable" timezone name of the form America/New_York, corresponding to the system local timezone, to display to the user. Every piece of code I've seen that accesses timezone information only returns either a numeric offset (-0400) or a letter code (EDT) or sometimes...
I'm searching for any PEP 3124 implemenation or development process. I'm not very familliar with mailing list, but it seems that sequence "3124" have not appeared in Python mailing list during last year. Is there some information what is going on regarding this PEP ?
...
The questions says it all..
(On a Mac obviously)
...
I came across this great comparison chart between Python & Ruby.
I'm looking for a programming language that is truly a blend between Python and Ruby (with a slight lean towards Python).
I really like in Ruby that everything is an object (unlike Python). However, I really like in Python that things are immutable, so that code maintenan...
Suppose I have in python this object
class Foo:
def __init__(self, val):
self.val = val
and these two variables
a=Foo(5)
b=a
both b and a refer to the same instance of Foo(), so any modification to the attribute .val will be seen equally and synchronized as a.val and b.val.
>>> b.val
5
>>> b.val=3
>>> a.val
3
Now ...
I am creating a .png file like this:
import pygraphviz as pgv
G = pgv.AGraph()
G.add_nodes("a")
G.add_edge("b", "c")
G.layout()
G.draw("output.png")
How can I set the size of the output image?
...
I'm trying OpenID support for Google App Engine on a small project i have on my machine but when i call:
users.create_login_url(federated_identity = provider_url)
i get this error:
google_appengine/google/appengine/api/user_service_pb.py", line 178, in ByteSize
n += self.lengthString(len(self.destination_url_))
TypeError: object ...
How do I get a widget's "name"?
When I define a GUI using Glade, I can "name" the widgets of the window but how do I recover that property when I have a widget object instance?
I've tried get_property(), get_name() and $widget.name to no avail.
Update: I am using GtkBuilder file format (i.e. XML format).
Resolution: a fix I have used...
I have a mbp, but I've been lazy and have been using ubuntu for my python development thus far b/c its so easy to install modules etc.
How do you install modules on a mac? And best-practises with storing all .py files?
...
hey guys, beginner here. I have written a program that outputs files to .txt's and am using another to read them and use them. i have used a list to store these values (len(..) gives me 100 for all files). However, whenever i run this:
for w in range(1,20): # i want files file01-file20 excluding file00
for x in range(100):
c...
Hey guys,
Sorry for the beginner question, but I can't figure out cProfile (I'm really new to Python)
I can run it via my terminal with:
python -m cProfile myscript.py
But I need to run it on a webserver, so I'd like to put the command within the script it will look at. How would I do this? I've seen stuff using terms like __init__ ...