I have a Python interface of a graph library written in C - igraph (the name of library). My need is to invoke the python modules pertaining to this graph library from Java code. It goes like this, the core of library is in c. This core has been imported into Python and interfaces to the functions embedded in core are available in Python...
If you have a controller method like so:
@expose("json")
def artists(self, action="view",artist_id=None):
artists=session.query(model.Artist).all()
return dict(artists=artists)
How can you call that method from within your controller class, and get the python dict back - rather than the json-encoded string of the dict (which r...
Hi again,
I have been using python with RDBMS' (MySQL and PostgreSQL), and I have noticed that I really do not understand how to use a cursor.
Usually, one have his script connect to the DB via a client DB-API (like psycopg2 or MySQLdb):
connection = psycopg2.connect(host='otherhost', etc)
And then one creates a cursor:
cursor = co...
A few weeks ago I asked the question "Is a PHP, Python, PostgreSQL design suitable for a non-web business application?" http://stackoverflow.com/questions/439759/is-a-php-python-postgresql-design-suitable-for-a-business-application
A lot of the answers recommended skipping the PHP piece and using Django to build the application. As I've...
I want to be able to run a regular expression on an entire file, but I'd like to be able to not have to read the whole file into memory at once as I may be working with rather large files in the future. Is there a way to do this? Thanks!
Clarification: I cannot read line-by-line because it can span multiple lines.
...
I am looking for the best way to detect an image within another image. I have a small image and would like to find the location that it appears within a larger image - which will actually be screen captures. Conceptually, it is like a 'Where's Waldo?' sort of search in the larger image.
Are there any efficient/quick ways to accomplis...
I am not sure, whether I should use for -loop. Perhaps, like
for i in range(145):
by 6: //mistake here?
print i
...
I've been working on an alternative compiler front-end for Python where all syntax is parsed via macros. I'm finally to the point with its development that I can start work on a superset of the Python language where macros are an integral component.
My problem is that I can't come up with a pythonic macro definition syntax. I've poste...
Hey everyone,
I'm developing a python framework that would have "addons" written as separate packages. I.e.:
import myframework
from myframework.addons import foo, bar
Now, what I'm trying to arrange is so that these addons can be distributed separately from core framework and injected into myframework.addons namespace.
Currently my...
Is there an easy way to get the type of line ending that the current operating system uses?
...
I am using python version 2.5.4 and install mysql version5.0 and django. Django is working fine with python but not mysql. Can anyone help me to solve this issue. I am using it in vista.
...
I'm writing a system that allows python scripts to be executed within a C++ application.
The python scripts are used to modify values within arrays of data (typically 2048x2048x4 arrays of floats)
I'm currently using numpy arrays created using the array API and registered with Python.
In the python scripts I'm accessing the arrays l...
I have an application in Django, that needs to send a large number of emails to users in various use cases. I don't want to handle this synchronously within the application for obvious reasons.
Has anyone any recommendations for a message queuing server which integrates well with Python, or they have used on a Django project? The rest o...
I don't know why this doesn't work:
I'm using the odict class from PEP 372, but I want to use it as a __dict__ member, i.e.:
class Bag(object):
def __init__(self):
self.__dict__ = odict()
But for some reason I'm getting weird results. This works:
>>> b = Bag()
>>> b.apple = 1
>>> b.apple
1
>>> b.banana = 2
>>> b.banana
2...
Just like the title asks. I've been learning Python for a while now and I'd say I'm pretty decent with it. I'm looking for a medium or large project to keep me busy for quite a while. Your suggestions are greatly appreciated.
...
I'd like to learn Python, and I already have a bit of C experience.
Now, should I learn Python 2.6 or Python 3?
Which advantages and disadvantages do the versions have?
And: How can I learn Python (maybe a book you would recommend)? It should be German, but if it's english, it should at least be available for free.
Best would be if it ...
Is it possible to get the pydev debugger to break on exception?
...
I want to send a datetime.datetime object in serialized form from Python using JSON and de-serialize in JavaScript using JSON. What is the best way to do this?
...
I want a to be rounded to 13.95
>>> a
13.949999999999999
>>> round(a, 2)
13.949999999999999
The round function does not work [the way I expect].
...
Suppose I've developed a general-purpose end user utility written in Python. Previously, I had just one version available which was suitable for Python later than version 2.3 or so. It was sufficient to say, "download Python if you need to, then run this script". There was just one version of the script in source control (I'm using Git) ...