python

Unable to Display image in Google App Engine (Python)

Hi, I am unable to display images in pages created using Google App Engine(Python). My app.yaml file has : - url: /images static_dir: images And the python file has: self.response.out.write("""<img src = '/images/title.gif' />""") The image still does not display in the page. Thanks ...

how to send some data to the Thread module on python and google-map-engine

from google.appengine.ext import db class Log(db.Model): content = db.StringProperty(multiline=True) class MyThread(threading.Thread): def run(self,request): #logs_query = Log.all().order('-date') #logs = logs_query.fetch(3) log=Log() log.content=request.POST.get('content',None) log.put() ...

flymake and python-execute-region

I got an error from flymake-get-file-name-mode-and-masks "Invalid file name" when I have called py-execute-region (bind to C-c |). Also void buffer with name like /tmp/python-3434.py appears. My flymake setup: (when (load "flymake" t) (defun flymake-pylint-init () (let* ((temp-file (flymake-init-create-temp-buffer-copy ...

How should I declare default values for instance variables in Python?

Should I give my class members default values like this: class Foo: num = 1 or like this? class Foo: def __init__(self): self.num = 1 In this question I discovered that in both cases, bar = Foo() bar.num += 1 is a well-defined operation. I understand that the first method will give me a class variable while the ...

Django: Serving a Download in a Generic View

So I want to serve a couple of mp3s from a folder in /home/username/music. I didn't think this would be such a big deal but I am a bit confused on how to do it using generic views and my own url. urls.py url(r'^song/(?P<song_id>\d+)/download/$', song_download, name='song_download'), The example I am following is found in the generic...

Is there a way to set the encoding for all files read and written by python

I have a script in python that needs to read iso-8859-1 files and also write in that encoding. Now I am running the script in an environment with all locales set at utf-8. Is there a way to define in my python scripts that all file acces have to use the iso-8859-1 encoding? ...

How to create simple web site with python?

How to create simple web site with python? I mean really simple, f.ex, you see text "Hello World", and there are button "submit", which (onClick) will show ajax box "submit successful". I want to start develop some stuff with Python, and I don't know where to start ;) ...

Python: Beginning problems

ok so basically i very new to programming and have no idea how to go about these problems help if you will ^^ Numerologists claim to be able to determine a person’s character traits based on the “numeric value” of a name. The value of a name is determined by summing up the values of the letters of the name, where ‘a’ is 1, ‘b’ is 2, ‘c...

How to call same method for a list of objects?

Suppose code like this: class Base: def start(self): pass def stop(self) pass class A(Base): def start(self): ... do something for A def stop(self) .... do something for A class B(Base): def start(self): def stop(self): a1 = A(); a2 = A() b1 = B(); b2 = B() all = [a1, b1, b2, ...

Feedback on availability with Google App Engine

We've had some good experiences building an app on Google App Engine, this first app's target audience are Google Apps users, so no issues there in terms of it being hosted on Google infrastructure. We like it so much that we would like to investigate using it for another app, however this next project is for a client who is not really ...

Conditional CellRenderCombo in pyGTK TreeView

I have a two column TreeView attached to a ListStore. Both columns are CellRenderCombo combo boxes. When the user selects an entry in the first box, I need to dynamically load a set of options in the second. For example, the behavior I want is: On row 0, the user selects "Alphabet" in the first column box. The second column box ...

matplotlib analog of R's `pairs`

R has a useful function pairs that provides nice matrix of plots of pairwise connections between variables in a data set. The resulting plot looks similar to the following figure, copied from this blog post: Is there any ready to use function based on python's matplolib? I have searched its gallery, but couldn't find anything that res...

Opencv python and webcam

Hello, I'm working with OpenCV on a beagleboard with ubuntu and OpenCV 1.1 interfaced via Python. I'm trying to set something up to capture a feed from a UVC compatible webcam (logitech C250). I have tested the webcam with luvcview and it works but only if I set the input format to YUV. If I run it in 'normal' mode I am getting back j...

Creating constant in Python

Hi, Is there a way to declare a constant in Python. In java we can create constant in this manner: public static final String CONST_NAME = "Name"; What is the equivalent of the above java constant declaration in python ? Cheers, ...

printing the instance in Python

Hello! With this code: class Complex: def __init__(self, realpart, imagpart): self.real = realpart self.imag = imagpart print self.real, self.imag I get this output: >>> Complex(3,2) 3 2 <__main__.Complex instance at 0x01412210> But why does he print the last line? ...

Python: how to input python-code part like \input in Tex?

I want to input code in Python like \input{Sources/file.tex}. How can I do it in Python? [added] Suppose I want to input data to: print("My data is here"+<input data here>). Data 1, 3, 5, 5, 6 ...

Compiling FAPWS3 on Windows 7?

Hi folks, I found no information whatsoever on how to install FAPWS3 on my Win7 machine. Help would be immensely appreciated! :) ...

How to get latest facebook status update in python?

I need to be able to get the latest facebook status update of an user that has allowed consent. Is there a way to do this with pyfacebook without having to have the user login in facebook? ...

Python: "inline" block / condition to return a char?

Sorry for the vague question. I would like to create a string that uses a plural if count > 1. For that, I would like have an "inline" condition that returns 's' to concatenate to my noun. print "The plural of plural is plural{0}. {1}".format( {'s' if count > 1}, "Isnt't it!?") ...

foo and _foo - about variables inside a class

class ClassName(object): """ """ def __init__(self, foo, bar): """ """ self.foo = foo # read-write property self.bar = bar # simple attribute def _set_foo(self, value): self._foo = value def _get_foo(self): return self._foo foo = property(_get_foo, _set_foo) ...