python

Python approach to Web Services and/or handeling GET and POST

I have been working with python for a while now. Recently I got into Sockets with Twisted which was good for learning Telnet, SSH, and Message Passing. I wanted to take an idea and implement it in a web fashion. A week of searching and all I can really do is create a resource that handles GET and POST all to itself. And this I am told is...

explorer right click context menu with python?

I'm wondering how to go about adding a menu item to explorers right click context menu. For instance, when I right click on a file I get things like winrars "Add to archive" I want something like that and I'm wondering how to do it with python. ...

Simpler framework than Django?

Django installation itself was quite a task (for a beginner like me) and reading a book to learn it would not be possible right now. I'm just looking to create simple test applications only to learn Python better, so I'm not ready for Django yet. Is there any simple web framework that can be used for test projects, so I don't have to sp...

Using Android's `Timer.schedule` in Python

Could someone explain how to use the Timer.schedule - that is used for scheduling tasks - in Python? Note that Python's time.sleep will not work in Android. ...

Index xml files from a outside website

Using python django I would like to access this site http://www.reta-vortaro.de/revo/ It is a dictionary site for a language called esperanto, I need to be able to search for a word, and get back its definition, it looks like Each Esperanto root word has an xml file, I need to index each xml file store the name of each xml file in...

What is the deal with the pony in Python community?

Pony references are in several places: http://www.mail-archive.com/[email protected]/msg44751.html http://pypi.python.org/pypi/django-pony/ http://djangopony.com/ Is there a cultural reference that I am missing? What is the deal with ponies? ...

Does Python have a module for parsing HTTP requests and responses?

httplib (now http.client) and friends all have conn.getresponse() and an HTTPResponse class, but the server-side operations of conn.getrequest() and an HTTPRequest class seem to be lacking. I understand that BaseHTTPServer and BaseHTTPRequestHandler can perform this functionality, but they don't expose these methods for use outside of t...

what does this code snippet do??

can somebody give me an explanation about the following code? from twisted.internet import protocol, reactor from twisted.protocols import basic class FingerProtocol(basic.LineReceiver): def lineReceived(self, user): self.transport.write(self.factory.getUser(user)+"\r\n") self.transport.loseConnection() class Finge...

assigning value to shell variable using a function return value from Python

hi, I have a Python function, fooPy() that returns some value. ( int / double or string) I want to use this value and assign it in a shell script. For example following is the python function: def fooPy(): return "some string" #return 10 .. alternatively, it can be an int fooPy() In the shell script I tried the followin...

Calling Python function in Django template

Inside a django template I'm trying to call the split function on one of the template variables and then get the last element, so I did something like this: {{ newsletter.NewsletterPath.split('/').-1 }} Unfortunately, it doesn't like the split. Some might suggest that I do the split in the view, but I'm not sure how to do that because...

Python Class attributes - resetting

Hi Whats the best way to reset class attributes in Python. I have a class whichs has about 20 class attributes, in my init I have class MyClass: def __init__(self) self.time=0 self.pos=0 self.vel=0 self.acc=0 self.rot=0 self.dyn=0 . These need to be reset on each iteration of my p...

XML to store system paths in Python with lxml

Hi, I'm using an xml file to store configurations for a software. One of theese configurations would be a system path like > set_value = "c:\\test\\3 tests\\test" i can store it by using: > setting = etree.SubElement(settings, > "setting", name=tmp_set_name, type = > set_type , value= set_value) If I use doc.write(output_file, m...

Python: Find identical items in multiple lists

I have a list of an arbitrary number of lists, for instance: [[1,2,3], [3,4,5], [5,6,7], [7,8,9]] Now I would like a list containing all elements that are present in more than one list: [3,5,7] How would I do that? Thanks! ...

Python and Boost - Trying to run vPython and getting __doc__ is read only error.

This is super urgent! Need to get vPython working, can anyone give me help on any way to do this? I'm running on Mac OS X with Python 2.6 , and recently downloaded vPython. Upon installation it also installs the Boost libraries for Python. Now, when I try to import the vPython libraries ('visual'), the following occurs: >>>import v...

Python# screenshot failure

I am using PIL(Python Imaging Library) for grabbing the image. But grabber() throws the following error message if I minimized the window img=ImageGrab.grab() File "C:\Python26\lib\site-packages\PIL\ImageGrab.py", line 47, in grab size, data = grabber() IOError: screen grab failed My browser shot factory is installed in a Win 2003...

Global hotkey poller via python for Mac OS X

I use this for Linux. And pyhook on windows. But I don't know what to use to register if a key is pressed (global - non-focused) on Mac OSX. How can one do this? I'm mostly looking at registering the modifier keys (ctrl/alt/shift etc.). ...

Create string(s) from list(s) items

Hi there, I have a list, list = ['foo','bar'] and now i want to create a string from each item. Each string is named as the item and has the value of the item foo = 'foo' bar = 'bar' Thanks to all, i will use a dict instead ...

What projects have a similar aim to the libcloud project, and how mature are they?

libcloud is a standard client library for many popular cloud providers, written in python: http://incubator.apache.org/libcloud/ ...

Help me understand Inorder Traversal without using recursion

I am able to understand preorder traversal without using recursion, but I'm having a hard time with inorder traversal. I just don't seem to get it, perhaps, because I haven't understood the inner working of recursion. This is what I've tried so far: def traverseInorder(node): lifo = Lifo() lifo.push(node) while True: ...

What are the cons of returning an Exception instance instead of raising it in Python?

Hi*, I have been doing some work with python-couchdb and desktopcouch. In one of the patches I submitted I wrapped the db.update function from couchdb. For anyone that is not familiar with python-couchdb the function is the following: def update(self, documents, **options): """Perform a bulk update or insertion of the given documen...