python

IOError with Python and OpenCV

Hello, i want to do some OpenCV Basic Operations using Python. My Problem is that the Pythoninterpreter says that the file i want to open with cv.LoadImage() dont exists. But as you can see in my code and the and the Interpreter Output this file exists and the Program should be able to read it. Likly the answer is simple (im new at Pyt...

pysvn with svn+ssh

I'm working with pysvn, and I'm trying to find a decent way to handle repositories that are only accessible via svn+ssh. Obviously SSH keys make this all incredibly easy, but I can't guarantee the end user will be using an SSH key. This also has to be able to run without user interaction, because it's going to be doing some svn log parsi...

return a FaultObject on purpose from pyamf

I am currently migrating from RubyAMF to PyAMF. In RubyAMF you can return a FaultObject deliberately like so: render :amf => FaultObject.new("Thats not your pie!") Is there comparable functionality in PyAMF? I've searched the docs and can't find any mention of it. ...

Call from Objective-C into Python

bbum posted an outline of how to do this, but I'm unable to complete the details. Where does the Python code go, and how will my Objective-C code know about it? How would I do it compiling on the command line? ...

Creating thumbnails from video files with Python

I need to create thumbnails for a video file once I've uploaded to a webapp running python. How would I go about this... I need a library that can basically either do this for me, or that can read the image frames out of video files (of several formats) automatically. ...

What Python features will excite the interest of a C# developer?

For someone who’s been happily programming in C# for quite some time now and planning to learn a new language I find the Python community more closely knit than many others. Personally dynamic typing puts me off, but I am fascinated by the way the Python community rallies around it. There are a lot of other things I expect I would mis...

posix_ipc python package equivalent for Windows?

Inter process communication primitives (Semaphores, Shared Memory) in python on windows? posix_ipc works great on linux, anything similar for windows? ...

Linking Tcl/Tk to Python 2.5

Hi, I have an existing Python 2.4 and it is working properly with tkinter as I tested it using python import _tkinter import Tkinter Tkinter._test() Now, I have installed python 2.5.2 but when I try the same tests (with the newer version), it returns (but the same tests are working for the previous ve...

How to count and display objects in relation ManyToMany in Django

Hi! I have a simple model with news and categories: class Category(models.Model): name = models.CharField() slug = models.SlugField() class News(models.Model): category = models.ManyToManyField(Category) title = models.CharField() slug = models.SlugField() text = models.TextField() date = models.DateTimeFie...

Class attribute evaluation and generators

How exactly does Python evaluate class attributes? I've stumbled across an interesting quirk (in Python 2.5.2) that I'd like explained. I have a class with some attributes that are defined in terms of other, previously defined attributes. When I try using a generator object, Python throws an error, but if I use a plain ordinary list c...

PyQt4, QThread and opening big files without freezing the GUI

Hi, I would like to ask how to read a big file from disk and maintain the PyQt4 UI responsive (not blocked). I had moved the load of the file to a QThread subclass but my GUI thread get freezed. Any suggestions? I think it must be something with the GIL but I don't know how to sort it? EDIT: I am using vtkGDCMImageReader from the GDCM p...

mingw + python eagerly translating path

I am using: Windows XP Python 2.6.2 (standard install from python.org) git version 1.6.5.1-preview20091022 (installed from http://code.google.com/p/msysgit/) I have an environment variable looking like an absolute path (/path/to/dir) but I'm using it to construct a git URL. At some point, it's getting translated to C:/Program Files/G...

Convert ConfigParser.items('') to dictionary

How can I convert the result of a ConfigParser.items('section') to a dictionary to format a string like here: import ConfigParser config = ConfigParser.ConfigParser() config.read('conf.ini') connection_string = "dbname='%(dbname)s' user='%(dbuser)s' host='%(host)s' password='%(password)s' port='%(port)s'" print connection_string % co...

Best way to parse a YAML file.

What is the best way to parse a YAML file in Python? ...

Sort a CSV by date in Python

Hi! I'm trying to sort a CSV file and I want the items sorted by date in reverse order: newest first. def SortCsvByField( filename, fieldNo, sep = ',' ): records = [line.split(sep) for line in file(filename)] As far as that it's pretty easy, but how do I compare dates? ...

Listing blog entries by year,month

Hi! I want to do something like this: Entries.objects.values('date.year','date.month') but this line is not valid. How can I list blog entries by year,month and display them in template? Thanks! ...

Emacs customization

I'm new to the whole Emacs thing, and one of the things that gets me is that out-of-the-box Emacs doesn't keep you within blocks when programming. I program in mostly Python and C++ and hitting enter sends the cursor back to column 1 on a new line rather than keeping you in the block you're working in. I managed to find this: (add-hook ...

Python ctypes & libspeex.dll/libspeex.so; what are the equivilents to #define, typedef, and structs?

I have a reference of the dll file here: http://speex.org/docs/api/speex-api-reference/group__Codec.html What I'm wondering is, in that list, there are a lot of defines. What is the python equivalent, same for the struct class, what are my options for implementing all of this with ctypes? Typedefs? I'm relatively inexperienced with...

How can I program software using Python for Linux/Windows?

For example, using C# I can make software fairly easily for Windows. I downloaded Python but all I get is a terminal like window for executing single lines of code. Is there a free IDE/Visual editor for designing GUI's in conjunction with Python? Thank SO. :D ...

download a zip file to a local drive and extract all files to a destination folder using python 2.5

hi, I am trying to download a zip file to a local drive and extract all files to a destination folder. so i have come up with solution but it is only to "download" a file from a directory to another directory but it doesn't work for downloading files. for the extraction, I am able to get it to work in 2.6 but not for 2.5. so any sugges...