Is there a way for me to determine the total number of Twitter messages on a given trend topic (e.g. frequency of Twitter messages with subject matter on Haiti/#Haiti) at a given instance in time using the Twitter API? I'm writing a script in Python that will monitor Twitter traffic over a long spell of time and I was wondering how I cou...
Here's an example of what I mean:
class MyDecorator(object):
def __call__(self, func):
# At which point would I be able to access the decorated method's parent class's instance?
# In the below example, I would want to access from here: myinstance
def wrapper(*args, **kwargs):
return func(*args...
I am using the Python Imaging Library to colorize a black and white image with a lookup table that defines the color relationships. The lookup table is simply a 256-element list of RGB tuples:
>>> len(colors)
256
>>> colors[0]
(255, 237, 237)
>>> colors[127]
(50, 196, 33)
>>>
My first version used the getpixel() and putpixel() met...
Using scipy's interpolate.splprep function get a parametric spline on parameter u, but the domain of u is not the line integral of the spline, it is a piecewise linear connection of the input coordinates. I've tried integrate.splint, but that just gives the individual integrals over u. Obviously, I can numerically integrate a bunch of ...
{% load comments %}
where defined 'comments' ,a viewer? or a template??
thanks
...
One of the arguments I make to my (Microbiology and Genetics) students is that "data" is/are messy, and Python can help with that (of course other languages can too). So here is a practical kind of web-based data-gathering exercise.
I notice that there a few people who answer Python-related questions among the users with the highest re...
I see discussion about qt threads vs python threads but how do you create and call qt threads in python? how do you give it access to your functions in another thread?
Thanks!
...
After connecting to a socket and capturing the response using .read() how do I parse the input stream and read lines?
I see the data is returned without any CRLF
<html><head><title>Apache Tomcat/6.0.16 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font...
Hi there.
I need to build a native windows app using Python (and py2exe, I guess).
Feature requirements are:
Taskbar icon
Alert notifications (next to Taskbar Icon)
Chromeless window (ideally a pretty, rounded, coloured one).
Webkit to render some of the Chromeless window
So far I've identified the following possible toolkits:
pyG...
I working with python sqlite3 , I found we have commit and rollback option.
Does sqlite3 allows something like check point ?
For example: Initial state is empty.
...
insert something
...
commit
....
.....
insert something
commit.
update something
Found some problem.Now I want to roll back to initial state. Something like multiple und...
What is the most pythonic way to read in a named file, strip lines that are either empty, contain only spaces, or have # as a first character, and then process remaining lines? Assume it all fits easily in memory.
Note: it's not tough to do this -- what I'm asking is for the most pythonic way. I've been writing a lot of Ruby and Java ...
I'm currently using imaplib to fetch email messages from a server and process the contents and attachments.
I'd like to reply to the messages with a status/error message and links to the resulting generated content on my site if they can be processed. This should include the original message but should drop any attachments (which will ...
All,
Can t we do the following in templates
{% if subject.id == selected_id %}
and also cannot we assign variable like {{selected="selected"}}
Thank........
...
def rollback_savepoint(self):
try:
self.db.execute("rollback to savepoint pt;")
except:
print "roll back to save point failed"
else:
print "Roll back to save point. Done"
In above code snippet , It says "roll back to save point failed".
What went wrong?
EDIT:
I changed the code as shown below and ge...
This is an issue I already asked about and several got answers but the problem remained.
when I try to write in hebrew to an image using Image module I get instead of the hebrew lettring some other (ascii??) lettering. if I convert to unicode or ascii I get an error that it doesn't support. I got here a reference to a code that does what...
I have several decorators on each function, is there a way to pack them in to one instead?
@fun1
@fun2
@fun3
def do_stuf():
pass
change to:
@all_funs #runs fun1 fun2 and fun3, how should all_funs look like?
def do_stuf():
pass
...
All,
In Template condition check,whats wrong with the following code,
selected_id and selected_sub are equal to 5 but still ifequal loop is not working..
<tr><td><p>Subjects:</td>
<td>
<select id="subjects" name="subjects" multiple="multiple">
{% for subject in subjects %}
<option value="{{subject.id}}" {% for selected_id in selected_...
I have an issue with the django-filter application: how to hide the items that will produce zero results. I think that there is a simple method to do this, but idk how.
I'm using the LinkWidget on a ModelChoiceFilter, like this:
provider = django_filters.ModelChoiceFilter(queryset=Provider.objects.all(),
widget=django_filters.widg...
This is a python newbie question:
I have the following directory structure:
test
-- test_file.py
a
-- b
-- module.py
where test, a and b are folders. Both test and a are on the same level.
module.py has a class called shape, and I want to instantiate an instance of it in test_file.py. How can I do so?
I have tried:
from ...
Hi,
I'd like to have loglevel TRACE (5) for my application as I don't think that debug() is enought. Additionally log(5, msg) isn't what I want.
The question is, how can I add a custom log level to a Python logger?
Actually I've a mylogger.py with the following content:
import logging
@property
def log(obj):
myLogger = logging.ge...