While I'm aware that you can't reference self directly in a decorator, I was wondering if it's bad practice to work around that by pulling it from args[0]. My hunch is that it is, but I want to be sure.
To be more specific, I'm working on an API to a web service. About half the commands require a token to be passed that can be later use...
I have this:
dictionary = { (month, year) : [int, int, int] }
I'd like to get a list of tuples/lists with the ordered data(by month and year):
#example info
list = [(8,2010,2,5,3),(1,2011,6,7,8)...]
I've tried several times but I can't get to a solution.
Thanks for your help.
...
I am attempting to use the tweepy api to make a twitter function and I have two issues.
I have little experience with the terminal and Python in general.
1) It installed properly with Python 2.6, however I can't use it or install it with Python 3.1. When I attempt to install the module in 3.1 it gives me an error that there is no modu...
I have a simple service that does approximately the following:
An HTTP client connects to the server
The server writes the sessionID of the client and the timestamp to the database, and in most cases just returns an empty response
(The cases when it does do real work and return actual data are irrelevant to this question)
In order t...
I want to upload files to a path that is still in my django project, but in my MEDIA_ROOT path.
When I try to do this I get a SuspiciousOperation error.
Here are the paths as defined in my settings file:
MEDIA_ROOT = os.path.join(os.path.dirname( __file__ ), 'static_serve')
UPLOAD_DIR = os.path.join(os.path.dirname( __file__ ), 'upl...
Is there any form of module in Python that will allow me to take mathematical equations for lines, arcs, and such, and graph them out on a plot? Basically a module that'll take my values and plot them on a graph with both an X and a Y coordinate (also the option of adding a Z coordinate would be nice too).
Something like this?
...
Hi folks,
I've written a small snippet that computes the path length of a given node (e.g. its distance to the root node):
def node_depth(node, depth=0, colored_nodes=set()):
"""
Return the length of the path in the parse tree from C{node}'s position
up to the root node. Effectively tests if C{node} is inside a circle
a...
There is a module I'd love to download, but it is only available in a zip file, how do I get such a file to work properly in python, so That I can import what I want?
This is in Windows 7 BTW.
...
I am new in python, and while reading a BeautifulSoup tutorial, I didn't understand this expression "[x for x in titles if x.findChildren()][:-1]" that i didn't understand? can you explain it
titles = [x for x in titles if x.findChildren()][:-1]
...
I want to create a server and client that sends and receives UDP packets from the network using Twisted. I've already written this with sockets in Python, but want to take advantage of Twisted's callback and threading features. However, I need help though with the design of Twisted.
I have multiple types of packets I want to receive, b...
Hello,
when I try to create a virtualenv that uses python2.5 I get the following error:
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 1489, in <module>main()
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 526, in main use_distribute=options.use_distribute)
File "/usr/local/lib/python2.6/dist-packa...
I need such functions in python:
-check external links count on site pages.
-check if some link is present on given page or not.
Does anybody know good solutions/libs for this task?
I think i should use BeautifulSoup here.., may be something more lib can help?
...
This question is sort of the opposite of this:
http://stackoverflow.com/questions/2317849/how-can-i-use-a-socks-4-5-proxy-with-urllib2
Let's say I use a SOCKS 5 proxy using the method accepted in that question. How would I revert it back to no proxy in the same process?
i.e
start process
use proxy
..
remove proxy
...
Maybe there is ...
Hi everyone.
What is the preferred/ usual way of storing data that is entered by the user when running a Python script, if I need the data again the next time the script runs?
For example, my script performs calculations based on what the user enters and then when the user runs the script again, it fetches the result from the last run....
youtube-dl is a python script that allows one to download youtube videos. It supports an option for batch downloads:
-a FILE, --batch-file=FILE
file containing URLs to download ('-' for stdin)
I want to setup some sort of queue so I can simply append URLs to a file and have youtube-dl process them. Currently, it does not remove f...
I've installed django/postgres on local django server and works fine. I'm trying to get Apache working. I've set up the mod_wsgi and was able to get a "Hello World", and restart Apache. I'm almost there, but when I bring up localhost/index.html I get this server error:
TemplateSyntaxError: Caught ImproperlyConfigured while rendering:...
If I had two strings, 'abc' and 'def', I could get all combinations of them using two for loops:
for j in s1:
for k in s2:
print(j, k)
However, I would like to be able to do this using list comprehension. I've tried many ways, but have never managed to get it. Does anyone know how to do this?
...
How can i check valid of html code with python?
i need closed tags check, and braces in tags params. Such as |a href="xxx'| and other possible validations, wich libs i can use for this?
...
I'll to explain this right:
I'm in an environment where I can't use python built-in functions (like 'sorted', 'set'), can't declare methods, can't make conditions (if), and can't make loops, except for:
can call methods (but just one each time, and saving returns on another variable
foo python:item.sort(); #foo variable takes the val...
How can I make the code snippet below refresh when I want?
For example, if I run it as it is now, the table.SetValue(0,0,'test') line will update the grid straight away. Is there anyway to change this behavior so that I can do an arbitrary amount of changes to the GridTableBase, and then ask for a refresh? If so, how can I change the co...