Hi,
I've tried to solve this myself searching and searching but I can't get it to work. :( I'm in Snow Leopard 10.6.4 and tried to setup my Django environment, first I upgraded my python to 2.6.5, installed django and then mysql_python. All seems to be smooth until I to connect to mysql using syncdb.
Got this error/trace message: djang...
Hello, I'm trying to start a text editor (nano) from inside Python, have the user enter text, and then capture the text once they writeout (Control-O). I haven't worked with the subprocess module before, nor pipes, so I don't know what to try next.
So far I have this code:
a = subprocess.Popen('nano', stdout=subprocess.PIPE, shell=True...
I have a unit test for my GAE app:
def test_getNeighborhoodKeys_twoCourses(self):
cs1110, cs2110 = testutils.setUpSimpleCourses()
foo = getFooResult()
bar = getBarResult()
self.assertEquals(foo, bar) # fails
This is the failure:
AssertionError: set([CS 1110: Untitled, CS 2110: Untitled]) != s...
my 'College' model data is :
my str_loader.py is :
class MySQLExporter(bulkloader.Exporter):
def output_entities(self, entity_generator):
conn = MySQLdb.connect(host='localhost',user='root',passwd='root',db='test',charset="utf8")
c = conn.cursor()
for entity in entity_generator:
c.execute("INSERT...
I have a scientific data management problem which seems general, but I can't find an existing solution or even a description of it, which I have long puzzled over. I am about to embark on a major rewrite (python) but I thought I'd cast about one last time for existing solutions, so I can scrap my own and get back to the biology, or at l...
Hello people,
consider the following python code:
import gtk
class MainWindow():
def __init__(self):
self.window = gtk.Window()
self.window.show()
if __name__ == "__main__":
main = MainWindow()
gtk.main()
I'd need to catch clicks anywhere inside this gtk.Window().
I haven't found any suitable event (I als...
I'm new to Python, and I wanted to make sure that I overrode __eq__ and __hash__ correctly, so as not to cause painful errors later:
(I'm using Google App Engine.)
class Course(db.Model):
dept_code = db.StringProperty()
number = db.IntegerProperty()
title = db.StringProperty()
raw_pre_reqs = db.StringProperty(multiline=...
I am trying to write a long string in Python that gets displayed as the help item of an OptParser option. In my source code .py file, I'd like to place newlines so that my code doesn't spend new lines. However, I don't want those newlines to affect how that string is displayed when the code is run. For example, I want to write:
pa...
As the question says, what would be the difference between:
x.getiterator() and x.iter(), where x is an ElementTree or an Element? Cause it seems to work for both, I have tried it.
If I am wrong somewhere, correct me please.
...
I use numpy for numerical linear algebra. I suspect that I can get much better performance if I make small modifications in how I carry out certain computations so that they are more memory efficient, for example.
I was wondering if there is any form of instrumentation available in python to detect cache and TLB misses. There is a very ...
Hi Folks,
I'm looking for most fastest/effective way of deleting certain keys in a python dict
Here are some options
for k in somedict.keys():
if k.startswith("someprefix"):
del somedict[k]
or
dict((k, v) for (k, v) in somedict.iteritems() if not k.startswith('someprefix'))
Logically first snippet should be faster o...
Hi there,
I currently work with Google's AppEngine and I could not find out, whether a Google DataStorage Object Entry has an ID by default, and if not, how I add such a field and let it increase automatically?
regards,
...
I have a QVBoxLayout that I've added a few widgets to, via addWidget(). I need to now delete those widgets, and it seems I need to use removeWidget() (which takes in a widget to be removed) to do that.
I thought that calling children() or findChildren(QWidget) on my layout would return a list of the widgets I've added into it; I'm in t...
In Mercurial, many of the extensions wrap their help/syntax string in a call to an underscore function, like so:
_('[OPTION] [QUEUE]')
This confuses me, because it does not seem necessary (the Writing Extensions instructions don't mention it) and there doesn't seem to be a _ defined in the class, so I'm wondering if this is some spec...
I have built a Macro language for my users that is based upon the Django template language. Users enter into UITextFields their template/macro snippets that can be rendered in the context of larger documents. So I have large multi-line string snippets of django template code that should be populated with variables that are also stored ...
I'm having trouble with Fabric not recognizing hosts that I have in .ssh/config.
My fabfile.py is as follows:
from fabric.api import *
env.hosts = ['lulu']
def whoami():
run('whoami')
Running $ fab whoami gives:
[lulu] run: whoami
Fatal error: Name lookup failed for
lulu
The name lulu is in my ~/.ssh/config, like t...
I am creating HTML form and using Python to code it. I have installed Apache version2.2 and Python version 2.6. Here is the code:
#!C:\Python26\Python.exe -u
#import cgi modules
import cgi
#create instances of field storage
form = cgi.FieldStorage()
#get data from the fields
first_name = form.getvalue('first_name')
last_name = form....
Hi everyone,
I am trying to make a simple server/client program pair.
On LAN they work fine, but when i try to connect from the "outside" it says connection refused. I shut down firewalls on both machines but i am still unable to connect, and i double checked the ip.
What am i doing wrong?
Thanks
Jake
Code:
import socket
host = ''...
Hi all,
I'm building Pylons web applications that use a lot of jQuery and AJAX/JSON to make these apps more Web 2.0'ie. I've been looking at the server push technologies and have questions about how to do this with Pylons. I've looked at Comet and NodeJS (though I don't know much about NodeJS yet) and am confused about what would be a g...
As the title suggests, is it possible to run a WSGI server from (x)inetd?
...