python

Python - help on custom wx.Python (pyDev) class

I have been hitting a dead end with this program. I am trying to build a class that will let me control the BIP's of a button when it is in use. so far this is what i have (see following.) It keeps running this weird error TypeError: 'module' object is not callable - I, coming from C++ and C# (for some reason the #include... is so much e...

python distutils does not include data_files

I am new to distutils.. I am trying to include few data files along with the package.. here is my code.. from distutils.core import setup setup(name='Scrapper', version='1.0', description='Scrapper', packages=['app', 'db', 'model', 'util'], data_files=[('app', ['app/scrapper.db'])] ) The zip f...

Extracting Information from Images

What are some fast and somewhat reliable ways to extract information about images? I've been tinkering with openCV and this seems so far to be the best route plus it has Python bindings. So to be more specific I'd like to determine what I can about what's in an image. So for example the haar face detection and full body detection clas...

Network Communication program in python

Hi all, Basically what I'm trying to achieve is a program which allow users to connect to a each other over a network in, essentially, a chat room. What I'm currently struggling with is writing the code so that the users can connect to each other without knowing the IP-address of the computer that the other users are using or knowing th...

Monitor web sites visited using Internet Explorer, Opera, Chrome, Firefox and Safari in Python

I am working on a project for work and have seemed to run into a small problem. The project is a similar program to Web Nanny, but branded to my client's company. It will have features such as website blocking by URL, keyword and web activity logs. I would also need it to be able to "pause" downloads until an acceptable username and pass...

Using classes for the first time,help in debugging

here is post my code:this is no the entire code but enough to explain my doubt.please discard any code line which u find irrelavent enter code here saving_tree={} isLeaf=False class tree: global saving_tree rootNode=None lispTree=None def __init__(self,x): file=x string=file.readlines() #print ...

Managing logs/warnings in Python extensions

TL;DR version: What do you use for configurable (and preferably captured) logging inside your C++ bits in a Python project? Details follow. Say you have a a few compiled .so modules that may need to do some error checking and warn user of (partially) incorrect data. Currently I'm having a pretty simplistic setup where I'm using logging ...

GEdit/Python execution plugin?

Hi I'm just starting out learning python with GEdit plus various plugins as my IDE. Visual Studio/F# has a feature which permits the highlighting on a piece of text in the code window which then, on a keypress, gets executed in the F# console. Is there a similar facility/plugin which would enable this sort of behaviour for GEdit/Pyt...

Django: Page doesn't load images

I am working on a Django project for a company. This project worked very well before today. Today I found a page can not show images (and their corrsponding links). I checked source code of THAT PAGE, I found there are images and links, I just can not find them on the page. I checked the auth of the server and I am sure I can write th...

How to poll a file in /sys

Hi, I am stuck reading a file in /sys/ which contains the light intensity in Lux of the ambient light sensor on my Nokia N900 phone. See thread on talk.maemo.org here I tried to use pyinotify to poll the file but this looks some kind of wrong to me since the file is alway "process_IN_OPEN", "process_IN_ACCESS" and "process_IN_CLOSE_NOW...

django auth : strange error with authenticate()

I am using authenticate() to authenticating users manually. Using admin interface I can see that there is no 'last_login' attribute for Users Debug traceback is : Environment: Request Method: GET Request URL: https://localhost/login/ Django Version: 1.1.1 Python Version: 2.6.5 Installed Applications: ['django.contrib.auth', 'django.c...

Is there a Python library that eases the creation of CLI utilities like Django management commands?

I want to create a set of command-line utilities in python that would be used like so: python utility.py command1 -option arg Very similar to django management commands. Is there any library that eases the creation of such commands? ...

Datastore performance, my code or the datastore latency

I had for the last month a bit of a problem with a quite basic datastore query. It involves 2 db.Models with one referring to the other with a db.ReferenceProperty. The problem is that according to the admin logs the request takes about 2-4 seconds to complete. I strip it down to a bare form and a list to display the results. The put w...

Using subprocess wait() and poll()

Hi. I am trying to write a small app that uses the subprocess module. My program calls an external Bash command that takes some time to process. During this time, I would like to show the user a series of messages like this: Processing. Please wait... The output is foo() How can I do this using Popen.wait() or Popen.poll(). I h...

What is the difference between a module and a script in Python?

Think the title summarizes the question :-) ...

XML library similar to simplejson/json? - Python

Hi folks, is there a similar library to simplejson, which would enable quick serialization of data to and from XML. e.g. json.loads('{vol:'III', title:'Magical Unicorn'}') e.g. json.dumps([1,2,3,4,5]) Any ideas? ...

Strange bug in Django admin list-editing mode

We have Django as DB editor for our customers. We have 2 installations on different servers - one talking to dev DB and used for testing new features (we do some customizations to admin), another used on production. It's convenient for customer to use list editing mode for batch updating one field for one model. The set of list-editable...

How to replicate tee behavior in python when using subprocess?

I'm looking for a Python solution that will allow me to save the output of a command in a file without hiding it from the console. FYI: I'm asking about tee (as the Unix command line utility) and not the function with the same name from Python intertools module. Details Python solution (not calling tee, it is not available under Wind...

Elegant ways to print out a bunch of instance attributes in python 2.6?

First some background. I'm parsing a simple file format, and wish to re-use the results in python code later, so I made a very simple class hierarchy and wrote the parser to construct objects from the original records in the text files I'm working from. At the same time I'd like to load the data into a legacy database, the loader files ...

importing classes python

Just wondering why import sys exit(0) gives me this error: Traceback (most recent call last): File "<pyshell#1>", line 1, in ? exit(0) TypeError: 'str' object is not callable but from sys import exit exit(0) works fine? ...