python

can i upload gae-data to localhost server .

this is my Teackback: D:\zjm_demo\app>appcfg.py upload_data --config_file=upload/str_loader.py --filename=upload/a.csv --kind=College --url=http://localhost:8100/remote_api Uploading data records. app_id argument required for non appspot.com domains D:\zjm_demo\app>appcfg.py upload_data --app_id=zjm1126 --config_file=upload/str_loader....

Convert python variables into javascript variables

I want to use Google Chart API using javascript. (I don't want to use the python wrapper) So how do I send data from my python code into the javascript to create graphs? ...

Efficient method to calculate the rank vector of a list in Python

I'm looking for an efficient way to calculate the rank vector of a list in Python, similar to R's rank function. In a simple list with no ties between the elements, element i of the rank vector of a list l should be x if and only if l[i] is the x-th element in the sorted list. This is simple so far, the following code snippet does the tr...

How do I get all of the values from a GWT multiselect ListBox on a post?

I have a multiselect ListBox in a FormPanel in GWT. I have set the name of the listbox to "foo" via ListBox.setName(). When I post the form, I see that all of the selected values get posted, but all are bound to the same name "foo". So I seemingly cannot get each of the posted values (I am using Django/Python server-side to handle the po...

Cookie not accepted on IE when authenticating with Graph API (oauth) - iframe app

Hello guys, I started playing with the new graph api with the python sdk. I'm trying to use the python-sdk in an iframe app to make the authentication (I successfully did it with JS - although the popup is blocked on IE and chrome by default). I'm following this example: http://github.com/facebook/python-sdk/blob/master/examples/oauth/f...

Python multiprocessing/threading with shared variables that only will be read

Considering the code below. I would like to run 3 experiments at a time. The experiments are independent, the only thing they share is the Model object which they only read. As there are seemingly no hard things in threading this out, how can I best do this in Python? I would like to use a pool or so to make sure that only three experim...

PyDev Hangs when opening a module

Win XP SP3 Eclipse 3.5.2 PyDev 1.5.7 Python 2.6.5 & 3.1.2 While trying to set up PyDev on Eclipse, everything works fine until I try to open a module (.py file) for editing, at which point Eclipse locks up. ...

Loading page with frames for a screenshot

I have an app that renders a web page in a iframe, and then loads X number of images in a div that overlays the frame. So I have this python script that loads the url, and takes a screenshot. It works on regular web pages, but I think the frame is throwing it off. Below is my code, and a link to the screenshot it's taking. #!/usr/bin/...

Split Python source into separate directories?

Here are some various Python packages my company "foo.com" uses: com.foo.bar.web com.foo.bar.lib com.foo.zig.web com.foo.zig.lib com.foo.zig.lib.lib1 com.foo.zig.lib.lib2 Here's the traditional way to store the source on disk: pysrc/ com/ foo/ bar/ web/ lib/ zig/ web/ lib/ l...

MySQL + Python (IronPython) timeout problem

I'm querying MS SQL using python using the source code from http://www.ironpython.info/index.php/Accessing_SQL_Server: import clr clr.AddReference('System.Data') from System.Data import * TheConnection = SqlClient.SqlConnection ("server=yourserver;database=News;uid=sa;password=password;timeout=0") TheConnection.Open() MyAction = SqlCl...

ZeroConf Chat with Python

Hello all, I am trying to set up a Bonjour (or Ahavi) chatbot for our helpdesk system that would answer basic questions based on a menu system. The basis of my question is how do I get python to create the bot so that it connects to the network as a chat client. Basically, anyone on my network with iChat or Empathy (or any chat program...

AssertRaises non-callable

Say I have the class class myClass(object): pname = "" def __getName(self): return pname def __setName(self, newname): if not isalpha(newname): raise ValueError("Error") elif self.pname = newname name = property(fget=__getName,fset=__setName) Seeing as these methods are private, and I...

Python 2.5.4 - ImportError: No module named etree.ElementTree

Hi, I'm running Python 2.5.4 on Windows and I keep getting an error when trying to import the ElementTree or cElementTree modules. The code is very simple (I'm following a tutorial): import xml.etree.ElementTree as xml root = xml.Element('root') child = xml.Element('child') root.append(child) child.attrib['name'] = "Charlie" file = ope...

How do I get the page content from PAMIE?

I'm using PAMIE to control IE to automatically browse to a list of URLs. I want to find which URLs return IE's malware warning and which ones don't. I'm new to PAMIE, and PAMIE's documentation is non-existent or cryptic at best. How can I get a page's content from PAMIE so I can work with it in Python? ...

How to substitute module.Class() to locally defined Class() when loading with Python's Pickle?

Hi, I have a pickle dump which has an array of foo.Bar() objects. I am trying to unpickle it, but the Bar() class definition is in the same file that's trying to unpickle, and not in the foo module. So, pickle complains that it couldn't find module foo. I tried to inject foo module doing something similar to: import imp, sys class...

Python Nose Import Error

I can't seem to get the nose testing framework to recognize modules beneath my test script in the file structure. I've set up the simplest example that demonstrates the problem. I'll explain it below. Here's the the package file structure: ./__init__.py ./foo.py ./tests ./__init__.py ./test_foo.py foo.py contains: def dumb_tr...

Can I use the google chat image on google app engine?

I am writing an app using python on GAE. I figure since I'm using google logins as the authentication for my users, why can't I use each users google chat picture as their user portrait? However I haven't found a way to access that info. Maybe I've been using facebook api's for too long, but is there any way to access that information? ...

What is the best way to distribute code across servers?

I have a directory of python programs, classes and packages that I currently distribute to 5 servers. It seems I'm continually going to be adding more servers and right now I'm just doing a basic rsync over from my local box to the servers. What would a better approach be for distributing code across n servers? thanks ...

Tornado handler thinks POST is missing argument when Firebug shows the argument being sent.

I have a simple form using a POST method, consisting of a text box and a file. After hitting submit, I can see the post in Firebug as follows: Parts multipart/form-data posttext Some text image BlahJFIFBlahExifBlahPhotoshopBlahBinaryStuff etc... The Tornado handler that receives it looks like: class NewPostHandler(BaseHand...

Node.TEXT_NODE has the value, but I need the Attribute

Hi, I have an xml file like so: <host name='ip-10-196-55-2.ec2.internal'> <hostvalue name='arch_string'>lx24-x86</hostvalue> <hostvalue name='num_proc'>1</hostvalue> <hostvalue name='load_avg'>0.01</hostvalue> </host> I can get get out the Node.data from a Node.TEXT_NODE, but I also need the Attribute name, like I want to kn...