python

setuptools easyinstall mysql-python-1.2.3

Hi everybody I have read a bunch of threads on setuptools here. A lot of people seem not to like it very much. But I need to install MySQL-python-1.2.3. and when I do that I get this error: MySQL-python-1.2.3 X$ python setup.py cleanTraceback (most recent call last): File "setup.py", line 5, in <module> from setuptools ...

Integration testing in python, suggested tools and practices?

I've some hard time understanding Integration testing in general, I want to do some integration testing in python expecially for network programming in twisted (but I want to know something more in general). There are any good resource I must read, and tools (python tools if possible), practices that introduces me in integration testing...

Unicode sql query in cx_Oracle

i have the following: ora_wet = oracle_connection() cursor = ora_wet.cursor() sqlQuery = u"SELECT * FROM web_cities WHERE cty_name = 'София'" cursor.execute(sqlQuery) sqlResult = cursor.fetchone() When I do this I get a TypeError: expecting None or a string on line 18 which is the cursor.execute(sqlQuery) If I make the query non-uni...

how to add dozen of test cases to a test suite automatically in python

Hi All, i have dozen of test cases in different folders. In the root directory there is a test runner. unittest\ package1\ test1.py test2.py package2\ test3.py test4.py testrunner.py Currently I added the four test cases manually into a test suite import unittest from package1.test1 import Test1 from package1....

How do you 'remove' a numpy array from a list of numpy arrays?

If I have a list of numpy arrays, then using remove method returns a value error. For example: import numpy as np list = [np.array([1,1,1]),np.array([2,2,2]),np.array([3,3,3])] list.remove(np.array([2,2,2])) Would give me ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() ...

Mmysql-python-1.2.3 install Mac OS 10.6

How can i install this? Any suggestion would be great. I have read these tutorials: http://www.tutorialspoint.com/python/python_database_access.htm http://www.mangoorange.com/2008/08/01/installing-python-mysqldb-122-on-mac-os-x/ http://openlandscape.wordpress.com/2007/11/16/setting-up-mysql-for-python-mysqldb-on-mac-os-x/ http://www.b...

Python, unittest: Can one make the TestRunner completely quiet?

Is there a way to make unittest.TextTestRunner completely quiet, meaning that it never prints to output on its own? Even at verbosity=0 it prints results when done. The thing is that i want to process the TestResult object returned by the runner before anything is printed. ...

from catalogue to html table (recursion problem)

I have what I call a catalogue, a dictonary like this: fields = ("property1", "property2") catalogue = { 0.3: { 100: [ {"property1": 0.3, "property2": 100, "value": 1000}, {"property1": 0.3, "property2": 100, "value": 2000}, {"property1": 0.3, "property2": 100, "val...

Python: concatenating bytes with a string

I'm working on a python project in 2.6 that also has future support for python 3 being worked in. Specifically I'm working on a digest-md5 algorithm. In python 2.6 without running this import: from __future__ import unicode_literals I am able to write a piece of code such as this: a1 = hashlib.md5("%s:%s:%s" % (self.username, s...

Loop Java HashMap like Python Dictionary?

In Python, you can have key,value pairs in a dictionary where you can loop through them, as shown below: for k,v in d.iteritems(): print k,v Is there a way to do this with Java HashMaps? ...

How do I check if more than one key is being pushed at a time ?

Hey, I am creating a keylogger to monitor my PC and I want to have a key combination that shuts the keylogger off or turns on the user interface, not sure yet. But the problem is that I can't figure out how to check if two or three buttons are being pressed at the same time ? How do I do that ? Here's my source so far : http://paste.poco...

[Python] Upload a file with rest

Hi, I created a rest api using django and piston and I need to create a script that uploads a file to that api. currently I'm using this code: import urllib import urllib2 user = 'patrick' password = 'my_password' url = 'http://localhost:8000/api/odl/' password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() password_manager.add_...

How can I achieve layout similar to Google Image search in QT (PyQT)?

Hello, I'm new to QT. I'm using PyQT for GUI development in my project. I want to achieve this layout in my application. This application searches images from an image database. Google image search layout is ideal for my purpose. I'm following the book "Rapid GUI Programming with Python and Qt" and I'm familiar with layouts. I guess...

Logging activity on Django's admin - Django

Hi folks, I need to track/log activity on the Django admin. I know there are messages stored by admin somewhere, but I don't know how to access them in order to use them as a simple log. I'm trying to track the following: User performing the action Action committed Datetime of action Thanks guys. ...

Get msi product name, version from command line

Is there a way to display the product name and version of a msi file from the command line? Or better yet, can this be done via python? ...

Unable to load fixture data in Django tests

I have an app called pta.apps.users which is loaded in the Loaded apps setting in my settings.py. The app works fine, I now want to test it and have placed json files in the fixtures directory inside my users app. I have a test which runs fine but the fixtures wont load. from django.test import TestCase from django.test.client import...

Free Automatic software test infrastructure

Hey, Do you know of a good free/open source test automation infrastructure? I'm looking for infrastructure (python is preferred) which has features like: connecting to a remote computer. running python scripts on a remote computer. Identification of UI components watch dog. test report summery generation anything else useful (: Thx,...

Verbally format a number in Python

How do pythonistas print a number as words, like the equivalent of the Common Lisp code: [3]> (format t "~r" 1e25) nine septillion, nine hundred and ninety-nine sextillion, nine hundred and ninety-nine quintillion, seven hundred and seventy-eight quadrillion, one hundred and ninety-six trillion, three hundred and eight billion, three hu...

Django: ImageField disable image deletion

Greetings Having an ImageField object in my Foo model as such: class Foo(models.Model): name = models.CharField(max_length=50) photo = models.ImageField(upload_to='foobar', blank=True, null=True) I want Foo to disable to delete the uploaded photo once a Foo object is deleted and a specific . How can I do this? Ie: If self.na...

Python in terminal

Hi. This question concerns running python files in terminal that are not stored in the home directory. I think I have solved the first bit of this puzzle by modifying my path so that it includes the directory where my python programs are stored. So where as initially echo $PATH would yield the following: /usr/bin:/bin:/usr/sbin:/sbin:...