python

From a python cgi can I write to Lighttpd log file?

I have a python cgi script (just python, I didn't use any framework). It's served using Lighttpd on openSUSE. I would like to redirect my logging statements (like logging.info and so on) to be included to Lighttpd log file. If this can't be done, how can I create my own log file? ...

Is there any python lib to scrape search engine(S) results?

I am looking for a python library to scrape results from search engines (google, yahoo, bing, etc). I only found for google -> http://github.com/kevinw/xgoogle/tree/253db7ddc8603a9dcb038ae42684cf3499a22a4b Does someone knows one for multiple search engines? ...

Django users: get list of group, or how to convert MultipleChoiceField to ChoiceField

Hello, I've searched similar topics but haven't found what I need.. I extended Users model with UserAttributes model, some additional fields added and etc.. now I'm trying to make ModelForm out this.. so I have a little problem in here.. I WANT TO list groups as a ChoiceField not a MultipleChoiceField.. It's a requirement by specifica...

Some nice tutorial to introduce myself into the Telepathy API?

I would like to develop a bot for Empathy, but I don't know how to get started. I've read the Telepathy wiki, but I think it's very bad documented, does anybody know any nice tutorial? Better if it uses Python or C bindings. Thank you. ...

Storing and replaying binary network data with python

I have a Python application which sends 556 bytes of data across the network at a rate of 50 Hz. The binary data is generated using struct.pack() which returns a string, which is subsequently written to a UDP socket. As well as transmitting this data, I would like to save this data to file as space-efficiently as possible, including a ...

Search facebook status using Python

I've been looking at facebook API and Python SDK but I'm not sure which is the right tool to use. Can you give me an example of search a word in people status? ...

Why is Python 3.0 (or later) better?

I learned Python as my first serious (non BASIC) language about 10 years ago. Since then, I have learned lots of others, but I tend to 'think' in Python. When I look at the list of changes I do not see one I need this feature. I usually say to myself, hmm that would been a good way of doing it, but why change it now? Things like changin...

Deriving class from `object` in python

So I'm just learning python (I know plenty of other languages) and I'm confused about something. I think this is due to lack of documentation (at least that I could find). On a few websites, I've read that you should derive your classes from object: class Base(object): pass But I don't see what that does or why or when you shou...

Python 3.2 - GIL - good/bad?

Python 3.2 ALPHA is out. From the Change Log, it appears the GIL has been entirely rewritten. A few questions: Is having a GIL good or bad? (and why). Is the new GIL better? If so, how? UPDATE: I'm fairly new to Python. So all of this is new to my but I do at least understand that the existence of a GIL with CPython is a huge deal...

problems setting up Django - ValueError: Empty Module name

Hello, I've decided to play around a bit with Django (since I've heard so much about it). I'm walking through the tutorial here: http://docs.djangoproject.com/en/1.2/intro/tutorial01/#intro-tutorial01 about halfway through the tutorial, i'm asked to run this from my command line: python manage.py syncdb However, I'm getting this e...

How to build an undo storage with limit?

Dear All, I want build a data structure to store limited undo buffer, take store 6 dict data for example with below pseudocode: rawdict1 = {1} buffer = [{1}] rawdict1 = {2} buffer = [{2}{1}] # {1} stored on the postion rawdict1 = {3} buffer = [{3}{2}{1}] ... rawdict1 = {5} buffer = [{5}{4}{3}{2}{1}] # max length limit...

Python extensions - performance

Hi all, I am using Boost.Python to extend python program functionality. Python scripts do a lot of calls to native modules so I am really concerned about the performance of python-to-cpp type conversion and data marshaling. I decided to try exposing methods natively through Python C API. May be somebody already tried that before ? Any ...

pyqt installation question

Im planing to do some GUI development using pyqt4 pykde and python3.1 on Kubuntu 10.4. In the research I did I found out that most of the things are available as packages in repositories and some of the packages are preinstalled. Only thing is I'm not able to figure out what to install and what not to. Can someone please give me a list o...

rendering multipe html pages

I'm working on a project and i need to use multiple html pages to interact with my code like: viewing index.html first:- path = os.path.join(os.path.dirname(__file__), 'index.html') self.response.out.write(template.render(path, template_values)) and then when i press the sign out button the program should view this page:- path = o...

How can I make 'AJAX templates' in Pylons?

I've been getting into Pylons lately and was wondering how I could go about easily integrating AJAX functionality into my websites. Basically, lets say I had a login form that usually gets accessed via site.com/user/login. Now, generally, this will be handled via something like: class UserController(BaseController): def login(self):...

Confused how to import modules in python

If I want to use a 3rd party module like a python s3 module (boto http://boto.s3.amazonaws.com/index.html) or http://developer.amazonwebservices.com/connect/entry.jspa?externalID=134. Once I download the .py files, what do I do? Where does the python interpreter look when I import a module? Is there a 'lightweight' way of installing a...

Programming thunderbird Email Client?

Anyone has C#/Ruby/Python/Java or Perl scripts to get all the emails in a folder in Thunderbird client and download all the attachments? I have more than 200 resumes as attachment kept in Resumes folder of thunderbird and I need to download the attachment and categories them. Any API reference to program thunderbird would be great.. I ...

Python dictionary error

In the below code d_arr is an array of dictionaries def process_data(d_arr): flag2 = 0 for dictionaries in d_arr: for k in dictionaries: if ( k == "*TYPE" ): """ Here we determine the type """ if (dictionaries[k].lower() == "name"): dictionaries.update({"type" : 0}) fu...

How to wrap a python dict?

I want to implement a class that will wrap -- not subclass -- the python dict object, so that when a change is detected in a backing store I can re-create the delegated dict object. I intend to check for changes in the backing store each time the dict is accessed for a read. Supposing I was to create an object to act like this; what met...

Private Variables and Methods in Python

Which should I use _foo (an underscore) or __bar (double underscore) for private members and methods in Python? ...