python

Programming language for opengl screenshot software

I need to develop a multiplatform software that takes screenshots from opengl games without affecting the game in performance, it will run in the background and will add a watermark to my screenshots. What language should i use? I thought of Perl / Python. Anyone can point me out something to start? Thanks! ...

Where to store deployment scripts

Assuming that I have the following directory structure for a Python project: config/ scripts/ src/ where should a fabric deployment script should go? I assume that it should be in scripts, obviously, but for me it seems more appropriate to store in scripts, the actual code that fires up the project. ...

Error in writing a class.

I am running through a tutorial online at http://www.sthurlow.com/python/lesson08/ and I believe I understand how classes work in python, at least to some degree but when I run this code: class Shape: def __init__(self,x,y): self.x = x self.y = y description = "This shape has not been described yet" author = ...

Can I find the path of the executable running a python script from within the python script?

Is there a way to retreive the path of the executable that is running the current python script (from within the python script)? ...

QPluginLoader with PyQt modules as plugins: possible?

Hi! I have a C++ application that loads externals plugins thanks to QPluginloader. QPluginLoader provides access to a Qt plugin. A Qt plugin is stored in a shared library (a DLL). The plugins have to inherit from a pure virtual class ( and Q_DECLARE_INTERFACE ) and QObject. I would like to create plugins by using python and PyQt. Is t...

Python text file processing speed issues

Hi all, I'm having a problem with processing a largeish file in Python. All I'm doing is f = gzip.open(pathToLog, 'r') for line in f: counter = counter + 1 if (counter % 1000000 == 0): print counter f.close This takes around 10m25s just to open the file, read the lines and increment this counter. In...

Text-based one-on-one chat with Flash interface: what to power the backend?

Hey guys. I'm building a website where I hook people up so that they can anonymously vent to strangers. You either choose to be a listener, or a talker, and then you get catapulted into a one-on-one chat room. The reason for the app's construction is because you often can't vent to friends, because your deepest vulnerabilities can oft...

gdata python analytics metrics and dimensions error

I am using the gdata module in python, when using this query I get an 'Illegal combination of dimensions and metrics' error. I have looked at documentation but not found the reason. data_query = gdata.analytics.client.DataFeedQuery({ 'ids': tid, 'start-date': '2010-04-20', 'end-date': '2010-04-21', 'dimen...

Best (or appropriate) WSGI server for this Python script? - Python

Hi folks, I'm having quite a problem deciding how to serve a few Python scripts. The problem is that the basic functionality could be generalized by this: do_something() time.sleep(3) do_something() I tried various WSGI servers, but they have all been giving me concurrency limitations, as in I have to specify how many threads to u...

use python glob to find a folder that is a 14 digit number

I have a folder with subfolders that are all in the pattern YYYYMMDDHHMMSS (timestamp). I want to use glob to only select the folders that match that pattern. ...

Quote POSIX shell special characters in Python output

There are times that I automagically create small shell scripts from Python, and I want to make sure that the filename arguments do not contain non-escaped special characters. I've rolled my own solution, that I will provide as an answer, but I am almost certain I've seen such a function lost somewhere in the standard library. By “lost” ...

Real-time SQLite and PostgreSQL bi-directional synchronization using python

Is there any python library that can keep a client-side SQLite database in sync with a server-side PostgreSQL database? There are solutions for Java, such as Daffodil or SymmetricDS. Is there something similar for python? ...

How to add columns to sqlite3 python?

I know this is simple but I can't get it working! I have no probs with insert,update or select commands, Lets say I have a dictionary and I want to populate a table with the column names in the dictionary what is wrong with my one line where I add a column? ##create con = sqlite3.connect('linksauthor.db') c = con.cursor() c.execute('''...

error when plotting log'd array in matplotlib/scipy/numpy

I have two arrays and I take their logs. When I do that and try to plot their scatter plot, I get this error: File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/pyplot.py", line 2192, in scatter ret = ax.scatter(x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, ...

multiple substitutions inside links in reST

My question is nearly identical to http://stackoverflow.com/questions/1227037/substitutions-inside-links-in-rest-sphinx except that I want to have text substitution within the role text. That is, I want to be able to say something like :apilink:`/search?api_key=\ |demo_api_key|\ &query=monkeys` Is there a way to do this? ...

Prototyping Qt/C++ in Python

I want to write a C++ application with Qt, but build a prototype first using Python and then gradually replace the Python code with C++. Is this the right approach, and what tools (bindings, binding generators, IDE) should I use? Ideally, everything should be available in the Ubuntu repositories so I wouldn't have to worry about incompa...

Extract images from PDF without resampling, in python?

How might one extract all images from a pdf document, at native resolution and format? (Meaning extract tiff as tiff, jpeg as jpeg, etc. and without resampling). Layout is unimportant, I don't care were the source image is located on the page. I'm using python 2.6 but can use 3.x if required. thanks Summarized Responses There is a JP...

Dynamic function docstring

I'd like to write a python function that has a dynamically created docstring. In essence for a function func() I want func.__doc__ to be a descriptor that calls a custom __get__ function create the docstring on request. Then help(func) should return the dynamically generated docstring. The context here is to write a python package wra...

Importing BitTorrent bencode module

Hi, I'm on Mac OS X 10.6. Python is 2.6.1. I've installed bencode module as sudo easy_install BitTorrent-bencode It appeared in site-packages /Library/Python/2.6/site-packages/BitTorrent_bencode-5.0.8-py2.6.egg But, how to import and use this module? >>> import bencode doesn't work... Traceback (most recent call last): ...

Maintenance Scripts with Pylons' objects?

how do i import classes from a pylons project for maintenance scripts? ...