I'm just getting started on building a Python app for Google App Engine. In the localhost environment (on a Mac)
I'm trying to send debug info to the GoogleAppEngineLauncher Log Console via logging.debug(), but it isn't showing up. However, anything sent through, say, logging.info() or logging.error() does show up. I've tried a loggi...
The title describes the question pretty much.
...
If I do the following
def mydecorator(f):
def wrapper(*args, **kwargs):
f(*args, **kwargs)
wrapper.__doc__ = f.__doc__
wrapper.__name__ = f.__name__
return wrapper
@mydecorator
def myfunction(a,b,c):
'''My docstring'''
pass
And then type help myfunction, I get:
Help on function myfunction in module __...
Suppose I have a bulleted list like this:
* list item 1
* list item 2 (a parent)
** list item 3 (a child of list item 2)
** list item 4 (a child of list item 2 as well)
*** list item 5 (a child of list item 4 and a grand-child of list item 2)
* list item 6
I'd like to parse that into a nested list or some other data structure which ma...
Hi! I'm doing my VERY first project using python/django/eclipse/pydev following this guide
http://docs.djangoproject.com/en/dev/intro/tutorial01/
My only addition is the use of Eclipse/pydev.
I'm getting many errors related to "Unresolved imports". I can remove the errors using "remove error markers" and my site runs perfect (I can br...
I already posted this, but here is the exact code:
x1 = input("")
x2 = input("-")
x3 = input("-")
x4 = input("-")
So, how would I do it so that there are no spaces between the first input and the next "-"?
Example:
1234-5678-9101-1121
...
I Have several forms in my website and I have several pages with intense database activity. I want to set a cap on requests per user. For example, I don't want people to make over 10 requests in less than 10 seconds.
Is there way to do this in Django?
...
Usual method of applying mathematics to variables is
a * b
Is it able to calculate and manipulate two operands like this?
a = input('enter a value')
b = input('enter a value')
op = raw_input('enter a operand')
then how do i connect op and two variables a and b?? i know i can compare op to +, -, %, $ and then assign and compute......
Ok, I've been crawling google and Django documentation for over 2 hours now (as well as the IRC channel on freenode), and haven't been able to figure this one out.
Basically, I have a model called Room, which is displayed below:
class Room(models.Model):
"""
A `Partyline` room. Rooms on the `Partyline`s are like mini-chatrooms....
Here's a simple function to do simple math operations, when i call this from other program using import, output i get is none. When i remove def function, everything is working fine. What's the problem with defining this function? I'm new to python.
def calci(a, op, b):
if op == '+':
c = a + b
elif op == '-':
...
I'm sure everyone knows the joys of concurrency when it comes to threading.
Imagine the following scenario on every page-load on a noobily set up MySQL db:
UPDATE stats SET visits = (visits+1)
If a thousand users load the page at same time, will the count screw up? is this that table locking/row locking crap? Which one mysql use.
...
I'm in the process of trying to switch from R to Python (mainly issues around general flexibility). With Numpy, matplotlib and ipython, I've am able to cover all my use cases save for merging 'datasets'. I would like to simulate SQL's join by clause (inner, outer, full) purely in python. R handles this with the 'merge' function.
I've t...
Hi there,
I think I tried to ask for far too much in my previous question so apologies for that. Let me lay out my situation in as simple a manner as I can this time.
Basically, I've got a bunch of dictionaries that reference my objects, which are in turn mapped using SQLAlchemy. All fine with me. However, I want to make iterative chan...
This Question has been asked before:
http://stackoverflow.com/questions/2936626/how-to-share-a-dictionary-between-multiple-processes-in-python-without-locking
However I have several doubts regarding the program given in the answer:
The issue is that the following step isn't atomic
d['blah'] += 1
Even with locking the answer provi...
I'm completely new to programming and I'm trying to build an autorespoder to send a msg to a specific email address.
Using an if statement, I can check if there is an email from a certain address in the inbox and I can send an email, but if there are multiple emails from that address, how can I make a for loop to send an email for eve...
Hi all -
I'm attempting to write a Python wrapper for poker-eval, a c static library. All the documentation I can find on ctypes indicates that it works on shared/dynamic libraries. Is there a ctypes for static libraries?
I know about cython, but should I use that or recompile the poker-eval into a dynamic library so that I can use cty...
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib2
import urllib
import httplib
import Cookie
import cookielib
Login = 'user'
Password = 'password'
Domain = 'inbox.ru'
Auth = 'https://auth.mail.ru/cgi-bin/auth'
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
login_data = urllib.urlencode...
Hi,
I'm writing a parser in Python. I've converted an input string into a list of tokens, such as:
['(', '2', '.', 'x', '.', '(', '3', '-', '1', ')', '+', '4', ')', '/', '3', '.', 'x', '^', '2']
I want to be able to split the list into multiple lists, like the str.split('+') function. But there doesn't seem to be a way to do my_list.s...
I want to execute an external program in each thread of a multi-threaded python program.
Let's say max running time is set to 1 second. If started process completes within 1 second, main program capture its output for further processing. If it doesn't finishes in 1 second, main program just terminate it and start another new process.
H...
I'm trying to parse an xml file using lxml. xml.etree allowed me to simply pass the file name as a parameter to the parse function, so I attempted to do the same with lxml.
My code:
from lxml import etree
from lxml import objectify
file = "C:\Projects\python\cb.xml"
tree = etree.parse(file)
but I get the error:
Traceback (most rece...