python

How to return and use an array of strings from a jQuery ajax call?

I'm using Google App Engine (Python) along with jQuery for Ajax calls to the server. I have a page where I want to load up a list of strings in Javascript from an Ajax call to the server. The server method I want to invoke: class BrowseObjects(webapp.RequestHandler): def get(self): ids_to_return = get_ids_to_return() ...

python: append only specific elements from a list

i have a list of a list: b=[[1,2,3],[4,5,6],[7,8,9]] i have a list: row = [1,2,3] how do i append to b only row[0] and '3847' and row[2] such that b will equal: b=[[1,2,3],[4,5,6],[7,8,9],[1,3847,3]] ...

python: TypeError: 'NoneType' object is not iterable

what does this error mean? i am getting it on this code: def write_file(data,filename): #creates file and writes list to it with open(filename,'wb') as outfile: writer=csv.writer(outfile) for row in data: ##i get the error here writer.writerow(row) ...

What python html generator module should I use in a non-web application?

I'm hacking a quick and dirty python script to generate some reports as static html files. What would be a good module to easily build static html files outside the context of a web application? My goals are simplicity (the HTML will not be very complex) and ease of use (I don't want to write a lot of code just to output some html tags...

python: how to convert currency to decimal?

i have dollars in a string variable dollars = '$5.99' how do i convert this to a decimal instead of a string so that i can do operations with it like adding dollars to it? ...

Need help processing upload form with Google App Engine Blobstore

I'm trying to learn the blobstore API... and I'm able to successfully upload files and get them back, but I'm not having any luck trying to combine an upload form with a regular webform to be able to associated extra info with the file, such as a nickname for the file. Below is the code for a simple app I've been playing with. It's base...

how do python capture 302 redirect url

i try to fetch data from web,but the page use a 302 redirect how can i use python to fetch the real url? ...

Accessing session variable in Django template with Google App Engine (Webapp) - Python

Hi, I have a Django template as my front-end. At the back-end, I used the sessions provided from Gaeutilities to store a variable (email). Front-end: {% if session.Email %} <div id="entersite">WELCOME <em>{{session.Email}}</em></div> {% else %} <div id= "entersite"><a href="/login/" id= "entersite">Enter the Site</...

what is the use of related fields in openerp ?

I want to know the something about related fields, how it can be helped, and for which kind of scenario I should use fields.related, if anybody can provide small example for real use of fields.related it would be great Thanks in advance....... ...

How to display an image next to a menu item?

I am trying to get an image to appear next to a menu item but it isn't working. In order to make this as simple as possible, I have created a very simple example below that highlights the problem: import pygtk pygtk.require('2.0') import gtk class MenuExample: def __init__(self): window = gtk.Window() window.set_...

Passing arguments inside Scrapy spider through lambda callbacks

HI, I'm have this short spider code: class TestSpider(CrawlSpider): name = "test" allowed_domains = ["google.com", "yahoo.com"] start_urls = [ "http://google.com" ] def parse2(self, response, i): print "page2, i: ", i # traceback.print_stack() def parse(self, response): for i ...

python vlc.py or vlcwidget.py unable to open the MRL

I am encountering the following error. The mpg file is in the same directory where vlcwidget.py is located. Could some one point it out the issue or share thier experience? C:\workspace\python-HEAD\python>vlcwidget.py trn_anaglyph_adj.mpg libdvdnav: Using dvdnav version 4.1.4 libdvdread: Using libdvdcss version 1.2.10 for DVD access li...

RDOSession object with python

I want to Create RDOSession object win python for outlook addins can any tell me hoe to create RDOSession object inpython ??? Regards Thank You... ...

Tkinter Cxfreeze Error

I'm trying to make an exe in Windows out of python I developed in Linux. The program works on it's own in python under Windows, and when I use cxfreeze it completes and makes the exe. However when I run it I get: C:\projects\0802001S\dist>listen.exe Traceback (most recent call last): File "C:\Python26\lib\site-packages\cx_Freeze\ini...

qrcode generator using python for windows

Hello Friends I am looking for qrcode generator for python window version. Can anyone help me to find out. I didn't get anywhere. Please help me. Thanks, manu ...

Tkinter or wxpython

Hey guys I want a simple gui for one of may apps and am a noob when it comes gui itself. Tkinter and wxpython are the two standards in python i see.. Which one is simpler and more intuitive? ...

Python - making decorators with optional arguments

from functools import wraps def foo_register(method_name=None): """Does stuff.""" def decorator(method): if method_name is None: method.gw_method = method.__name__ else: method.gw_method = method_name @wraps(method) def wrapper(*args, **kwargs): method(*args, **...

How do I get access to the request object when validating a django.contrib.comments form?

I would like to run a check on the IP-adress when users post with django comments. I can easily override and customize the form used by django.comments, but I need access to the request object to add an IP-test to its clean(). Is it possible to get access to this in a clean way? An alternative could be to check the IP when recieving th...

Appengine - Upload to Google Spreadsheet datastore values

Hello, I´d like to know how to upload to a Google Spreadsheet, values stored in the database of my application. Objective: Connecting to Google Spreadsheet and automatically fill in a chart in the admin area with values that were passed by the upload. I've been giving a look in the docs and it seems to me that I have to use Bulk Loa...

python oatuh, LinkedIn API: send message to other connection

hello, I want to send some message to LinkedIn user, through its API. here is a doc for it - http://developer.linkedin.com/docs/DOC-1044 , but i have no clues - how should i pass that XML? i.e., for getting messages i'm using next code (and it works good): consumer = oauth.OAuthConsumer(LinkedinSocialView.CONSUMER_KEY, LinkedinSocialVie...