python

Python question - I have a List of Classes, how do I remove duplicates?

Am writing an App Engine application (it's a simple quest system for a game): so I have a list class Quest(db.Model): name = db.StringProperty() # note: I made about 10 different quest entities ( quest1 to quest10) class User(db.Model): completed_quests = db.StringListProperty() # to store keys of completed quests # note: I made...

Is there a way to prevent detection by the website when a screenshot is taken using a Mac Os X Safari browser?

There is a thread discussing Darwin notifications being sent after a screenshot is taken. Does this apply to websites viewed via Safari? Do the same restrictions apply to PC sytems? Would taking the picture via a Python script in Linux or running Safari in a VM circumvent detection? ...

ReportLab and Python Imaging Library images from memory issue

I've run into an issue I can't seem to figure out with PIL and reportlab. Specifically, I would like to use drawImage on a canvas in reportlab using a PIL Image object. In the past I've inserted images into reportlab documents from the web using raw data, StringIO and reportlab's ImageReader class. Unfortunately, ImageReader takes a fil...

Group and stack tuples

I'm just starting with Python, and I can't figure out how to group tuples. For instance, I have tuple1=("A", "B", "C") and tuple2=("1","2","3"). I want to combine these into a list, grouped by the first tuple. I want it to appear stacked, as in A1 A2 A3 on one line, and B1 B2 B3 on the next line. I can make them print concatenated, but...

What are features considerd as advanced python?

I do basic python programming and now I want to get deep into language features. I have collected/considered the following to be advanced python capabilities and learning them now. Decorator Iterator Generator Meta Class Anything else to be added/considered to the above list? ...

cross-platform html widget for pygtk

I'm trying to write a small gui app in pygtk which needs an html-rendering widget. I'd like to be able to use it in a windows environment. Currently I'm using pywebkitgtk on my GNU/Linux system, and it works extremely well, but it seems it's not possible to use this on Windows at this time. Can anyone give me any suggestions on how to...

Is it possible to download something to a default local dir quietly using a server side script?

I need to download something from server to local machine just by a visiting an url without any popup-window,using something like php or python.But cannot find a good solution.Is it possible or not?Hope someone can help me. ...

How to retrieve attributes of xml tag in Python?

hello I'm looking for a way to add attributes to xml tags in python. Or to create a new tag with a new attributes for example, I have the following xml file: <types name='character' shortName='chrs'> .... ... </types> and i want to add an attribute to make it look like this: <types name='character' shortName='chrs' fullName='MayaCh...

how can i pass xml format data from flex to python

Hi i want to pass xml format data into python from flex.i know how to pass from flex but my question is how can i get the passed data in python and then the data should be inserted into mysql.and aslo i want to retrieve the mysql data to the python(cgi),the python should convert all the data into xml format,and pass all the data to the f...

A blackbox testing frame with testing management system

Hi! Is there a testing framework (preferable python) that executes test, monitor the progress (failed/passed/timeout) and controls the vmware? Thanks I am trying to make some automation functional testing in Vmware using Autoit script, VMs are controlled by a little python script on the host machine (deploy test files into VMs, execute ...

How to transform tuple of string(object locations) to dictionary of objects in python

Hi, I would like to transform a tuple: TEST_CLASSES = ( 'common.test.TestClass', ) to TEST_CLASSES = { 'test': common.test.TestClass, } How to make a dictionary is simple but I have a problem with conversion from string to object. Could anybody help me please? thanks! ...

Why does Pylint give error E0702, raising NoneType, on this raise statement?

Say I have the following code. def foo(): foobar = None if foobar is not None: raise foobar When I run this code through pylint, I get the following error: E0702:4:foo: Raising NoneType while only classes, instances or string are allowed Is this a bug in pylint? Is my pylint too old? pylint 0.18.0, astng 0.19.1, c...

Python Authentication to SAMBA share.

I'm able to map the drive without problems on network shares without authentication. But I'm missing something once I try to authenticate with a username and password. Here is the current working example of the code with the error message I keep receiving. #!/usr/bin/python # Drive Map Script import pywintypes import win32com.client # ...

Using unicode in Python

Hello, I have csv file having some address data mostly in Finnish language. I need to read that file and getting some geocode information of these address. But It doesn't work for Finnish alphabet and says it cant read those! Can anybody please help me out of this? import urllib,urllib2,time addr_file = 'address.csv' out_file = 'addres...

Python Django simple site

Hi, I'm trying to create site using Django framework. I looked on tutorial on Django project site but contains much information which I don't need. I have python scripts which provides output and I need to have this output on the web. My question is how simply manage Django to have link which start the script and provides its output on ...

Python CDROM Production

Hi, I'm a complete newbie to Python so forgive my ignorance. I have been using Macromedia / Adobe Director & Lingo since 1998. I am extremely familiar with using this software to create CDROMs and DVDs and also have a good knowledge of design elements and their integration such as flash videos, images & audio etc. I am always keen to ...

Is there an alternative to the threading.Condition variables in python that better support timeouts without polling?

I'm using condition variables in threads that require a timeout. I didn't notice until I saw the CPU usage when having a lot of threads running, that the condition variable provided in the threading module doesn't actually sleep, but polls when a timeout is provided as an argument. Is there an alternative to this that actually sleeps li...

Python MD5 not matching md5 in terminal

Hey guys, am getting MD5 of several files using python function filehash = hashlib.md5(file) print "FILE HASH: " + filehash.hexdigest() though when I go to the terminal and do a md5 file the result I'm getting is not the same my python script is outputting (they don't match). Any chance someone knows why? Thanks. ...

Dynamic form requirements in Django

Hi, I am about to start a large Django project at work. And the key features are form handling. There is going to be a lot of forms that the users of the app is going to use. And one requirement is that it should be possible to edit the forms in the admin interface of the application. That is, it is not a requirement to add/delete for...

What algorithm does buildbot use to assign builders to slaves?

I have a buildbot with some builders and two slave machines. Some of the builders can run on one slave, and some of them can run on both machines. What algorithm will buildbot use to schedule the builds? Will it notice that some builders can run on just one slave and that it should assign those that can run on both slaves to the less d...