python

How to resolve pyaws Missing parameter problem?

I am using pyAWS wrapper for Amazon Web services. I want to show amazon search results on my web sites. For search I am using following codes. from pyaws import ecs ecs.setLicenseKey('Your-AWS-License-Key') books = ecs.ItemSearch('python', SearchIndex='Books') But it gives an error: u'ingParameter' ...

Python (creating a negative of this black and white image)

Hi, I am trying to create a negative of this black and white image. The opposite of white (255) is black (0) and vice versa. The opposite of a pixel with a value of 100 is 155. I cannot use convert, invert, point, eval, lambda. Here is my code but it doesnt work yet. Could you please let me know which part i am wrong. def bw_negative(...

Python + pymssql to replace 'Microsoft SQL Server Management Studio Express' ?

Hi All, Currently I'm talking to a MS SQLServer using 'Microsoft SQL Server Management Studio Express'. I would like to execute the scripts written using 'Microsoft SQL Server Management Studio Express' from the python environment. For this, I have connected to the MS SQLServer using pymssql but I'm finding translating the existing SQ...

python running multiple instances

hi lets assume i have a simple programm in python. This programm is running every five minutes throught cron. but i dont know how to write it so the programm will allow to run multiple processes of its self simultaneously. i want to speed things up ... ...

How to speed up transfer of images from client to server

I am solving a problem of transferring images from a camera in a loop from a client (a robot with camera) to a server (PC). I am trying to come up with ideas how to maximize the transfer speed so I can get the best possible FPS (that is because I want to create a live video stream out of the transferred images). Disregarding the physica...

Best way for a total noob to create a simple web application

I want to make an interactive, simple web application. Where should I start? Preferably python/django because it sounds easiest? you tell me. tia. ...

How many bytes does a string have

Is there some function which will tell me how many bytes does a string occupy in memory? I need to set a size of a socket buffer in order to transfer the whole string at once. ...

how to make installer or exe of python code

Hi, I have a python project and wanted to make a exe for windows. In my project I am using pyqt,python and miketex, xlrd. How to bundle the project so that user in windows can run the exe and every package get install. I am not able to find any reading materials on this. Any link will be helpful. Thanks. ...

How do I take integer keys in shelve ?

I want to store an integer key in shelve. But when I try to store integer key in shelve it give me an error Traceback (most recent call last): File "./write.py", line 12, in data[id] = {"Id": id, "Name": name} File "/usr/lib/python2.5/shelve.py", line 124, in __setitem__ self.dict[key] = f.getvalue() File "/usr/lib/pytho...

Python and Web applications

Hi, I want to start writing python to support some of my web applications. Mainly i'm trying to fetch pages, send POST data to urls and some string manipulation. I understand that there are some disadvantages with the urllib in the new versions. Can anyone please tell me which release is best for my needs? Thanks ...

Python (image alteration)

Possible Duplicate: Python (creating a negative of this black and white image) Hi, I am trying to create a negative of this black and white image. The opposite of white (255) is black (0) and vice versa. The opposite of a pixel with a value of 100 is 155. I cannot use convert, invert, point, eval, lambda. Here is my code but...

How to enable SSL with a IIS 6 + FastCGI + Django setup?

Hi folks, I have successfully setup FastCGI/Django on a IIS 6 Server. What I don't know how to do, is to enable SSL connections. Any tips or ideas to get me started? I'm not an IIS expert, so this is quite confusing for me. :) ...

How to provide data from PySide QAbstractItemModel subclass to QML ListView?

I have an app I'm writing in PySide that has a QML UI. I have subclassed QAbstractListModel in Python: class MyModel(QtCore.QAbstractListModel): def __init__(self, parent=None): QtCore.QAbstractListModel.__init__(self, parent) self._things = ["foo", "bar", "baz"] def rowCount(self, parent=QtCore.QModelIndex()): ...

how do I generate a cartesian product of several variables using python iterators?

Dear all, Given a variable that takes on, say, three values, I'm trying to generate all possible combinations of, say, triplets of these variables. While this code does the trick, site_range=[0,1,2] states = [(s0,s1,s2) for s0 in site_range for s1 in site_range for s2 in site_range] it's somewhat, uhm, clumsy, and is only getting...

django multiple select in admin change-list

Hi all, Our product model can have multiple campaigns. Our customers change these campaigns frequently and generally on multiple products. So what we need right now seems that we need to show a multiple select widget on a change-list of Product model where our customers can easily change the campaigns. Any idea on this? Maybe another...

Dynamic login/logout URLs in Django

I have an app that serves pages like this /stage/stagename. stagename is variable. The URL mappers just look for a [0-9A-Za-z]+ to fill that slot. Now, because of my setup, My app will be rooted at /stage/stagename. I cannot change this (without massive changes to my setup which is too tedious right now and a last option). I need to u...

urlencode a multidimensional dictionary in python

How can I get a URL-encoded version of a multidimensional dictionary in Python? Unfortunately, urllib.urlencode() only works in a single dimension. I would need a version capable of recursively encoding the dictionary. For example, if I have the following dictionary: {'a': 'b', 'c': {'d': 'e'}} I want to obtain the following string: ...

how to wrap file object read and write operation (which are readonly) ?

i am trying to wrap the read and write operation of an instance of a file object (specifically the readline() and write() methods). normally, i would simply replace those functions by a wrapper, a bit like this: def log(stream): def logwrite(write): def inner(data): print 'LOG: > '+data.replace('\r','<cr>').repl...

exception handling for optparse of python

HI, guys. I am using cmd and optparse to develop a CLI.py for a collection of already-functional classes (CDContainer, CD, etc.). The following are some parts of the code. I have a problem here. when there are exceptions(wrong input type or missing values), the optparse will exit the whole program instead of the specific command method...

Python: Dynamic interval data structure

Hi all, I am looking for some python code to efficiently compute interval overlaps. I've used the interval tree of the bx-python package before, but now need to delete intervals from the tree (or better yet, modify them). It seems the bx-python tree doesn't support this. Any pointers? Thanks. ...