Hi,
I am trying to make an app for authenticating user with their facebook account in python. App opens the facebook login page in web browser. After user logs in, facebook redirects it to thei dummy success page. At that moment i need to capture that redirect url in my app. I am not able to catch that URL.
I am opening fb login page ...
Hi, I've got an Nonetype value x, it's generally a number, but could be None. I want to divide it by a number, but python says
TypeError: int() argument must be a string or a number, not 'NoneType'
How could I solve that
...
Hi
Here is my requirement. I want to tokenize and tag a paragraph in such a way that it allows me to achieve following stuffs.
Should identify date and time in the paragraph and Tag them as DATE and TIME
Should identify known phrases in the paragraph and Tag them as CUSTOM
And rest content should be tokenized should be tokenized by th...
How do you execute nosetest from pycharm to run all unit tests?
I know that pycharm supports python's unittest and py.test and that they will properly support nosetests in pycharm 1.1 but I was wondering if there was a work around.
...
Given a form class (somewhere deep in your giant Django app)..
class ContactForm(forms.Form):
name = ...
surname = ...
And considering you want to add another field to this form without extending or modifying the form class itself, why does not the following approach work?
ContactForm.another_field = forms.CharField(...)
(...
Hi all. using app engine - yes i know all about django templates and other template engines.
Lets say i have a dictionary or a simple object, i dont know its structure and i want to serialize it into html.
so if i had
{'data':{'id':1,'title':'home','address':{'street':'some road','city':'anycity','postal':'somepostal'}}}
want i want...
I have a class that represents a pretty complex object. The objects can be created by many ways: incremental building, by parsing text strings in different formats and by analyzing binary files. So far my strategy was as follows:
Have the constructor (__init__, in my case) initialize all the internal variables to None
Supply different ...
hi,
I have made a Config file and have multiple values for a keyword as:
[section]
database: mysql , sqlite
and i want to access the values separately..How to go about it??
...
Hi,
code below sometimes not print whole content of founded element.
file=open(sys.argv[1])
events = pulldom.parse(file)
for event, node in events:
if event == pulldom.START_ELEMENT:
if node.tagName == 'item':
# DOM processing
events.expandNode(node)
print node.getElementsByTagName('x')....
I have the following UDP server using Twisted:
# init the thread capability
threadable.init(1)
# set the thread pool size
reactor.suggestThreadPoolSize(32)
class BaseThreadedUDPServer(DatagramProtocol):
def datagramReceived(self, datagram, (host, port)):
#do some stuff here...
def main():
reactor.listenUDP(PORT, BaseT...
hi,
I'm new to TKinter and I was wondering if I can display a sequence of widgets on the same row instead of placing them one below the other one in a column.
I'm currently using frames to place my components, however if I have several widgets (buttons) in a frame, I would prefer to directly place the button as I want instead of creati...
how can initialize empty objects in python ?
I need to initialize my class members (for examples tk.frames, vtk visualizations etc)
thanks
...
Hallo,
I have some troubles understanding the python reference count.
What I want to do is return a tuple from c++ to python using the ctypes module.
C++:
PyObject* foo(...)
{
...
return Py_BuildValue("(s, s)", value1, value2);
}
Python:
pointer = c_foo(...) # c_foo loaded with ctypes
obj = cast(pointer, py_object).value
I'm...
I found, that there is related question, about how to find if at least one item exists in a list:
http://stackoverflow.com/questions/740287/python-check-if-one-of-the-following-items-is-in-a-list
But what is the best and pythonic way to find whether all items exists in a list?
Searching througth the docs I found this solution:
>>> l =...
I would like to make a decorator which could be used with or without a parameter :
Something like this :
class d(object):
def __init__(self,msg='my default message'):
self.msg=msg
def __call__(self,fn):
def newfn():
print self.msg
return fn()
return newfn
@d('T...
Hi folks,
I can't seem to find how to generate the classic Facebook Connect button:
all I can find how to generate is the following:
I'm using the documentation here http://developers.facebook.com/docs/guides/web
Any ideas? :)
...
I'm using win32com to write some dates that I receive from a database, and my problem is that I'm having values like '01' and in Excel is just '1' - not '01'.
Example:
b = row[1] # b has the value 01
c = "-"+b+"-" # c has value -01-
sheet.Cells(1,1).Value = b # I have in Excel '1' ; I've try with str(b), c - but is the sam...
Well, the question pretty much summarises it. My db activity is very update intensive, and I want to programmatically issue a Vacuum Analyze. However I get an error that says that the query cannot be executed within a transaction. Is there some other way to do it?
...
As I am studying decorators, I noticed something strange :
def f():
... msg='aa'
... def a():
... print msg
... msg='bb'
... def b():
... print msg
... return a,b
...
>>> a,b = f()
>>> a()
bb
>>> b()
bb
>>>
Why a() returns 'bb' and not 'aa' ??
...
Possible Duplicate:
Easy JSON encoding with Python
I want to get a record from database and built it in to json. I know we can do it with json_encode when using PHP. But how can we do it in Python
...