I need to get an App Engine app talking to and sharing data with an external database,
The best option i can come up with is outputting the external database data to an xml file and then processing this in my app engine app and storing it inside the datastore,
although the data being shared is sensitive data such as login details so ou...
How to query Employee to get all the address related to the employee, Employee.Add.all() does not work..
class Employee():
Add = models.ManyToManyField(Address)
parent = models.ManyToManyField(Parent, blank=True, null=True)
class Address(models.Model):
address_emp = models.CharField(max_length=512)
description = mo...
i want to define an array in python . how would i do that ? do i have to use list?
...
"8,5,,1,4,7,,,,7,,1,9,3,6,,,8,6,3,9,,2,5,4,,,,,3,2,,,7,4,1,1,,4,,6,9,,5,,,,5,,,1,,6,3,,,6,5,,,,7,4,,1,7,6,,,,8,,5,,,7,1,,3,9,"
I'm doing a programming challenge where i need to parse this sequence into my sudoku script.
Need to get the above sequence into 8,5,0,1,4,7,0,0,0,7,0,1,9,3,6,0,0,8.........
I tried re but without success, help ...
I want to use a module as a singleton referenced in other modules. It looks something like this (that's not actually a code I'm working on, but I simplified it to throw away all unrelated stuff):
main.py
import singleton
import printer
def main():
singleton.Init(1,2)
printer.Print()
if __name__ == '__main__':
pass
singleto...
I've got a tiny bit of code to display a file
in app.yaml
- url: /(.*\.(gif|png|jpg))
static_files: static/\1
upload: static/(.*\.(gif|png|jpg))
in main.py
...
class ShowImage(webapp.RequestHandler):
def get(self):
rootpath = os.path.dirname(__file__)
file = rootpath + "/static/tracker.gif";
fh=open(file, 'r'...
I have problem with this code:
file = tempfile.TemporaryFile(mode='wrb')
file.write(base64.b64decode(data))
file.flush()
os.fsync(file)
# file.seek(0)
f = gzip.GzipFile(mode='rb', fileobj=file)
print f.read()
I dont know why it doesn't print out anything. If I uncomment file.seek then error occurs:
File "/usr/lib/python2.5/gzip.py"...
Hello,
I was wondering if there exists some kind of indexer (in python language for exemple) that would take a bunch of html files and create an index in javascript.
In the solution, these javascript files would then be used to create a pure browser search engine.
Jerome
...
A simplified version of my problem:
I have a list comprehension that i use to set bitflags on a two dimensional list so:
s = FLAG1 | FLAG2 | FLAG3
[[c.set_state(s) for c in row] for row in self.__map]
All set_state does is:
self.state |= f
This works fine but I have to have this function "set_state" in every cell in __map. Every c...
/mysite/project4
class notes(models.Model):
created_by = models.ForeignKey(User)
detail = models.ForeignKey(Details)
Details and User are in the same module i.e,/mysite/project1
In project1 models i have defined
class User():
......
class Details():
......
When DB i synced there is an error saying
Error:...
I'm dynamically storing information in the database depending on the request:
// table, id and column are provided by the request
table_obj = getattr(models, table)
record = table_obj.objects.get(pk=id)
setattr(record, column, request.POST['value'])
The problem is that request.POST['value'] sometimes contains a foreign record's prima...
Idlestartup is analogous to pythonstartup variable, but for IDLE, instead of command line.
But it seems not to work properly. I'm using python 2.6.5 on Windows.
I have the following script assigned to it:
from pprint import pprint
import sys
newPath = 'C:\\Python26\test')
sys.path.append(newPath)
print "initial config loaded"
Both va...
Hi,
I can't find a correct way to get the environment variable for the appdata path in python.
The problem is that my user name includes special characters (the german ae and ue).
I made a workaround wit PyQt for Vista and Windows 7 but it doesn't work for XP Systems.
Does anybody know the correct encoding of these environment variabl...
We're developing perforce custom tools in python and we're outputting messages during the script execution. It shows up in p4win but we're mainly using p4v and the output doesn't show up in the log window.
Is there a way to output there or in any other pane without resorting to run the tool in a terminal window ?
Thanks
...
I'm using mod_wsgi apache2 adapter for a django site and I like to call some bash process within a view, using the usual
...
p = subprocess.Popen("/home/example.com/restart-tomcat.sh", shell=True)
sts = os.waitpid(p.pid, 0)[1]
...
This code works perfectly from within a usual python shell but does nothing (I can trace right now) when ...
Before I ask this, do note: I want this for debugging purposes. I know that this is going to be some bad black magic, but I want to use it just during debugging so I could identify my objects more easily.
It's like this. I have some object from class A that creates a few B instances as attributes:
class A(object):
def __init__(self...
Hi
im trying to detect a marker in a webcam video feed and overlay it with a 3d object - pretty much exactly like this: http://www.morethantechnical.com/2009/06/28/augmented-reality-with-nyartoolkit-opencv-opengl/
i know artoolkit is the best module for this, but i was hoping to just use opencv in python since i dont know nearly enough...
I was writing a metaclass and accidentally did it like this:
class MetaCls(type):
def __new__(cls, name, bases, dict):
return type(name, bases, dict)
...instead of like this:
class MetaCls(type):
def __new__(cls, name, bases, dict):
return type.__new__(cls, name, bases, dict)
What exactly is the difference b...
I am using the gdata.youtube service to insert a video entry. It is failing with a url fetch error complaining that the file is too large. It is a pretty small video (1.7MB). In an ideal world, there is a natural way to break up the file as necessary and stream it in chunks. Is there an api to do this already.
Here is the code I am usin...
I'd like to do something like:
do lots of stuff to prepare a good environement
become_interactive
#wait for Ctrl-D
automatically clean up
Is it possible with python?If not, do you see another way of doing the same thing?
...