I am brand new to python/GAE and am wondering how to quickly define and use global settings variables, so say you git clone my GAE app and you just open config.yaml, add change the settings, and the app is all wired up, like this:
# config.yaml (or whatever)
settings:
name: "Lance"
domain: "http://example.com"
# main.py
class Main(...
Consider that I include namespaced reusable application:
urlpatterns = patterns('',
# ella urls
url('^ella/', include('ella.core.urls', namespace="ella")),
)
Now, the Ella applications has urls like that:
urlpatterns = patterns( '',
url( r'^(?P<category>[a-z0-9-/]+)/$', category_detail, name="category_detail" ),
# obj...
I have a REST service that I'm trying to call. It requires something similar to the following syntax:
http://someServerName:8080/projectName/service/serviceName/
param1Name/param1/param2Name/param2
I have to connect to it using POST. I've tried reading up on it online (here and here, for example)... but this is my problem:
If I...
I've been using The New Boston tutorial (http://www.youtube.com/watch?v=x9M3R6igH2E) on how to program with pygame and I keep getting an "invalid syntax" error on the print self.diff command. Only the self is highlighted. Here is the code (i've bolded the problem):
class vector(object):
def __init__(self, list1, list2):
self.diff=(...
I have a two-thread application: GUI, and some background work. I'm trying to send requests to the main thread to do GUI updates (move a progress bar), but it doesn't seem to work. I've boiled it down to a really minimal example:
import pygtk
pygtk.require('2.0')
import glib
import gtk
import threading
import sys
import time
def idle(...
I'm using django-nose to test our Django projects. It is common to split large test suites inside an application in Django like this:
myapp/
__init__.py
models.py
tests/
__init__.py
test_views.py
test_models.py
views.py
tests/__init__.py would look like this:
from test_views import *
from test_models import *
Si...
Suppose I have a class, and I want to reference some elements in the ' __dict__ (for instance, I want to copy the dict and delete the attribute that cannot be pickled), from inside the class.
Problem is, those attributes are "private" so my code ends up looking like so
class MyClasss(object):
def __init__(self):
self.__pr...
I am defining a SQLAlchemy model like this:
class SubProject(Base):
active = Column(Boolean)
class Project(Base):
active = Column(Boolean)
subprojects = relationship(SubProject, backref=backref('project'))
class Customer(Base):
active = Column(Boolean)
projects = relationship(Project, backref=backref('customer'))
I need to...
I wrote this simple python program to help me with a bug in another program. It clearly illustrates the problem.
import copy
class Obj(object):
def __init__(self, name):
self.name = name
def one(o):
print("1: o.name:", o.name) # "foo"
obackup = copy.deepcopy(o)
o.name = "bar"
print("2: o.name:", o.name) #...
Hi there,
I have a problem with Django settings.
My app runs with app-engine-patch.
I added a script that runs without django, and is reached directly via the app.yaml handlers.
I then get this error:
File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/conf/__init__.py", line 53, in _import_settings
raise Envi...
I would like to use the simplest library to choose a file in local directories. My program has nothing to do with a fancy user interface. It can take all the input from the console. I don't want users to enter an entire path to the console. That's the only point I need a simple user interface. Can you suggest me a simple, cross platform ...
Hi, I'm learning PyGTK and I have a parent window and a child window. Inside of a parent window's method, i create the child window and then I refresh a treeview... something like that:
def add_user(self, widget, data = None):
save_user.SaveUser(self.window)
self.load_tree_view()
But, when it's running, the child window appear...
Hi,
I tried hard to configure mod_wsgi for an pinax project. I followed the exact instructions from the site (pinaxproject.org), unfortunately, I always got the following error:
[Thu Aug 26 17:32:46 2010] [error] [client 173.48.119.55] (13)Permission denied: mod_wsgi (pid=26749): Unable to connect to WSGI daemon process 'www.mysiste.c...
Either interactively, such as from within an Ipython session, or from within a script, how can you determine which backend is being used by matplotlib?
...
Hello,
I have this problem and it's drivin' me nuts!
So I am developing my first real Google App Engine application and I always like to discover things while writing tests.
So I have the following setup:
I have a virtualenv with nose, nosegae, webtest and gaetestbed. It's called porksvr.
I activate my virtualenv like this:
source ...
level: beginner
the following code will print 'False'
def function(x):
if len(x) == 5: return True
else: return x[0] == x[-1]
print function('annb')
why does the line "else: return x[0] == x[-1]" print False?
i do understand what's happening but i'm having difficulties to put this into plain english...how can this behaviour ...
Problem: Widget 'A' is a toplevel window that is displayed after a button click in MainWindow 'B'. How do I assign a handler to handle the signal sent back after the 'X' along the window border of Widget 'A' is clicked (see below for current implementation)?
def on_mainWindow_B_button_clicked(self, widget):
self.widget_a.show()
de...
I have two images:
I'd like to essentially 'cut out' the black shape from the texture tile so that I end up with something along these lines:
Except transparent around the shape. Is this possible using pygame? This example I had to create in GIMP.
Additionally, would it be too performance-heavy to do this for every frame for...
Hello,
To add gtk-2.0 to my virtualenv I did the following:
$ virtualenv --no-site-packages --python=/usr/bin/python2.6 myvirtualenv
$ cd myvirtualenv
$ source bin/activate
$ cd lib/python2.6/
$ ln -s /usr/lib/pymodules/python2.6/gtk-2.0/
http://stackoverflow.com/questions/249283/virtualenv-on-ubuntu-with-no-site-packages
Now in th...
I am looking for a Python client for MSSQL, but one that supports encrypted connections to a remote MSSQL server.
Can someone recommend a technique for using Python to read from MSSQL, over an encrypted connection?
...