python

Python: Video recording

Hi , I search module to Python aplication which allow me to record video from Video Signal. I saw this, but there is only possibility to make snapshots. Can Anyone help me or tell how to rebuild VideoCapture module. Mayby some kind of 'for' which will append following snapshots to the list and then make from them a video? ...

how to move all those imports to standalone file

Imagine situation: I have view directory with tons of different views. all views have about 6 lines with imports - in the beginning of the file. it's pretty damn hard copy paste those 6 lines every time I create new view. I usually using all those imports. from django.contrib.auth.models import User from django.contrib.auth.decorator...

Have well-defined, narrowly-focused classes ... now how do I get anything done in my program?

Hi everyone - I'm coding a poker hand evaluator as my first programming project. I've made it through three classes, each of which accomplishes its narrowly-defined task very well: HandRange = a string-like object (e.g. "AA"). getHands() returns a list of tuples for each specific hand within the string: [(Ad,Ac),(Ad,Ah),(Ad,As),(Ac,Ah...

In the python IDLE IDE, how do I set a breakpoint in a module other than the one I am running?

If I edit two modules, eggs and ham, and module eggs imports ham, how do I run module eggs such that IDLE stops at breakpoints set in ham? So far, I have only been able to get IDLE to recognize breakpoints set in the module actually being run, not those being imported. ...

Mapping python tuple and R list with rpy2 ?

Hello guys, I'm having some trouble to understand the mapping with rpy2 object and python object. I have a function(x) which return a tuple object in python, and i want to map this tuple object with R object list or vector. First, i'm trying to do this : # return a python tuple into this r object tlist robjects.r.tlist = get_max_ticks...

Accessing a XAMPP mysql via Python

Hi, I'm attempting to use mysql after only having worked with sqlite in the past. I've installed XAMPP on linux (ubuntu) and have mysql up and running fine (seems like that with phpMyadmin atleast). However, I'm having trouble getting the MySQLdb (the python lib) working {installed this using apt}. to be exact: >>> import MySQLdb >>> ...

errors compiling pygsl on mac os x

I am having trouble compiling Pygsl on Mac OS X, using GCC 4.2. I ran the following: sudo python setup.py install And got this error: In file included from testing/src/sf/sfmodule_testing.c:49: testing/src/sf/sf__data.c:779: error: ‘gsl_sf_exprel_n_CF_e’ undeclared here (not in a function) testing/src/sf/sf__data.c:806: error: ‘gsl_...

Pydev, eclipse and pythonpath problem.

Hi there. I've installed pydev to my eclipse 3.5.2. Everything was working smoothly, create projects, execute, test, autocomplete. But then I realized that importing modules from /usr/lib/pymodules/python2.6, such as django, causes error "Unresolved import: xxxx". Of course, PYTHONPATH SYSTEM includes the directories I want. What's mor...

Can I use Django F() objects with string concatenation ?

I want to run a django update through the ORM that looks something like this: MyModel.objects.filter(**kwargs).update(my_field=F('my_other_field')+'a string') This causes MySQL to throw an exception. Is there anyway to do this without writing raw SQL? ...

Using PyQt4.QtWebKit on a Debian server

Hi, I'm having a problem using PyQT4 on a Debian server. My script works fine on an Ubuntu Desktop machine, and I now want to deploy it on a server. Knowing it needed an X server, I launched one doing vncserver --display 800x600 :4242 I then exported the display : export DISPLAY=:4242 But my program keeps returning the error ...

Bitnami Trac 0.11.6 SVN Post commit hooks failing

Hi folks. Beating my head against a wall here for a day trying to get post commit hooks work so I can add refs/ close tickets in trac from an SVN commit. I used the bitnami trac stack to install and am fairly happy with the way its setup. Every commit though gives the error svn: MERGE of "/svn/Project": 200 OK (http://10.0.0.204) ...

Foreign key relationships missing when reflecting db in SqlAlchemy

I am attempting to use SqlAlchemy (0.5.8) to interface with a legacy database declaratively and using reflection. My test code looks like this: from sqlalchemy import * from sqlalchemy.orm import create_session from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() engine = create_engine('oracle://schemaname:...

@StaticMethod or @ClassMethod decoration on magic methods

I am trying to decorate the magic method __getitem__ to be a classmethod on the class. Here is a sample of what I tried. I don't mind using either classmethod or staticmethod decoration, but I am not too sure how to do it. Here is what I tried: import ConfigParser class Settings(object): _env = None _config = None def __init_...

How to check for EOF when using pipe file descriptors in Python?

I have 2 threads, Thread A and Thread B. Thread A takes data from either sys.stdin or from the read end of a pipe (using os.pipe()). Whatever data gets read (from either sys.stdin or from the read end of the pipe) gets sent out on a TCP socket. Thread A uses select.select() to determine whether it should read from sys.stdin or from th...

Generate headers in Twisted client

Hi All, i'm using the Twisted web "HTTPClient" protocol to dialogue with a http server (using twisted app as a client), the problem is that most of my request do not accept my header. Is there some sort of way (maybe using certain libraries) to generate header?? I'll post some code so you can have a look class Local(HTTPClient): def gen...

Check if space is in a string

http://paste.pocoo.org/show/240061/ I'm writing a program that checks whether the string is a single word. Why doesn't this work and is there any better way to check if a string has no spaces/is a single word.. ...

reordering list of dicts arbitrarily in python

I have a list of 4 dicts (always 4) that look something like this: [{'id':'1','name':'alfa'},{'id':'2','name':'bravo'},{'id':'3','name':'charlie'},{'id':'4','name':'delta'}] I know exactly the order I want them in, which is: 2, 3, 1, 4 what's the simplest way of reordering them? ...

Python SSL communication hangs on read, then issues an error 54 - connection reset by peer

I'm making a web services call to a Microsoft CRM web service using Python/suds/python-ntlm, and my call to the service is blocking on an SSL read. The CRM service provider provides both a testing and a production service, and I can contact the testing service just fine (although it doesn't have useful data on it) but the main service ju...

PyDev Question: Setting breakpoints in doctests

Is it possible to set breakpoints in doctests, using PyDev (i.e. eclipse)? I found that while I am seemingly able to do so, the breakpoints do not work at all. To have some code in the question, and to clarify, say I have def funct(): """ >>> funct() Whatever """ print "Whatever" and that I set a breakpoint at the funct() ...

Calling AutoIt Functions in Python

I have seen this post mentioned there is an AutoIt3 COM version, and with it I can call AutoIt functions in Python. I couldn't find the COM version at the AutoIt website. Is it hidden somewhere? How can I get it? ...