I'm building a database + tool that scours news feeds for a certain term. For example "food poisoning from nuts". I want to scour social media sites, news sites, major news aggregators, etc... for that term.
Question 1: What are some of the news
aggregator APIs out there?
Question 2: How Would you go about coding and
receiving only the...
I'm trying to write a simple GUI front end for Plurk using pyplurk.
I have successfully got it to create the API connection, log in, and retrieve and display a list of friends. Now I'm trying to retrieve and display a list of Plurks.
pyplurk provides a GetNewPlurks function as follows:
def GetNewPlurks(self, since):
'''Get new ...
Hi,
I ran across an odd problem while trying to transfer a project to a windows machine.
In my project I use a session handler (http://gaeutilities.appspot.com/session) it works fine on my mac but on windows I get:
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\webapp_init...
PdfFileReader reads the content from a pdf file to create an object.
I am querying the pdf from a cdn via urllib.urlopen(), this provides me a file like object, which has no seek. PdfFileReader, however uses seek.
What is the simple way to create a PdfFileReader object from a pdf downloaded via url.
Now, what can I do to avoid writing...
In a simple LightsOut game, when I click on a light I need to toggle the image on a button. I'm doing this with Tkinter, so I thought I'd just check and see what image is currently on the button (either 'on.gif' or 'off.gif') and set it to the other one, like this:
def click(self,x,y):
if self.buttons[x][y].image == self.on:
...
I am trying something like this:
result = db.GqlQuery("SELECT * FROM myDataMode COUNT(Employee) GROUP BY(Department) WHERE Salary > :1"10000)
And I am getting error :
BadQueryError: Parse Error: Expected no additional symbols at symbol count
Can any one please help me.
...
I have a setup where I send a dictionary through a multiprocessing.queue and do some stuff with it. I was getting an odd "dictionary size changed while iterating over it" error when I wasn't changing anything in the dictionary. Here's the traceback, although it's not terribly helpful:
Traceback (most recent call last):
File "/usr/li...
Since I'm pretty new this question'll certainly sound stupid but I have no idea about how to approach this.
I'm trying take a list of nodes and for each of the nodes I want to create an array of predecessors and successors in the ordered array of all nodes.
Currently my code looks like this:
nodes = self.peers.keys()
nodes.sor...
I wrote some Python code and it worked fine when using the "python". I then converted it to C using "Cython" and used distutils to compile it to a shared library. I then changed some of the code to Cython so it would run faster. But when I imported the .so module and tried to use the command I had "cdef"ed it said that the command didn't...
Hi all
i wish make little gui with pyqt4 that show the output of "dir c:\windows\" line by line
I'm looking for QlistView but i don't understand how do it.
Can anyone help me?
...
I am given a module as an object, and I need to import a submodule from it. Like this:
import logging
x = logging
Now I want to import logging.handlers using only x and not the name "logging". (This is because I am doing some dynamic imports and won't know the name of the module.)
How do I do this? If I do import x.handlers it fails....
Python: How to get the caller's method name in the called method?
Assume I have 2 methods:
def method1(self):
...
a = A.method2()
def method2(self):
...
If I don't want to do any change for method1, how to get the name of the caller (in this example, the name is method1) in method2?
...
I have a question related to mysql and python.
This command works on the shell, but not when I use os.execvp()
$./mysql -D test -e "show tables"
+----------------+
| Tables_in_test |
+----------------+
| sample |
+----------------+
The corresponding piece of code in python would be
def execute():
args = []
args.extend(sys.a...
1 -> 1
5 -> 3
10 -> 4
100 -> 7
1000 -> 10
How to count bits for a number in Python?
...
Hi,
I have a bunch of C macros the operation of which I need to simulate in python. I saw some pointers to pygccxml or ctypeslib etc. Are these the ways to go ? Or is there something out there that is better ?
The C macros if and when they change, I would like the python implementation to be auto generated rather than having to make ma...
Hi,
I was going over some pages from WikiVS, that I quote from:
because lambdas in Python are restricted to expressions and cannot
contain statements
I would like to know what would be a good example (or more) where this restriction would be, preferably compared to the Ruby language.
Thank you for your answers, comments and fe...
hi, in python, how can i access the variables of one function into another function, is it possible, i tried the global variable method but that doesn't work for me.
can someone help me, how to access the variables from one function to another function.
...
I'm using Python 2.x and I'm wondering if there's a way to tell if a variable is a new-style class? I know that if it's an old-style class that I can do the following to find out.
import types
class oldclass:
pass
def test():
o = oldclass()
if type(o) is types.InstanceType:
print 'Is old-style'
else:
print 'Is NOT old-...
Hey,
I am writing simple site that requires users and profiles to be handled. The first initial thought is to use django's build in user handling, but then the user model is too narrow and does not contain fields that I need. The documentation mentions user profiles, but user profiles section has been removed from djangobook covering dj...
I've got a python script that calls a bunch of functions, each of which writes output to stdout. Sometimes when I run it, I'd like to send the output in an e-mail (along with a generated file). I'd like to know how I can capture the output in memory so I can use the email module to build the e-mail.
My ideas so far were:
use a memor...