python

Eclipse + Git - what does "staged" mean?

Hello! After working for some time with SVN I decided to try git with my new django project and installed the plugin for it into eclipse. I made a new pydev project and added django initial project files to the src directory. Then I "shared" the project to Git, added and commited all files. Now I have strange problems - all files exce...

Web crawlers and Google App Engine Hosted applications

Is it impossible to run a web crawler on GAE along side with my app considering the I am running the free startup version? ...

Are there any build-in cross-thread events in python?

Hello. Is there any build-in syntax in python that allows me to post a message to specific python thread inside my problem? Like 'queued connected signal' in pyQt or ::PostMessage() in Windows. I need this for asynchronous communication between program parts: there is a number of threads that handle network events and they need to post t...

Is there a cross-platform python low-level API to capture or generate keyboard events?

I am trying to write a cross-platform python program that would run in the background, monitor all keyboard events and when it sees some specific shortcuts, it generates one or more keyboard events of its own. For example, this could be handy to have Ctrl-@ mapped to "my.email@address", so that every time some program asks me for my ema...

Intercepting changes of attributes in classes within a class - Python

I have been messing around with pygame and python and I want to be able to call a function when an attribute of my class has changed. My current solution being: class ExampleClass(parentClass): def __init__(self): self.rect = pygame.rect.Rect(0,0,100,100) def __setattr__(self, name, value): parentClass.__setattr__(sel...

How do I notify a process of an SQLite database change done in a different process?

Let's say I have two or more processes dealing with an SQLite database - a "player" process and many "editor" processes. The "player" process reads the database and updates a view - in my case it would be a waveform being mixed to the soundcard depending on events stored in the database. An "editor" process is any editor for that data...

verbose_name_plural unexpected in a model?

Hi! I've been doing some models of a future app, and, after adding verbose_name and verbose_name_plural to every entry on a working model, for making it 'beautiful', I've found that at validate time, Django doesn't like that, so it says: File "/home/andor/Documentos/desarrollo/grundymanage/../grundymanage/concursantes/models.py", lin...

condition coverage in python

Is there any tool/library that calculate percent of "condition/decision coverage" of python code. I found only coverage.py but it calculates only percent of "statement coverage". ...

Python SVN bindings for Windows

Where can I find precompiled Python SWIG SVN bindings for Windows? ...

What's the best online tutorial for starting with Spring Python

Spring Python seems to be the gold-standard for how to define good quality APIs in Python - it's based on Spring which also seems to be the gold-standard for Java APIs. My manager has complained (with good reason) that our APIs are in a mess - we need to impose some order on them. Since we will be re-factoring it makes sense to take ad...

How to check if an RGB image contains only one color?

I'm using Python and PIL. I have images in RGB and I would like to know those who contain only one color (say #FF0000 for example) or a few very close colors (#FF0000 and #FF0001). I was thinking about using the histogram but it is very hard to figure out something with the 3 color bands, so I'm looking for a more clever algorithm. An...

Using 'old' database with django

I'm using a hand built (Postgres) database with Django. With "inspectdb" I was able to automatically create a model for it. The problem is that some tables have multiple primary keys (for many-to-many relations) and they are not accessible via Django. What's the best way to access these tables? ...

distutils: How to pass a user defined parameter to setup.py?

Hi, Please prompt me how to pass a user-defined parameter both from the command line and setup.cfg configuration file to distutils' setup.py script. I want to write a setup.py script, which accepts my package specific parameters. For example: python setup.py install -foo myfoo Thank you, Mher ...

wxPython: Making a scrollable DC

Hey, I am drawing inside a wx.Window using a PaintDC. I am drawing circles and stuff like that into that window. Problem is, sometimes the circles go outside the scope of the window. I want a scrollbar to automatically appear whenever the drawing gets too big. What do I do? ...

How can I record live video with gstreamer without dropping frames?

I'm trying to use gstreamer 0.10 from Python to simultaneously display a v4l2 video source and record it to xvid-in-avi. Over a long period of time the computer would be fast enough to do this but if another program uses the disk it drops frames. That's bad enough, but on playback there are bursts of movement in the video where frames we...

How to extract from a list of objects a list of specific attribute?

I have a list of objects. Object has 3 string attributes. I want to make a list containing only a specific attribute from class. Is there any built-in functions to do that? ...

Specifying different template names in Django generic views

Hi, I have the code in my urls.py for my generic views; infodict = { 'queryset': Post.objects.all(), 'date_field': 'date', 'template_name': 'index.html', 'template_object_name': 'latest_post_list', } urlpatterns += patterns('django.views.generic.date_based', (r'^gindex/$', 'archive_index', infodict), ) So going to the address /gindex...

Python and MySQL: is there an alternative to MySQLdb?

Is there a module written purely in Python that will allow a script to communicate with a MySQL database? I've already tried MySQLdb without success. It requires too much: GCC, zlib, and openssl. I do not have access to these tools; even if I did, I don't want to waste time getting them to work together. I'm looking for tools that will m...

python and symbian - keystroke capture

Hey, I'm trying to write a simple prototyping appliaction in python to capture a users keystrokes while writing a text messages (SMS) to collect some stat info for use in a biometric application for Symbian based phones. I have never used python before and have had very little exposure to it. However, I did come across an example http:/...

Doctest for dynamically created objects.

What is the best way to test code like this (the one below obviously fails while object is created in different block every time): def get_session(db_name, verbose, test): """Returns current DB session from SQLAlchemy pool. >>> get_session('Mmusc20090126', False, True) <sqlalchemy.orm.session.Session object at 0xfb5ff0> """ if test: ...