python

Oauth for Google API example using Python / Django

Hi, I am trying to get Oauth working with the Google API using Python. I have tried different oauth libraries such as oauth, oauth2 and djanog-oauth but I cannot get it to work (including the provided examples). For debugging Oauth I use Google's Oauth Playground and I have studied the API and the Oauth documentation With some librari...

Python for a Perl programmer

I am an experienced Perl developer with some degree of experience and/or familiarity with other languages (working experience with C/C++, school experience with Java and Scheme, and passing familiarity with many others). I might need to get some web work done in Python (most immediately, related to Google App Engine). As such, I'd like ...

App Engine, Python: how to filter query by ID?

I try to get data from app engine datastore. Filtering query by 'title' (or any other property) works: obj = db.Query(PageModel).filter('title',title)[0] But the same thing with ID - doesn't: obj = db.Query(PageModel).filter('ID',page_id)[0] I think there is something special about IDs and KEYs in datastore, but I cant find, how t...

Python function pointer

Hi there, I have a function name stored in a variable like this: myvar = 'mypackage.mymodule.myfunction' and I now want to call myfunction like this myvar(parameter1, parameter2) What's the easiest way to achieve this? ...

Python+suds : xsd_base64Binary type ?

Hi, I'm trying to attach some files to a Jira using the Soap API. I have python 2.6 and SOAPpy isn't working any more, so, I'm using suds. Everything is fine except for the attachements ... I don't know how to rewrite this piece of code : http://confluence.atlassian.com/display/JIRA/Creating+a+SOAP+Client?focusedCommentId=180943#commen...

Python trouble importing modules

I am building a web app with this directory structure: app/ __init__.py config/ __init__.py db_config.py models/ __init__.py model.py datasources/ __init__.py database.py ... ... Every __init__.py file has __all__ = ['', '', ...] in it, listing the...

simple twisted server (twistd .tap)with a pexpect instance error

Hi all, I have been creating an async server socket that sends and recives xml using twisted. The application works great! but because my main objective was to embed it in an init.d script and make it run in the background i decided to transform it in a "twisted application" in order to run it using twistd # from twisted.internet impor...

app-engine-patch is dead. Now what is the best way to use Django on Google App Engine?

The app-engine-patch authors have officially marked this wonderful project as dead on their website. Over the last year a lot of people have asked what the best way to run Django on Google App Engine was, and time after time people have pointed to app-engine-patch being the way to go. Now that this project is dead, I would love to revis...

What resources/references are available for multithreaded programming in Python?

I'm evaluating the use of Python for a new project and ran through some basic tutorials but am looking for some recommendations and resources for multithreaded development in Python? How does it compare to other languages? ...

Opinion about Glashammer App engine Web framework

I am having to look into some code and consider working in a Python framework called Glashammer. I know and love Django. I have some experience with Appengine native framework and Django on Appengine. I'd like to know from you that have used one or more of those, how Glahammer compares and contrasts with others. What are there any Pros...

psycopg2.InternalError no matter what I do

Hey, I use Django and just dropped and re-created database in order to flush table data. Now when I'm trying to do any db-related task, I get: ./manage.py sql portfolio Traceback (most recent call last): File "./manage.py", line 11, in <module> execute_manager(settings) File "/usr/lib/pymodules/python2.6/django/core/managemen...

Setting the cursor position in PyGTK (for a Gedit plugin)

I'm developing a Gedit plugin which is built on PyGTK. I'm trying to figure out how to programatically tell the cursor where to go. For example, I'd like to have the cursor automatically go to right before the first "|" (pipe) in the current line. Any ideas or starting points? I've been using the Gedit API up until now (right here) whic...

Django extends/include - bug?

Hello, I'm trying to use both extends and include tags in one template, just like: {% extends "layout.html" %} {% block content %} <div id="content"> <nav class="mainMenu"> {% include "list.html" %} </nav> </div> {% endblock %} Unfortunately what is displayed is only list.html without contents from layout.html and file that...

Google Books API - Getting Book Ratings?

I cannot find a way to get a Book's Ratings through the Books API provided by Google. All I figured out is how to obtain search listings, which do not include ratings and description. Help would be very much appreciated. ...

Sum of Square Differences (SSD) in numpy/scipy

I'm trying to use Python and Numpy/Scipy to implement an image processing algorithm. The profiler tells me a lot of time is being spent in the following function (called often), which tells me the sum of square differences between two images def ssd(A,B): s = 0 for i in range(3): s += sum(pow(A[:,:,i] - B[:,:,i],2)) ...

Room for improvement on my Python code?

I'm working on a Gedit plugin using Python (and PyGTK) and I really havent' worked with Python much so I have no idea if I'm writing Pythonic code. All of my own code is contained in __init__.py. There are a few other files, but they're from an outside library that I'm hooking into. My __init__.py is as follows: # # @file __init__.py #...

Python 3.3 syntax discussion.

Does anybody else find {:} and {} be a more natural way to construct empty dictionary and empty set as compared to {} and set()? Thanks. ...

Do all dynamic languages have the circular import issue?

For the following Python code: first.py # first.py from second import Second class First: def __init__(self): print 'Second' second.py # second.py from first import First class Second: def __init__(self): print 'Second' After creating the files and running the following from the shell: python first.py ...

sqlalchemy 0.6 legacy database access?

I feel like this should be simple, but i cant find a single example of it being done. As an example I have the following existing tables: CREATE TABLE `source` ( `source_id` tinyint(3) unsigned NOT NULL auto_increment, `name` varchar(40) default NULL, PRIMARY KEY (`source_id`), UNIQUE KEY `source_name` (`name`) ) ENGINE=InnoDB...

Python, mongo + spider monkey

Ok, so this isn't exactly a question that I expect a full answer for but here goes... I am currently using a python driver to fire data at a mongo instance and all it well in the world. Now I want to be able to pull data from mongo and evaluate each record in the collection. Now I need to pass in to this evaluation a script that will lo...