content stringlengths 85 101k | title stringlengths 0 150 | question stringlengths 15 48k | answers list | answers_scores list | non_answers list | non_answers_scores list | tags list | name stringlengths 35 137 |
|---|---|---|---|---|---|---|---|---|
Q:
Python - value in list of dictionaries
Possible Duplicate:
What's the best way to search for a Python dictionary value in a list of dictionaries?
I have a list of dictionaries in the form
my_dict_list = []
my_dict_list.append({'text':'first value', 'value':'number 1'})
my_dict_list.append({'text':'second value',... | Python - value in list of dictionaries |
Possible Duplicate:
What's the best way to search for a Python dictionary value in a list of dictionaries?
I have a list of dictionaries in the form
my_dict_list = []
my_dict_list.append({'text':'first value', 'value':'number 1'})
my_dict_list.append({'text':'second value', 'value':'number 2'})
my_dict_list.append({... | [
"for r in result:\n for d in dict:\n if d['value'] == r:\n print \"ok\"\n\n",
"map(lambda string: any(map(lambda item: item['value'] == string, dict)), results) returns a list of [True, False] for the given results. Although using for is more appropriate here, because you can break the nested loop when ... | [
7,
4,
1
] | [] | [] | [
"python"
] | stackoverflow_0005665114_python.txt |
Q:
Displaying ForeignKey data in Django admin change/add page
I'm trying to get an attribute of a model to show up in the Django admin change/add page of another model. Here are my models:
class Download(model.Model):
task = models.ForeignKey('Task')
class Task(model.Model):
added_at = models.DateTimeField(.... | Displaying ForeignKey data in Django admin change/add page | I'm trying to get an attribute of a model to show up in the Django admin change/add page of another model. Here are my models:
class Download(model.Model):
task = models.ForeignKey('Task')
class Task(model.Model):
added_at = models.DateTimeField(...)
Can't switch the foreignkey around, so I can't use Inlines,... | [
"If you don't need to edit it, you can display it as a readonly field:\nclass DownloadAdmin(admin.ModelAdmin):\n readonly_fields = ('task_added_at',)\n\n def task_added_at(self, obj):\n return obj.task.added_at\n\n"
] | [
13
] | [] | [] | [
"django",
"django_admin",
"django_models",
"python"
] | stackoverflow_0005665133_django_django_admin_django_models_python.txt |
Q:
Django as middleware in a tornado app
I am trying to run tornadio (socket.io for python) to work with django. Is there are way to do something like this in tornado (running django as middleware), or can I access tornadio from within django (uncommenting the second application definition routes straight to django):... | Django as middleware in a tornado app | I am trying to run tornadio (socket.io for python) to work with django. Is there are way to do something like this in tornado (running django as middleware), or can I access tornadio from within django (uncommenting the second application definition routes straight to django):
#!/usr/bin/env python
import os
import tor... | [
"I would look at using this project to help:\n https://github.com/koblas/django-on-tornado\nIt an integration of tornado and django allowing you to do this:\npython manage.py runtornado --reload 8888\n\nIncluded is a sample chat service built using django and tornado.\n"
] | [
2
] | [] | [] | [
"django",
"python",
"socket.io",
"tornado",
"wsgi"
] | stackoverflow_0005642163_django_python_socket.io_tornado_wsgi.txt |
Q:
problem with xmlrpc server
I run simple example with xmlrpc server and press Ctrl-C on keyboard :).
from SimpleXMLRPCServer import SimpleXMLRPCServer
from time import sleep
import threading,time
class Test(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.test1 = 0
... | problem with xmlrpc server | I run simple example with xmlrpc server and press Ctrl-C on keyboard :).
from SimpleXMLRPCServer import SimpleXMLRPCServer
from time import sleep
import threading,time
class Test(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.test1 = 0
def test(self):
retu... | [
"Use a timeout:\nSet timeout for xmlrpclib.ServerProxy\nEDIT\nThe answer linked to here is not compatible with Python 2.7. Here is modified code that works (tested on W7/ActivePython 2.7):\nimport xmlrpclib\nimport httplib\n\nclass TimeoutHTTPConnection(httplib.HTTPConnection):\n\n def __init__(self,host,timeou... | [
2,
0
] | [] | [] | [
"python",
"xmlrpclib"
] | stackoverflow_0005663946_python_xmlrpclib.txt |
Q:
convert decimal to significant digits
Is there a function in python that could convert decimal to 3-4 significant digits,
eg:
55820.02932238298323 to 5.58e4
Many thanks in advance.
A:
If by "convert to" you mean that you want a string formatted like that, you can use the %e format option:
>>> '%.2e' % 55820.02... | convert decimal to significant digits | Is there a function in python that could convert decimal to 3-4 significant digits,
eg:
55820.02932238298323 to 5.58e4
Many thanks in advance.
| [
"If by \"convert to\" you mean that you want a string formatted like that, you can use the %e format option:\n>>> '%.2e' % 55820.02932238298323\n'5.58e+04'\n\n",
"In [50]: \"{0:.2e}\".format(55820.02932238298323)\nOut[50]: '5.58e+04'\n\n",
"If this is for output purposes you can just use string formatting:\n>>>... | [
3,
0,
0
] | [] | [] | [
"python"
] | stackoverflow_0005665565_python.txt |
Q:
Python std.stdout.write loop problems
I'm not sure of what's going on here, but I have some python code:
import sys
max_cols = 350
max_rows = 1
r1 = range(max_rows)
r2 = range(max_cols)
for y in r1:
for x in r2:
sys.stdout.write('something')
if x is not max_cols-1:
sys.stdout.writ... | Python std.stdout.write loop problems | I'm not sure of what's going on here, but I have some python code:
import sys
max_cols = 350
max_rows = 1
r1 = range(max_rows)
r2 = range(max_cols)
for y in r1:
for x in r2:
sys.stdout.write('something')
if x is not max_cols-1:
sys.stdout.write(',')
Now, this works fine for values of ... | [
"is is not for checking equality but for checking identity. x is y is only true if both variables refer to the same object. As it happens, CPython resuses objects for small integers - but in general, the concept of identity is very different from the concept of equality. Use the correct operators, == and != for equ... | [
5,
2
] | [] | [] | [
"python",
"python_3.x"
] | stackoverflow_0005665722_python_python_3.x.txt |
Q:
Pylint complains about wxPython - 'Too many public methods'
For the following simple wxPython snippets:
import sys
import wx
class MyApp(wx.App):
def OnInit(self):
self.frame = wx.Frame(None, title="Simple wxPython App")
self.frame.Show()
self.SetTopWindow(self.frame)
return Tr... | Pylint complains about wxPython - 'Too many public methods' | For the following simple wxPython snippets:
import sys
import wx
class MyApp(wx.App):
def OnInit(self):
self.frame = wx.Frame(None, title="Simple wxPython App")
self.frame.Show()
self.SetTopWindow(self.frame)
return True
def main(argv=sys.argv[:]):
app = MyApp()
app.MainLoo... | [
"# pylint: disable=R0904\n\nStick that at the top of the offending class.\nOn older versions of Pylint, you have to use\n# pylint: disable-msg=R0904\n\nUnfortunately, if you ever upgrade to a more recent version you'll have to write a sed script to replace all instances of # pylint: disable-msg with # pylint: disab... | [
17
] | [] | [] | [
"pylint",
"python",
"wxpython"
] | stackoverflow_0005665797_pylint_python_wxpython.txt |
Q:
python serialization of objects on appengine
I wanted to serialize an object in xml for a client application from app-engine. I started using the django 1.2 serialization described here:
http://docs.djangoproject.com/en/1.2/topics/serialization/
from django.core import serializers
....
data = serializers.serial... | python serialization of objects on appengine | I wanted to serialize an object in xml for a client application from app-engine. I started using the django 1.2 serialization described here:
http://docs.djangoproject.com/en/1.2/topics/serialization/
from django.core import serializers
....
data = serializers.serialize("xml", TestObject.all())
It raises the follow... | [
"Do you need the XML to be in a specific format? All db.Model objects have a built-in to_xml() method that conforms to Atom & GData specs. Is that useful?\n"
] | [
2
] | [] | [] | [
"google_app_engine",
"python",
"xml"
] | stackoverflow_0005666122_google_app_engine_python_xml.txt |
Q:
Weird problem with input encoding in IPython
I'm running python 2.6 with latest IPython on Windows XP SP3, and I have two questions. First one of my problems is, when under IPython, I cannot input Unicode strings directly, and, as a result, cannot open files with non-latin names. Let me demonstrate. Under usual py... | Weird problem with input encoding in IPython | I'm running python 2.6 with latest IPython on Windows XP SP3, and I have two questions. First one of my problems is, when under IPython, I cannot input Unicode strings directly, and, as a result, cannot open files with non-latin names. Let me demonstrate. Under usual python this works:
>>> sys.getdefaultencoding()
'asc... | [
"Yes. Typing Unicode at the console is always problematic and generally best avoided, but IPython is particularly broke. It converts characters you type on its console as if they were encoded in ISO-8859-1, regardless of the actual encoding you're giving it.\nFor now, you'll have to say u'm:/\\u0411\\u043b\\u043e\\... | [
12,
1,
0
] | [] | [] | [
"filesystems",
"ipython",
"locale",
"python",
"windows"
] | stackoverflow_0002260815_filesystems_ipython_locale_python_windows.txt |
Q:
How to import a module from a directory on level above the current script
For my Python application, I have the following directories structure:
\myapp
\myapp\utils\
\myapp\utils\GChartWrapper\
\myapp\model\
\myapp\view\
\myapp\controller\
One of my class in \myapp\view\ must import a class called GChartWrapper. ... | How to import a module from a directory on level above the current script | For my Python application, I have the following directories structure:
\myapp
\myapp\utils\
\myapp\utils\GChartWrapper\
\myapp\model\
\myapp\view\
\myapp\controller\
One of my class in \myapp\view\ must import a class called GChartWrapper. However, I am getting an import error...
myview.py
from myapp.utils.GChartWrapp... | [
"The __init__.py file of the GChartWrapper package expects the GChartWrapper package on PYTHONPATH. You can tell by the first line:\nfrom GChartWrapper.GChart import *\n\nIs it necessary to have the GChartWrapper included package in your package directory structure?\nIf so, then one thing you could do is adding the... | [
7,
5,
2,
2,
0
] | [] | [] | [
"gchart",
"import",
"python"
] | stackoverflow_0001003843_gchart_import_python.txt |
Q:
Registry error when installing MySQL-python into virtualenv using pip and easy_install
The pip and easy install commands (install MySQL-python) provide the massive error listed below.
I've been looking around for an answer a while now on this site and through google. The recurring answer is to install python dev ... | Registry error when installing MySQL-python into virtualenv using pip and easy_install | The pip and easy install commands (install MySQL-python) provide the massive error listed below.
I've been looking around for an answer a while now on this site and through google. The recurring answer is to install python dev (pip install python-dev) however the response I receive is "no distributions at all found"
D... | [
"Try ActivePython:\npypm -E C:\\virtualenvs\\myvirtualenv2 install mysql-python\n\nno compile orgy. no strange errors. no terror.\n",
"Installing mysqldb on windows is tricky. I can install it manually, after downloading and unpacking mySQL-python:\n\nGo to MySQL-python-1.2.3 folder\nEdit the file site.cfg\nRun ... | [
5,
3
] | [] | [] | [
"mysql_python",
"pip",
"python",
"virtualenv",
"windows_xp"
] | stackoverflow_0005652027_mysql_python_pip_python_virtualenv_windows_xp.txt |
Q:
How to programmatically put data to the Google Appengine database from remote executable?
I would like to pre-fill and periodically put data to the Google Appengine database.
I would like to write a program in java and python that connect to my GAE service and upload data to my database.
How can I do that?
Thanks ... | How to programmatically put data to the Google Appengine database from remote executable? | I would like to pre-fill and periodically put data to the Google Appengine database.
I would like to write a program in java and python that connect to my GAE service and upload data to my database.
How can I do that?
Thanks
| [
"Please use RemoteAPI for doing this programmatically.\nIn python, you can first configure the appengine_console.py as described here\nOnce you have that, you can launch and write the following commands in the python shell:\n$ python appengine_console.py yourapp\n>>> import yourdbmodelclassnamehere\n>>> m = yourmod... | [
3
] | [] | [] | [
"google_app_engine",
"java",
"python"
] | stackoverflow_0005666337_google_app_engine_java_python.txt |
Q:
Python error while connecting to nntp server
Traceback (most recent call last):
File "<pyshell#27>", line 1, in <module>
server = NNTP('http://www.news.readfreenews.net')
File "C:\Python27\lib\nntplib.py", line 112, in __init__
self.sock = socket.create_connection((host, port))
File "C:\Python27\lib\... | Python error while connecting to nntp server | Traceback (most recent call last):
File "<pyshell#27>", line 1, in <module>
server = NNTP('http://www.news.readfreenews.net')
File "C:\Python27\lib\nntplib.py", line 112, in __init__
self.sock = socket.create_connection((host, port))
File "C:\Python27\lib\socket.py", line 553, in create_connection
for... | [
"You're using HTTP to connect to NNTP? Replace server = NNTP('http://www.news.readfreenews.net') with server = NNTP('news.readfreenews.net') or server = NNTP('www.news.readfreenews.net'), depending on which works fine.\n"
] | [
2
] | [] | [] | [
"nntp",
"python"
] | stackoverflow_0005666680_nntp_python.txt |
Q:
returning the largest or smallest result from a for loop in python
Suppose chest is a list of coordinates that are two item lists.
For example chest = [[2,4], [4,5], [1,3]]
With the function below, I want the distance between the point (x,y) and each of the chest points. So as it is, the function would return t... | returning the largest or smallest result from a for loop in python | Suppose chest is a list of coordinates that are two item lists.
For example chest = [[2,4], [4,5], [1,3]]
With the function below, I want the distance between the point (x,y) and each of the chest points. So as it is, the function would return these three distances, right? But my question is, how do I return only t... | [
"You could use max() or min() plus a generator expression...\nreturn max(\n sqrt( abs(x - cx) + abs(y - cy) )\n for cx, cy in chests)\n\nAlso note that as an optimization, you may prefer to do this instead (since if sqrt(x) > sqrt(y), then x > y) to reduce the number of sqrt calls:\nreturn sqrt(max(\n abs(... | [
7,
1,
0
] | [] | [] | [
"for_loop",
"python"
] | stackoverflow_0005666781_for_loop_python.txt |
Q:
Import psycopg2 from python script
I am trying to use psycopg2 installed by easy_install in a python script.
This is the header of my script :
#!/usr/bin/python2
import sys,xml.sax
import psycopg2
When I execute it, an error happens :
Traceback (most recent call last):
File "./myscript.py", line 4, in <module... | Import psycopg2 from python script | I am trying to use psycopg2 installed by easy_install in a python script.
This is the header of my script :
#!/usr/bin/python2
import sys,xml.sax
import psycopg2
When I execute it, an error happens :
Traceback (most recent call last):
File "./myscript.py", line 4, in <module>
import psycopg2
ImportError: No ... | [
"Each sequence is being performed with a different installation of Python. Use which python2 to verify.\n",
"You are using two different Python interpreters. Triple check that.\n",
"install python_select.this lets switch between different python versions.\nsudo port install python_select \non the shell do pyth... | [
1,
0,
0
] | [] | [] | [
"psycopg2",
"python"
] | stackoverflow_0005666155_psycopg2_python.txt |
Q:
Using super() Multiple Times in a Python Class
Why does user.params() not return all the params up the inheritance
chain? -- It's not including the params defined in Person() -- notice
Vertex() does not have a params() method.
class Element(object):
def __init__(self,element_type):
self.oid = None
... | Using super() Multiple Times in a Python Class | Why does user.params() not return all the params up the inheritance
chain? -- It's not including the params defined in Person() -- notice
Vertex() does not have a params() method.
class Element(object):
def __init__(self,element_type):
self.oid = None
self.uuid = uuid.uuid4()
self.key = None... | [
"In User you do:\nself.s = super(User,self)\nself.s.__init__(name,uri,email)\n\nso self.s is what? As you do the same in Person, self.s is super(Person) and that anywhere, in Person and User as you reassign self.s, so the self.s.params that gets picked is the one of Element.\n",
"edit : also the following code wo... | [
2,
1
] | [] | [] | [
"python"
] | stackoverflow_0005666615_python.txt |
Q:
Change elements in a CvSeq in python
I'm trying to extract contours from an image, rotate these contours and insert them in a new image. The code is given below.
My problem is in the rotate contours method. When the code is executed the following error is seen "TypeError: 'cv.cvseq' object does not support item a... | Change elements in a CvSeq in python | I'm trying to extract contours from an image, rotate these contours and insert them in a new image. The code is given below.
My problem is in the rotate contours method. When the code is executed the following error is seen "TypeError: 'cv.cvseq' object does not support item assignment".
Any ideas of how to solve this... | [
"It seems that you can’t change the elements of the cvseq object using the Python bindings (notice here that list of Python methods for manipulating cvseq objects only has methods for removing sequence elements and changing their order.)\nThe Python bindings do nonetheless provide the tools to achieve your stated a... | [
1
] | [] | [] | [
"opencv",
"python"
] | stackoverflow_0005132874_opencv_python.txt |
Q:
How to extract column and row in csv using python
I have this input in a file.csv
"","min","max","rainfall","days_clear"
"Missouri",-2,10,300,23
"Amsterdam",-3,5,1212,34
"LA",10,20,1000,54
I wanted to write a simple program to find the city with the lowest rainfall which is Missouri in this case. How can I do tha... | How to extract column and row in csv using python | I have this input in a file.csv
"","min","max","rainfall","days_clear"
"Missouri",-2,10,300,23
"Amsterdam",-3,5,1212,34
"LA",10,20,1000,54
I wanted to write a simple program to find the city with the lowest rainfall which is Missouri in this case. How can I do that using Python csv reader?
I can try extract the items... | [
"import csv\n\ndef main():\n with open('file.csv', 'rb') as inf:\n data = [(int(row['rainfall']), row['']) for row in csv.DictReader(inf)]\n\n data.sort()\n print data[0]\n\nif __name__==\"__main__\":\n main()\n\nreturns\n(300, 'Missouri')\n\n",
"One way to do this would be to use the csv modul... | [
6,
1,
0,
0,
0
] | [] | [] | [
"csv",
"python"
] | stackoverflow_0005621208_csv_python.txt |
Q:
How to iterate over field values of objects?
In a django project I am trying to display the report like this:
Heading: Field1 Field2 Field3 of Type A Field3 of Type B
Data: Record1Value1 Record1Value2 Record1Value3
Record2Value1 Record2Value2 ... | How to iterate over field values of objects? | In a django project I am trying to display the report like this:
Heading: Field1 Field2 Field3 of Type A Field3 of Type B
Data: Record1Value1 Record1Value2 Record1Value3
Record2Value1 Record2Value2 Record2Value3
Record3Value1 Re... | [
"It's hard to say for sure without all of the details of your model implementation, but you should be able to pass the objects result directly to your template and work with it there.\nHere's the idea:\n<th>\n<td> field1</td> <td> field2</td> <td> field3 of type A</td> <td>field3 of typeB </td>\n</th>\n{%for obj... | [
1
] | [] | [] | [
"django",
"field",
"html_table",
"python"
] | stackoverflow_0005657812_django_field_html_table_python.txt |
Q:
Django pagination with AJAX behaviour
I am looking for examples, tutorials, or even just directions on how I would implement pagination on list of comments with Django. And the list is just part of the web page, so I want to avoid refreshing the whole page when users change pages, thus AJAX. A perfect example is Y... | Django pagination with AJAX behaviour | I am looking for examples, tutorials, or even just directions on how I would implement pagination on list of comments with Django. And the list is just part of the web page, so I want to avoid refreshing the whole page when users change pages, thus AJAX. A perfect example is YouTube's comments section.
It's preferred i... | [
"Django-endless-pagination is a really nice plugin for this. I've been using it for a while and have never had any issues with either the digg-style ajax pagination or the twitter style ajax pagination. Here's the link:\nhttp://code.google.com/p/django-endless-pagination/\n"
] | [
4
] | [] | [] | [
"ajax",
"django",
"pagination",
"python"
] | stackoverflow_0005667296_ajax_django_pagination_python.txt |
Q:
Sending Java Packets to Python Server?
I'm just starting to learn about sending UDP packets, and I'm running into a problem. I've written a Java client and server which easily communicate with each other, and I've done a Python client/server combo, but I'm not sure how to send a UDP packet from Java and receive it... | Sending Java Packets to Python Server? | I'm just starting to learn about sending UDP packets, and I'm running into a problem. I've written a Java client and server which easily communicate with each other, and I've done a Python client/server combo, but I'm not sure how to send a UDP packet from Java and receive it in Python. Here's what I have for the Java ... | [
"The problem must be within your code, they should be able to communicate: this\nis a good example of writing a client server pair in java. \n",
"So, to start, I'm on Ubuntu 10.10.\nI went into /etc/hosts and it looks like 127.0.0.1 was assigned to localhost.localdomain, while 127.0.1.1 was assigned to my mach... | [
1,
1,
0
] | [] | [] | [
"client",
"java",
"python",
"udp"
] | stackoverflow_0005666271_client_java_python_udp.txt |
Q:
Efficient variable byte iteration over a string in Python
I'm reading a large (500MB) binary file in Python and parsing it byte by byte into a Python data structure. This file represents a sparse data grid. Depending on the format sometimes I need to read one byte, two bytes, or four bytes at a time. For bureau... | Efficient variable byte iteration over a string in Python | I'm reading a large (500MB) binary file in Python and parsing it byte by byte into a Python data structure. This file represents a sparse data grid. Depending on the format sometimes I need to read one byte, two bytes, or four bytes at a time. For bureaucratic reasons, I'm required to do this in Python rather than ... | [
"mmap\n"
] | [
7
] | [] | [] | [
"file_io",
"python"
] | stackoverflow_0005667467_file_io_python.txt |
Q:
Test specific error number from a Python socket exception
I have some python code that binds to a socket. I catch any exception so that I can handle it. Depending on the error, I want to do different things. How do I know what an error number means?
For example, I want to do something like:
import socket
s = so... | Test specific error number from a Python socket exception | I have some python code that binds to a socket. I catch any exception so that I can handle it. Depending on the error, I want to do different things. How do I know what an error number means?
For example, I want to do something like:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.bind(... | [
"These errors are all defined in the errno module in the standard library.\n"
] | [
2
] | [] | [] | [
"python",
"sockets"
] | stackoverflow_0005667722_python_sockets.txt |
Q:
Appengine won't display Python function
I have a really simple program that checks the date and returns if the combined month+day+year is a so called happy number (a number whos sum of the square of its digits equal one) or not.
The program works fine when I run it locally through python but when I try to run it t... | Appengine won't display Python function | I have a really simple program that checks the date and returns if the combined month+day+year is a so called happy number (a number whos sum of the square of its digits equal one) or not.
The program works fine when I run it locally through python but when I try to run it through the appengine, either locally or onlin... | [
"You can't simply print to stdout in a CGI script; you must first send headers followed by a blank line. Your output is being interpreted by your browser as HTTP headers and isn't printing.\nYou almost certainly want to be using some kind of WSGI framework to handle this for you.\n"
] | [
5
] | [] | [] | [
"google_app_engine",
"python"
] | stackoverflow_0005667772_google_app_engine_python.txt |
Q:
Python keyword args vs kwargs
This might be a simple question:
Is there any difference between the two folowing:
def myfunc(a_list = [], **kwargs):
my_arg = kwargs.get('my_arg', None)
pass
and
def myfucn(a_list = [], my_arg = None):
pass
If not, which would be considered more pythonic?
Thanks,
-Matt
... | Python keyword args vs kwargs | This might be a simple question:
Is there any difference between the two folowing:
def myfunc(a_list = [], **kwargs):
my_arg = kwargs.get('my_arg', None)
pass
and
def myfucn(a_list = [], my_arg = None):
pass
If not, which would be considered more pythonic?
Thanks,
-Matt
| [
"For a simple function, it's more Pythonic to explicitly define your arguments. Unless you have a legit requirement to accept any number of unknown or variable arguments, the **kwargs method is adding unnecessary complexity.\nBonus: Never initialize a list in the function definition! This can have unexpected resul... | [
7,
1,
1
] | [] | [] | [
"keyword_argument",
"python"
] | stackoverflow_0005667879_keyword_argument_python.txt |
Q:
I think I have a memory leak in my python script
This is my code:
from xgoogle.search import GoogleSearch, SearchError
import urllib, urllib2, sys, argparse
global stringArr
stringArr = ["string 1",
"string 2",
"string 3",
"string etc"]
def searchIt(url):
try:
... | I think I have a memory leak in my python script | This is my code:
from xgoogle.search import GoogleSearch, SearchError
import urllib, urllib2, sys, argparse
global stringArr
stringArr = ["string 1",
"string 2",
"string 3",
"string etc"]
def searchIt(url):
try:
if(args.verbose>='1'): print "[INFO] Opening URL: "+ur... | [
"I refactored your code a little to make it easier for me to read. I can't see anything here that would leak memory though\nfrom itertools import count\nimport urllib, urllib2, sys, argparse\nfrom xgoogle.search import GoogleSearch, SearchError\n\nstringArr = [\"string 1\",\n \"string 2\",\n ... | [
0,
0
] | [] | [] | [
"memory",
"memory_leaks",
"python"
] | stackoverflow_0003392551_memory_memory_leaks_python.txt |
Q:
Converting string to integer with python
When trying to convert a string into integer to be used as a variable later in the code, I get the following:
print int(urlsuccessful[i])
ValueError: invalid literal for int() with base 10: '2,919,247'
A:
locale.atoi() will "demark" integers based on the current locale s... | Converting string to integer with python | When trying to convert a string into integer to be used as a variable later in the code, I get the following:
print int(urlsuccessful[i])
ValueError: invalid literal for int() with base 10: '2,919,247'
| [
"locale.atoi() will \"demark\" integers based on the current locale setting.\n",
"If only problems are commas, try:\n>>> int(\"2,919,247\".replace(\",\", \"\"))\n2919247\n\n",
"int does not understand commas, you'll want to remove those before trying to convert\n"
] | [
4,
3,
1
] | [
"You can just do\ndef int2str(my_integer):\n return \"%d\" % my_integer\n\n"
] | [
-1
] | [
"python"
] | stackoverflow_0005668043_python.txt |
Q:
Python urllib2 automatic form filling and retrieval of results
I'm looking to be able to query a site for warranty information on a machine that this script would be running on. It should be able to fill out a form if needed ( like in the case of say HP's service site) and would then be able to retrieve the resul... | Python urllib2 automatic form filling and retrieval of results | I'm looking to be able to query a site for warranty information on a machine that this script would be running on. It should be able to fill out a form if needed ( like in the case of say HP's service site) and would then be able to retrieve the resulting web page.
I already have the bits in place to parse the resulti... | [
"If you absolutely need to use urllib2, the basic gist is this:\nimport urllib\nimport urllib2\nurl = 'http://whatever.foo/form.html'\nform_data = {'field1': 'value1', 'field2': 'value2'}\nparams = urllib.urlencode(form_data)\nresponse = urllib2.urlopen(url, params)\ndata = response.read()\n\nIf you send along POST... | [
16,
1,
0
] | [] | [] | [
"automation",
"forms",
"python",
"urllib",
"urllib2"
] | stackoverflow_0005667699_automation_forms_python_urllib_urllib2.txt |
Q:
iTunes COM interface
I would like to be able to control iTunes with python.
I know this is possible and I successfully tested some examples I have seen here at stackoverflow and in other sites, too.
However, I would like to read the documentation about this. I have registered in Mac Dev Center, and when try to acc... | iTunes COM interface | I would like to be able to control iTunes with python.
I know this is possible and I successfully tested some examples I have seen here at stackoverflow and in other sites, too.
However, I would like to read the documentation about this. I have registered in Mac Dev Center, and when try to access the [link] where the d... | [
"Apple has moved things around and failed to update their sites appropriately (trying to download the itunes sdk directly does bounce you back as you've observed), but by faithfully following the instructions found here I've been able to download the zipfile with the SDK and it appears to be intact and usable.\n",
... | [
3,
0
] | [] | [] | [
"com",
"itunes",
"python"
] | stackoverflow_0001331438_com_itunes_python.txt |
Q:
Deleting dicts with near-duplicate values from a list of dicts - Python
I want to clean up a list of dicts, according to the following rules:
1) The list of dicts is already sorted, so the earlier dicts are preferred.
2) In the lower dicts, if the ['name'] and ['code'] string values match with the same key values ... | Deleting dicts with near-duplicate values from a list of dicts - Python | I want to clean up a list of dicts, according to the following rules:
1) The list of dicts is already sorted, so the earlier dicts are preferred.
2) In the lower dicts, if the ['name'] and ['code'] string values match with the same key values of any dict higher up on the list, and if the absolute value of the differenc... | [
"There may be a more pythonic way of doing this but this is the basic pseudocode:\ndef is_duplicate(a,b):\n if a['name'] == b['name'] and a['cost'] == b['cost'] and abs(int(a['cost']-b['cost'])) < 2:\n return True\n return False\n\nnewlist = []\nfor a in oldlist:\n isdupe = False\n for b in newlist:\n if ... | [
3,
3,
0
] | [] | [] | [
"dictionary",
"python",
"sorting"
] | stackoverflow_0005668366_dictionary_python_sorting.txt |
Q:
Enumerating and displaying files in the current directory and selecting by number to search for the file via cmd line
I'm developing a command line tool that searches for certain string (hex, ascii, PAN etc...) data in log files. I have a few lines written that uses a regular expression to filter the search. Ideal... | Enumerating and displaying files in the current directory and selecting by number to search for the file via cmd line | I'm developing a command line tool that searches for certain string (hex, ascii, PAN etc...) data in log files. I have a few lines written that uses a regular expression to filter the search. Ideally, I want to be able to visually see all .txt and .log files in the current directory, have them enumerated, so I can choo... | [
"I can't answer the entire question, but if you're looking to do some sort of interactive shell based operations, the cmd module from the standard library is a good starting point.\n"
] | [
1
] | [] | [] | [
"python"
] | stackoverflow_0005668447_python.txt |
Q:
python using the fibonacci sequence
I am trying to only have the words print out if they occur the same number of times as in the fibonacci sequence. If a words show up 1,2,3,5,8 etc then it will print up. I have gotten the program to print up the words based on how many times the appear. I am having trouble fi... | python using the fibonacci sequence | I am trying to only have the words print out if they occur the same number of times as in the fibonacci sequence. If a words show up 1,2,3,5,8 etc then it will print up. I have gotten the program to print up the words based on how many times the appear. I am having trouble figuring out how to use the sequence in my ... | [
"class FibSet:\n '''Fibonacci sequence with the in operator defined'''\n\n def __init__(self):\n self.a, self.b = 0, 1\n self.fib = set()\n\n def __contains__(self, n):\n if n > self.b:\n self.compute_upto(n)\n return n in self.fib\n\n def compute_upto(self, n):\n ... | [
3,
0,
0
] | [] | [] | [
"python"
] | stackoverflow_0005668969_python.txt |
Q:
Should we avoid repetitive code in C++ in order to be "Pythonic", and how?
I am in larval stage with Python and pre-egg stage in C++, but i am trying to do my best, specially with the "Don't Repeat Yourself" principle.
I have a multichannel raw file-format to open, with a main ascii header with fields representabl... | Should we avoid repetitive code in C++ in order to be "Pythonic", and how? | I am in larval stage with Python and pre-egg stage in C++, but i am trying to do my best, specially with the "Don't Repeat Yourself" principle.
I have a multichannel raw file-format to open, with a main ascii header with fields representable as strings and integers (always coded as chars padded with white spaces). The ... | [
"I'd say there's no such thing as Pythonic C++ code. The DRY principle applies in both languages, but much of what is considered \"Pythonic\" is simply the shortest, sweetest way of expressing logic in Python, using Python-specific constructs. Idiomatic C++ is quite different.\nlambda, for example, is sometimes not... | [
5,
2,
1,
0,
0
] | [] | [] | [
"abstraction",
"c++",
"hardcoded",
"python",
"repeat"
] | stackoverflow_0005669119_abstraction_c++_hardcoded_python_repeat.txt |
Q:
Issues with repeatedly executing .pyc script
I am trying to make an script that will every second read string from a file, and execute it.
executer.pyc:
import os, time
f = open("/root/codename/execute","a")
f.write("")
f.close()
cmd=open('/root/codename/execute', 'r').read()
if not cmd=="":
os.system(cmd)
... | Issues with repeatedly executing .pyc script | I am trying to make an script that will every second read string from a file, and execute it.
executer.pyc:
import os, time
f = open("/root/codename/execute","a")
f.write("")
f.close()
cmd=open('/root/codename/execute', 'r').read()
if not cmd=="":
os.system(cmd)
os.system("rm /root/codename/execute")
time.slee... | [
"It will be much easier to let this script run continuously. Look at How to use a timer to run forever? This will show you how you can repeatedly execute the same command.\n",
"instead of \nos.system(\"python executer.pyc\")\n\nyou can use execfile()\n"
] | [
0,
0
] | [] | [] | [
"python",
"scheduled_tasks"
] | stackoverflow_0005669805_python_scheduled_tasks.txt |
Q:
Use Python's string.replace vs re.sub
For Python 2.5, 2.6, should I be using string.replace or re.sub for basic text replacements?
In PHP, this was explicitly stated but I can't find a similar note for Python.
A:
As long as you can make do with str.replace(), you should use it. It avoids all the pitfalls of reg... | Use Python's string.replace vs re.sub | For Python 2.5, 2.6, should I be using string.replace or re.sub for basic text replacements?
In PHP, this was explicitly stated but I can't find a similar note for Python.
| [
"As long as you can make do with str.replace(), you should use it. It avoids all the pitfalls of regular expressions (like escaping), and is generally faster.\n",
"str.replace() should be used whenever it's possible to. It's more explicit, simpler, and faster.\nIn [1]: import re\n\nIn [2]: text = \"\"\"For pytho... | [
82,
66,
39,
11
] | [] | [] | [
"python",
"regex"
] | stackoverflow_0005668947_python_regex.txt |
Q:
Replace dictionary values
Hey all, I'm trying to work on a simple script that takes a string and replaces each letter in the string. What I've tried doing is creating a dictionary for each values such as
mydict = {"a":"1", "b":"2"}
And I've tried some for loops but so far no luck. The idea I have in my head is f... | Replace dictionary values | Hey all, I'm trying to work on a simple script that takes a string and replaces each letter in the string. What I've tried doing is creating a dictionary for each values such as
mydict = {"a":"1", "b":"2"}
And I've tried some for loops but so far no luck. The idea I have in my head is for each value in the string, re... | [
"If all you are doing is replacing one letter with another, simply use string.maketrans and string.translate.\nHere's a pretty simple example of how to use them\n",
"Sounds like you are trying to do something like this?\nbase = \"foobar\"\nnew = ''\nreplacements = {\n 'o': 1,\n 'b': 'x'\n}\n\nfor c in base:... | [
2,
0
] | [] | [] | [
"dictionary",
"loops",
"python",
"replace",
"string"
] | stackoverflow_0005670637_dictionary_loops_python_replace_string.txt |
Q:
Create a cookie that lasts until the browser is closed(Session Cookie?)
I am familiar with assigning, creating cookies in Python. But I am unsure how to create a cookie that will last until the current browser session is closed(so I have a very rudimentary way of telling when the user is returning to my website).
... | Create a cookie that lasts until the browser is closed(Session Cookie?) | I am familiar with assigning, creating cookies in Python. But I am unsure how to create a cookie that will last until the current browser session is closed(so I have a very rudimentary way of telling when the user is returning to my website).
So which cookie header do I set to make sure the cookie will expire/delete wh... | [
"Just leave out the \"expires\" value altogether, i.e. don't set it to anything. See the Wikipedia entry for details:\n\nSet-Cookie: made_write_conn=1295214458; path=/; domain=.foo.com\n[...]\nThe second cookie made_write_conn does not have expiration date, making it a session cookie. It will be deleted after the ... | [
5,
1
] | [] | [] | [
"browser",
"cookies",
"python"
] | stackoverflow_0005670419_browser_cookies_python.txt |
Q:
using fibonacci sequence to print out words
I am writing a program where it prints out how the frequency of a word as long as the frequency is in the fibonacci sequence (1,2,3,5,8,etc). I have figured out how to print all the words that appear once, however I am having trouble figuring out how to iterate so it pri... | using fibonacci sequence to print out words | I am writing a program where it prints out how the frequency of a word as long as the frequency is in the fibonacci sequence (1,2,3,5,8,etc). I have figured out how to print all the words that appear once, however I am having trouble figuring out how to iterate so it prints out the words that have a higher freqeuncy.
i... | [
"You're overwriting the generator object when you call next. \nCalling fib() returns a generator. To get the next value, you use next(a) which returns the value. Then you assign it to a, which overwrite your generator, so you can't use it anymore. Instead, do something like value = a.next(), and execute that each t... | [
1,
1
] | [] | [] | [
"python"
] | stackoverflow_0005670573_python.txt |
Q:
Linking problem as I am making python module using OpenSSL + SWIG
I have a C file dtls_udp_echo.c in which I use SSL functions. I am trying to create a Python wrapper for this file using SWIG. I've done the following steps:
1) Created an interface file udp.i:
%module udp
%{
/* Put header files here or function ... | Linking problem as I am making python module using OpenSSL + SWIG | I have a C file dtls_udp_echo.c in which I use SSL functions. I am trying to create a Python wrapper for this file using SWIG. I've done the following steps:
1) Created an interface file udp.i:
%module udp
%{
/* Put header files here or function declarations like below */
#define SWIG_FILE_WITH_INIT
#include "dtl... | [
"It can't find the OpenSSL library. Add it to your ld search path; see the ldconfig(8) man page for details.\n"
] | [
0
] | [] | [] | [
"linker",
"openssl",
"python",
"swig"
] | stackoverflow_0005670171_linker_openssl_python_swig.txt |
Q:
How to match a text format to a string without regex in python?
I am reading a file with lines of the form exemplified by
[ 0 ] L= 9 (D) R= 14 (D) p= 0.0347222 e= 10 n= 34
I saw Matlab code to read this file given by
[I,L,Ls,R,Rs,p,e,n] = textread(f1,'[ %u ] L= %u%s R= %u%s p= %n e=%u n=%u')
I want to read this ... | How to match a text format to a string without regex in python? | I am reading a file with lines of the form exemplified by
[ 0 ] L= 9 (D) R= 14 (D) p= 0.0347222 e= 10 n= 34
I saw Matlab code to read this file given by
[I,L,Ls,R,Rs,p,e,n] = textread(f1,'[ %u ] L= %u%s R= %u%s p= %n e=%u n=%u')
I want to read this file in Python. The only thing I know of is regex, and reading even a... | [
"You can make the regexp more readable by building it with escape/replace...\nnumber = \"([-+0-9.DdEe ]+)\"\nunit = r\"\\(([^)]+)\\)\"\nt = \"[X] L=XU R=XU p=X e=X n=X\"\nm = re.compile(re.escape(t).replace(\"X\", number).replace(\"U\", unit))\n\n",
"This looks more or less pythonic to me:\nline = \"[ 0 ] L= 9 (D... | [
4,
2,
1,
1
] | [] | [] | [
"matlab",
"python",
"readfile",
"regex"
] | stackoverflow_0005668904_matlab_python_readfile_regex.txt |
Q:
Help with Excel, Python and XLRD
Relatively new to programming hence why I've chosen to use python to learn.
At the moment I'm attempting to read a list of Usernames, passwords from an Excel Spreadsheet with XLRD and use them to login to something. Then back out and go to the next line. Log in etc and keep going.
... | Help with Excel, Python and XLRD | Relatively new to programming hence why I've chosen to use python to learn.
At the moment I'm attempting to read a list of Usernames, passwords from an Excel Spreadsheet with XLRD and use them to login to something. Then back out and go to the next line. Log in etc and keep going.
Here is a snippit of the code:
import ... | [
"couple of pointers:\ni'd suggest you not print your function with no return value, instead just call it, or return something to print.\ndef readRows():\n for rownum in range(sh1.nrows):\n rows = sh1.row_values(rownum)\n userNm = rows[4]\n Password = rows[5]\n supID = rows[6]\n ... | [
5,
1,
0
] | [] | [] | [
"excel",
"python",
"xlrd"
] | stackoverflow_0005667023_excel_python_xlrd.txt |
Q:
Django: Filter() not returning anything
When I try to use get() it gives me a multiple objects returned error. I tried filter and it returns absolutely nothing. Here is my code:
latest_poll_list = Score.objects.filter(user=user.id)
It doesn't return anything. Hopefully this is just a syntax error; not an error th... | Django: Filter() not returning anything | When I try to use get() it gives me a multiple objects returned error. I tried filter and it returns absolutely nothing. Here is my code:
latest_poll_list = Score.objects.filter(user=user.id)
It doesn't return anything. Hopefully this is just a syntax error; not an error that I have to re-write the program. Thanks in ... | [
"Your get call in the traceback is not equivalent to the filter call in your question:\nlatest_poll_list = Score.objects.get(user=request.user)\n !=\nlatest_poll_list = Score.objects.filter(user=user.id)\n\nIn the first you are passing an object, user as the argument, in the second you're passing the id value (p... | [
4,
2,
0
] | [] | [] | [
"django",
"filter",
"python"
] | stackoverflow_0005670906_django_filter_python.txt |
Q:
What are sqlite development headers and how to install them?
I am trying to install pysqlite and have troubles with that. I found out that the most probable reason of that is missing sqlite headers and I have to install them.
However, I have no ideas what these headers are (where I can find them, what they are doi... | What are sqlite development headers and how to install them? | I am trying to install pysqlite and have troubles with that. I found out that the most probable reason of that is missing sqlite headers and I have to install them.
However, I have no ideas what these headers are (where I can find them, what they are doing and how to install them).
Can anybody, pleas, help me with that... | [
"debian/ubuntu:\n$ apt-get install libsqlite3-dev # or rpm -i sqlite-devel-something.rpm\n\n\nI think a number of interpreters just recompile their small connection libraries on installation, but to do that they need the C .h files in addition to the library to link against. You may already have the library, becaus... | [
19,
7,
0
] | [] | [] | [
"header",
"pysqlite",
"python"
] | stackoverflow_0001462565_header_pysqlite_python.txt |
Q:
Django send_mail "lock already in place. quitting."
I am having an issue with send_mail in Django. It has been working fine until I tried to change some Email settings to have it use an EMAIL_HOST_USER and EMAIL_HOST_PASSWORD. When I did that my test emails where not sent.
I reverted back to my old email settings... | Django send_mail "lock already in place. quitting." | I am having an issue with send_mail in Django. It has been working fine until I tried to change some Email settings to have it use an EMAIL_HOST_USER and EMAIL_HOST_PASSWORD. When I did that my test emails where not sent.
I reverted back to my old email settings that did work and now it is still not sending emails. I ... | [
"most probably there is a \"lock file\" ('send_mail') in your directory - just remove it\n"
] | [
7
] | [] | [] | [
"django",
"filelock",
"mailer",
"python"
] | stackoverflow_0005670612_django_filelock_mailer_python.txt |
Q:
help with huffman code
ok I have my huffman class which seem to be working fine. however when I am trying to make my binary tree I keep on getting an error message saying that ''the global name encoding is not defined'' when the name of my function is encoding. Can someone please tell me why? below is my code. Tha... | help with huffman code | ok I have my huffman class which seem to be working fine. however when I am trying to make my binary tree I keep on getting an error message saying that ''the global name encoding is not defined'' when the name of my function is encoding. Can someone please tell me why? below is my code. Thank you
def get_encoding(self... | [
"It looks like you're trying to make a recursive call to get_encoding, but the signature differs since the definition doesn't take 2 parameters. There may also be a problem with you trying to do self+'0' and self+'1'.\n",
"The name of your function is not encoding, it's get_encoding.\n"
] | [
1,
0
] | [] | [] | [
"python"
] | stackoverflow_0005671136_python.txt |
Q:
Merging cached GQL queries instead of using IN
I'm generating a feed that merges the comments of many users, so your feed might be of comments by user1+user2+user1000 whereas mine might be user1+user2. So I have the line:
some_comments = Comment.gql("WHERE username IN :1",user_list)
I can't just memcache the who... | Merging cached GQL queries instead of using IN | I'm generating a feed that merges the comments of many users, so your feed might be of comments by user1+user2+user1000 whereas mine might be user1+user2. So I have the line:
some_comments = Comment.gql("WHERE username IN :1",user_list)
I can't just memcache the whole thing since everyone will have different feeds, e... | [
"There's nothing built-in to do this, but you can do it yourself, with one caveat: If you do an in query and return 30 results, these will be the 30 records that sort lowest according to your sort criteria across all the subqueries. If you want to assemble the resultset from cached individual queries, though, eithe... | [
2,
1
] | [] | [] | [
"google_app_engine",
"gql",
"python"
] | stackoverflow_0005670397_google_app_engine_gql_python.txt |
Q:
Manager isn't accessible via `Model` instances
I have polymorphic tagging model and I want to create tag_cloud for it,
but when I wanna count related object to tags
tags = TaggedItem.objects.all()
# Calculate tag, min and max counts.
min_count = max_count = tags[0].object.objects.count()
i get:
Manager isn't acc... | Manager isn't accessible via `Model` instances | I have polymorphic tagging model and I want to create tag_cloud for it,
but when I wanna count related object to tags
tags = TaggedItem.objects.all()
# Calculate tag, min and max counts.
min_count = max_count = tags[0].object.objects.count()
i get:
Manager isn't accessible via Artcle instances
tagging.models.py
clas... | [
"Your are trying to access the manager from a model instance which is not possible. More infos:Retrieving objects (specially the Note).\n tags[0].object.objects.count() \\/\n ¨¨¨¨¨¨ /\\\n\nrather you can do this (not tested):\nobject_klass = tags[0].object.__class__\nmin_count = max_coun... | [
5,
4,
4
] | [] | [] | [
"django",
"django_models",
"python"
] | stackoverflow_0005549687_django_django_models_python.txt |
Q:
How does one kill a python script without killing iPython?
I wrote a script in python with a wx.Frame, and it has an exit function that calls sys.exit() when the user has clicked the close button. I'd like to be able to run this script from iPython, but when the user clicks the close button, sys.exit() kills the r... | How does one kill a python script without killing iPython? | I wrote a script in python with a wx.Frame, and it has an exit function that calls sys.exit() when the user has clicked the close button. I'd like to be able to run this script from iPython, but when the user clicks the close button, sys.exit() kills the running python script as well as iPython. What could I use in pla... | [
"I am not familiar with iPython but with a little searching I found a page:\nhttp://ipython.scipy.org/moin/InterupptingThreads, I infer from this that all you might have to do is \"raise SystemExit\".\n"
] | [
1
] | [] | [] | [
"ipython",
"python",
"wxpython"
] | stackoverflow_0005669840_ipython_python_wxpython.txt |
Q:
Python environment management (devel/release)
I have released a package within my workplace; it is used by ~10 people. I have a very quick develop/test/release cycle (sometimes twice a day), and I am starting to suffer from an increased disorder in my environments. I want to manage this environment with tools such... | Python environment management (devel/release) | I have released a package within my workplace; it is used by ~10 people. I have a very quick develop/test/release cycle (sometimes twice a day), and I am starting to suffer from an increased disorder in my environments. I want to manage this environment with tools such as virtualenv and setuptools, but I don't seem to ... | [
"\nI would prefer not to rely on environment variables and file statements (but maybe I should?).\n\nYou should.\nYou should use three things.\n\nEnvironment variables.\nConfiguration files.\nCommand-line parameters.\n\nJust like every other command-line program.\nIf this is am imported module, not a program, then ... | [
2
] | [] | [] | [
"development_environment",
"production_environment",
"python"
] | stackoverflow_0005671739_development_environment_production_environment_python.txt |
Q:
Python Backend Design Patterns
I am now working on a big backend system for a real-time and history tracking web service.
I am highly experienced in Python and intend to use it with sqlalchemy (MySQL) to develop the backend.
I don't have any major experience developing robust and sustainable backend systems and I ... | Python Backend Design Patterns | I am now working on a big backend system for a real-time and history tracking web service.
I am highly experienced in Python and intend to use it with sqlalchemy (MySQL) to develop the backend.
I don't have any major experience developing robust and sustainable backend systems and I was wondering if you guys could poin... | [
"Can you define \"backend\" more precisely? Normally, in web dev, I follow a MVC'ish structure where my \"front-end\", html/css/js and code dealing with displaying either, is loosly coupled with my \"backend\" model (business objects and data persistence; i.e. database).\nI like Django's Model/View/Template approa... | [
1,
0
] | [] | [] | [
"backend",
"python"
] | stackoverflow_0005670639_backend_python.txt |
Q:
Can I append twice the same object to an InstrumentedList in SQLAlchemy?
I have a pretty simple N:M relationship in SqlAlchemy 0.6.6. I have a class "attractLoop" that can contain a bunch of Media (Images or Videos). I need to have a list in which the same Media (let's say image) can be appended twice. The relatio... | Can I append twice the same object to an InstrumentedList in SQLAlchemy? | I have a pretty simple N:M relationship in SqlAlchemy 0.6.6. I have a class "attractLoop" that can contain a bunch of Media (Images or Videos). I need to have a list in which the same Media (let's say image) can be appended twice. The relationship is as follows:
The media is a base class with most of the attributes Ima... | [
"I think what you want is a described in the documentation as \"Extra Fields in Many-to-Many Relationships\". Rather than storing a unique row in the database foreach \"link\", between attractLoop and Media, you would store a single association and specify (as a part of the link object model) how many times it is ... | [
2
] | [] | [] | [
"adjacency_list",
"list",
"multiple_instances",
"python",
"sqlalchemy"
] | stackoverflow_0005656715_adjacency_list_list_multiple_instances_python_sqlalchemy.txt |
Q:
How to export a table to csv or excel format
I need to export a oracle table to a csv/excel file format (along with the column headings). A solution through cx_oracle or through sqlplus welcome.
Python code from the comment:
con = cx.connect()
cur = con.cursor()
printer = cur.execute(sqlcode)
con.commit()
A:... | How to export a table to csv or excel format | I need to export a oracle table to a csv/excel file format (along with the column headings). A solution through cx_oracle or through sqlplus welcome.
Python code from the comment:
con = cx.connect()
cur = con.cursor()
printer = cur.execute(sqlcode)
con.commit()
| [
"perhaps use csv module (from standard library): \nimport csv\ncursor = connection.cursor() # assuming you know how to connect to your oracle db\ncursor.execute('select * from table_you_want_to_turn_to_csv')\nwith open('output_file.csv', 'wb') as fout:\n writer = csv.writer(fout)\n writer.writerow([ i[0] for ... | [
14,
2,
0
] | [] | [] | [
"cx_oracle",
"oracle11g",
"python"
] | stackoverflow_0005669773_cx_oracle_oracle11g_python.txt |
Q:
Task Scheduling Across a Network?
Can you recommend on a python tool / module that allows scheduling tasks on remote machine in a network?
Note that the solution must be able to not only run certain jobs/commands on remote machines, but also verify that jobs etc are still running (for example, consider the case w... | Task Scheduling Across a Network? | Can you recommend on a python tool / module that allows scheduling tasks on remote machine in a network?
Note that the solution must be able to not only run certain jobs/commands on remote machines, but also verify that jobs etc are still running (for example, consider the case where a machine dies after a task has be... | [
"RPyC or Remote Python Call, is a transparent and symmetrical python library for remote procedure calls, clustering and distributed-computing. Here an example from Wikipedia:\nimport rpyc\nconn = rpyc.classic.connect(\"hostname\") # assuming a classic server is running on 'hostname'\n\nprint conn.modules.sys.path... | [
3,
2,
0
] | [] | [] | [
"distributed_computing",
"python",
"scheduled_tasks"
] | stackoverflow_0005671527_distributed_computing_python_scheduled_tasks.txt |
Q:
SQLAlchemy Custom Properties
I've got a table called "Projects" which has a mapped column "project". What I'm wanting to be able to do is to define my own property on my mapped class called "project" that performs some manipulation of the project value before returning it. This will of course create an infinite lo... | SQLAlchemy Custom Properties | I've got a table called "Projects" which has a mapped column "project". What I'm wanting to be able to do is to define my own property on my mapped class called "project" that performs some manipulation of the project value before returning it. This will of course create an infinite loop when I try to reference the row... | [
"Have you check the synonyms feature of Sqlalchemy\nhttp://www.sqlalchemy.org/docs/05/reference/ext/declarative.html#defining-synonyms\nhttp://www.sqlalchemy.org/docs/05/mappers.html#synonyms\n?\nI use this pretty often to provide a proper setter/getter public API for properties\nhaving a pretty complicated underla... | [
2
] | [] | [] | [
"properties",
"python",
"sql",
"sqlalchemy"
] | stackoverflow_0005672377_properties_python_sql_sqlalchemy.txt |
Q:
Django query to find model instances where somefilefield == None?
Given the model:
class Person(models.Model):
name = models.CharField(max_length=200)
resume = models.FileField(upload_to='resumes/', blank=True, null=True)
I have created a few people via:
Person.objects.create(name='Brad')
Person.objects.c... | Django query to find model instances where somefilefield == None? | Given the model:
class Person(models.Model):
name = models.CharField(max_length=200)
resume = models.FileField(upload_to='resumes/', blank=True, null=True)
I have created a few people via:
Person.objects.create(name='Brad')
Person.objects.create(name='Tony')
How do I write a query using the ORM to give me peo... | [
"I'm pretty sure that you filter by empty string ''\nPerson.objects.filter(resume='')\n\nThe underlying field is a CharField() as mentioned by the docs for Filefield.\nDjango stores blanks for CharFields as empty strings not NULL, so filtering for empty strings gets you Persons with no resumes.\nModel Field Refere... | [
1,
0
] | [] | [] | [
"django",
"django_models",
"python"
] | stackoverflow_0005672606_django_django_models_python.txt |
Q:
What versions of Python are in current use, and packages should support?
As a small-time Python package writer (cobs, simplerandom), I'm wondering what Python versions I should support.
I've heard anecdotally that Python 2.5 is still in use on enterprise type servers. So I thought 2.5 was the oldest that needed to... | What versions of Python are in current use, and packages should support? | As a small-time Python package writer (cobs, simplerandom), I'm wondering what Python versions I should support.
I've heard anecdotally that Python 2.5 is still in use on enterprise type servers. So I thought 2.5 was the oldest that needed to be practically supported, here in 2011.
However, I saw this blog in which the... | [
"I think that this is a problem that's simply inherent when developing any software. Anyone could be running any version and would need support for that version (I wonder how many people are still running Windoze ME out there? ;)). Personally, when developing libraries, I'll support only support the current version... | [
5,
2,
1
] | [] | [] | [
"python",
"python_3.x",
"version"
] | stackoverflow_0005671318_python_python_3.x_version.txt |
Q:
Getting Started with LDAP for RDBMS-minded Developer
I have a deep background in MySQL and other relational databases, but essentially zero experience with LDAP. I'd like to ask if there is a good tutorial/getting started site that discusses designing LDAP directories and CRUD operations on LDAP data from languag... | Getting Started with LDAP for RDBMS-minded Developer | I have a deep background in MySQL and other relational databases, but essentially zero experience with LDAP. I'd like to ask if there is a good tutorial/getting started site that discusses designing LDAP directories and CRUD operations on LDAP data from language specific APIs for either Python or PHP? I'm interesting... | [
"Up to date OpenLDAP materials are very hard to come by. Their documentation is very good, but it can be hard to grasp if you're new to LDAP. The best tutorial, or at least the one that had what I was looking for, that I've found so far is LDAP for Rocket Scientists. It's not complete, but it covers a lot pieces th... | [
2,
0,
0
] | [] | [] | [
"ldap",
"php",
"python"
] | stackoverflow_0005662475_ldap_php_python.txt |
Q:
How to create a XML template?
i have 2 Python scripts that write to a same XML file. i'm using Python2.5 and WinXP.
How can I create a template so that the XML file isn't overwritten when I run another Python script. It will only updates the section in the XML with value. For eg:XML template as below:
<Test>
<Def... | How to create a XML template? | i have 2 Python scripts that write to a same XML file. i'm using Python2.5 and WinXP.
How can I create a template so that the XML file isn't overwritten when I run another Python script. It will only updates the section in the XML with value. For eg:XML template as below:
<Test>
<Default>
<Value>1</Value>
<Link... | [
"Read and just update the specific section instead of the whole file, like below\nfrom xml.etree import ElementTree as ET\nwith open(\"test.xml\") as f:\n root = ET.parse( f ).getroot()\n\n# update <Default>\nroot.remove( root.find(\"./Default\") )\n\ndefaultNode = ET.SubElement(root,\"Default\")\nET.SubElement(... | [
1
] | [] | [] | [
"python",
"templates",
"xml"
] | stackoverflow_0005672534_python_templates_xml.txt |
Q:
Matplotlib setting background color and vectorizing FDTD equation
I'm currently having some trouble with Matplotlib. I have an FDTD program that gets 'washed out' as it runs because the background color of the image seems to average. I would like to set it all to black (the 0 values of the array). How would I go a... | Matplotlib setting background color and vectorizing FDTD equation | I'm currently having some trouble with Matplotlib. I have an FDTD program that gets 'washed out' as it runs because the background color of the image seems to average. I would like to set it all to black (the 0 values of the array). How would I go about doing this? I found this on Matplotlib's website, but it doesn't w... | [
"Use this: \nplt.imshow(E[:,:], cmap = 'spectral', vmin=0)\n\nto prevent it from using the lowest value in your array as the lowest value in the colormap. There's also the vmax parameter if you want to keep the same colormap through each step.\n"
] | [
2
] | [] | [] | [
"matplotlib",
"python"
] | stackoverflow_0005673110_matplotlib_python.txt |
Q:
Most elegant way to modify elements of nested lists in place
I have a 2D list that looks like this:
table = [['donkey', '2', '1', '0'], ['goat', '5', '3', '2']]
I want to change the last three elements to integers, but the code below feels very ugly:
for row in table:
for i in range(len(row)-1):
row[i... | Most elegant way to modify elements of nested lists in place | I have a 2D list that looks like this:
table = [['donkey', '2', '1', '0'], ['goat', '5', '3', '2']]
I want to change the last three elements to integers, but the code below feels very ugly:
for row in table:
for i in range(len(row)-1):
row[i+1] = int(row[i+1])
But I'd rather have something that looks like... | [
"for row in table:\n row[1:] = [int(c) for c in row[1:]]\n\nDoes above look more pythonic?\n",
"Try:\n>>> for row in table:\n... row[1:]=map(int,row[1:])\n... \n>>> table\n[['donkey', 2, 1, 0], ['goat', 5, 3, 2]]\n\nAFAIK, assigning to a list slice forces the operation to be done in place instead of creati... | [
20,
13,
8,
3,
1,
0
] | [
"This accomplishes what you are looking for. It is a readable solution. You can go for similar one using listcomp too.\n>>> for row in table:\n... for i, elem in enumerate(row):\n... try:\n... int(elem)\n... except ValueError:\n... pass\n... ... | [
-1
] | [
"nested_lists",
"python"
] | stackoverflow_0005672363_nested_lists_python.txt |
Q:
Is using __add__ in Python on an int a bad idea?
I'm looking to increment a value by one and Python does not have the ++ operator. Consider the following example:
# In a method called calculate(self, basecost, othertaxes=None)
# Returns the value of the tax (self) applied to basecost in relation to previous taxes
... | Is using __add__ in Python on an int a bad idea? | I'm looking to increment a value by one and Python does not have the ++ operator. Consider the following example:
# In a method called calculate(self, basecost, othertaxes=None)
# Returns the value of the tax (self) applied to basecost in relation to previous taxes
i = -1
basecost += sum((tax.calculate(basecost, othert... | [
"Seems to be this:\nbasecost += sum((tax.calculate(basecost, othertaxes[:i]) \n for i,tax in enumerate(othertaxes))\n\n",
"If I'm reading that right:\nfor i,tax in enumerate(othertaxes):\n basecost += tax.calculate(basecost,othertaxes[:i])\n\n",
"In Python, integers are not mutable (nei... | [
9,
3,
1,
0
] | [] | [] | [
"python"
] | stackoverflow_0005672009_python.txt |
Q:
What python library to use for non-blocking audio I/O on OSX?
I would like to read and write audio in Python. I tried PyAudio and audiolab, but both only do blocking audio I/O (i.e. you can't do anything else while they play or record).
Now I would need a library that does non-blocking audio I/O on OSX. Bonus poin... | What python library to use for non-blocking audio I/O on OSX? | I would like to read and write audio in Python. I tried PyAudio and audiolab, but both only do blocking audio I/O (i.e. you can't do anything else while they play or record).
Now I would need a library that does non-blocking audio I/O on OSX. Bonus points for LGPL/BSD license, compatibility with pip and playback of num... | [
"A few days ago, I submitted a patch to pyAudio that enables non blocking audio I/O there.\nAs of Version 0.2.7, the patch is in. Now non-blocking I/O is officially supported by PyAudio.\n",
"Have you taken a look at Pygame? It's a very comprehensive wrapper around the SDL library and it will allow you to queue ... | [
3,
1
] | [] | [] | [
"audio",
"macos",
"numpy",
"pip",
"python"
] | stackoverflow_0005068079_audio_macos_numpy_pip_python.txt |
Q:
What are some of the challenging problems to adapt to map reduce framework?
I have developed around 20 jobs on map reduce including the pagerank algorithm. I never found any challenging problems to adapt to mapreduce framework online. I would like to improve my skills. Is there such a guide?
A:
What you are look... | What are some of the challenging problems to adapt to map reduce framework? | I have developed around 20 jobs on map reduce including the pagerank algorithm. I never found any challenging problems to adapt to mapreduce framework online. I would like to improve my skills. Is there such a guide?
| [
"What you are looking for is Data intensive programming task. Here is a similar question already posted at StackOverflow. I thought of suggesting this project because corpus from wikipedia is easily available, but as you can see it is already in progress.\nRun a squid reverse proxy and collect the logs of those ov... | [
0
] | [] | [] | [
"hadoop",
"java",
"mapreduce",
"python"
] | stackoverflow_0005673196_hadoop_java_mapreduce_python.txt |
Q:
python appengine authorisation or authorization
Having settled on OpenID for authentication, I've been looking at authorisation frameworks for app-engine with the following requirements:
be able to create and edit groups of users
has built in permissions such as add, edit, delete
has sensible defaults, e.g creato... | python appengine authorisation or authorization | Having settled on OpenID for authentication, I've been looking at authorisation frameworks for app-engine with the following requirements:
be able to create and edit groups of users
has built in permissions such as add, edit, delete
has sensible defaults, e.g creator of an object can edit / delete but others can't
kn... | [
"Based on that there are a lot of problems with django ORM and Google app engine datastore, and http://www.tipfy.org/ says that it is made specifically for Google App Engine I must suggest typfy.\n",
"2 pretty good frameworks I tried that have authorisation are GAEFramework and web2py. They are both easier to get... | [
2,
1
] | [] | [] | [
"authorization",
"django",
"google_app_engine",
"python",
"tipfy"
] | stackoverflow_0005664174_authorization_django_google_app_engine_python_tipfy.txt |
Q:
How to use numpy with portaudio to extract bass, mid treble
As in this example How to extract frequency information from an input audio stream (using PortAudio)? I'm curious about portaudio and numpy...
I'm not 100% sure about fft, how can I pass numpy a chunk and get back three values from -1.0 to 1.0 for bass,... | How to use numpy with portaudio to extract bass, mid treble | As in this example How to extract frequency information from an input audio stream (using PortAudio)? I'm curious about portaudio and numpy...
I'm not 100% sure about fft, how can I pass numpy a chunk and get back three values from -1.0 to 1.0 for bass, mid and treble ?
I don't mind if this just for one channel as I ... | [
"The Fourier Transform, mentioned in the selected answer to the SO question you point to, gives you the \"spectrum\" -- a large collection of values giving the sound intensity in each of various ranges/slices of frequencies (expressed, for example, in Hertz).\nHow to translate (say) a thousand intensities (one per ... | [
1,
1
] | [] | [] | [
"audio",
"fft",
"numpy",
"portaudio",
"python"
] | stackoverflow_0001794010_audio_fft_numpy_portaudio_python.txt |
Q:
NameError: global name is not defined
Hello
My error is produced in generating a zip file. Can you inform what I should do?
main.py", line 2289, in get
buf=zipf.read(2048)
NameError: global name 'zipf' is not defined
The complete code is as follows:
def addFile(self,zipstream,url,fname):
# get the conte... | NameError: global name is not defined | Hello
My error is produced in generating a zip file. Can you inform what I should do?
main.py", line 2289, in get
buf=zipf.read(2048)
NameError: global name 'zipf' is not defined
The complete code is as follows:
def addFile(self,zipstream,url,fname):
# get the contents
result = urlfetch.fetch(... | [
"That is probably zipstream and not zipf. So replace that with zipstream and it might work.\n",
"i don't see where you declare zipf?\nzipfile? Senthil Kumaran is probably right with zipstream since you seek(0) on zipstream before the while loop to read chunks of the mystery variable.\nedit:\nAlmost certainly the ... | [
3,
1,
0
] | [] | [] | [
"django",
"google_app_engine",
"kmz",
"python",
"zip"
] | stackoverflow_0005673596_django_google_app_engine_kmz_python_zip.txt |
Q:
Creating teams based on two groups
I'm quite new to Python, and I have a problem that I would like to solve (elegantly). I'm going to create teams for soccer matches this coming season. We have 24 players and would like to put them in two groups, 12 in each, based on skills. For each match, we want to select 8 pla... | Creating teams based on two groups | I'm quite new to Python, and I have a problem that I would like to solve (elegantly). I'm going to create teams for soccer matches this coming season. We have 24 players and would like to put them in two groups, 12 in each, based on skills. For each match, we want to select 8 players, 4 from each group. Ideally, everyo... | [
"Sort by skill, pick from the top for alternating groups. Just like back in high school.\n"
] | [
0
] | [] | [] | [
"python"
] | stackoverflow_0005673705_python.txt |
Q:
Typed input in python?
I need to input 3 integers form stdin and outut their sum. Here's what i do:
(n,l,k) = raw_input().split()
print n + l + k
Of course, i get n,l,k string concatenation, so i change this a little:
(n,l,k) = raw_input().split()
print int(n) + int(l) + int(k)
Now it's ok. But is there any way ... | Typed input in python? | I need to input 3 integers form stdin and outut their sum. Here's what i do:
(n,l,k) = raw_input().split()
print n + l + k
Of course, i get n,l,k string concatenation, so i change this a little:
(n,l,k) = raw_input().split()
print int(n) + int(l) + int(k)
Now it's ok. But is there any way to set data type for the var... | [
"Not really. You need to tell it what you want. There are some more succinct ways to do that in Python.\n(n,l,k) = [int(v) for v in raw_input().split()]\n\nThis is generally true of all user input. It must be validated and converted to what the rest of your program expects.\nOh, well you can use the type objects to... | [
3,
2,
1
] | [] | [] | [
"python"
] | stackoverflow_0005673501_python.txt |
Q:
How to write a web server to handle post (content-type is application/json) in python?
Here comes the detail:
We want to write a web server in Python v2.6.5, and have finished the do_GET method.
But I don't know how to write the do_POST() method.
If the post request goes like the following:
POST /employee/111 HTT... | How to write a web server to handle post (content-type is application/json) in python? | Here comes the detail:
We want to write a web server in Python v2.6.5, and have finished the do_GET method.
But I don't know how to write the do_POST() method.
If the post request goes like the following:
POST /employee/111 HTTP/1.1
Content-Type: application/json
Content-Length: XX
{"name": "John"}
How to get the JS... | [
"Use the cgi.FieldStorage class to to handle the data as a form-data avaiable from the POST..\nAnd when you go the portion which is the body of the POST and which in your case is in json format. \ndef do_POST(self):\n # Parse the form data posted\n form = cgi.FieldStorage(\n fp=self.rfile, \n he... | [
2,
0
] | [] | [] | [
"python",
"webserver"
] | stackoverflow_0005673524_python_webserver.txt |
Q:
How to use valum's file uploader in conjunction with Amazon S3 storage?
I have a file upload form where the file gets uploaded to an S3 bucket at Amazon. I am using https://bitbucket.org/david/django-storages/wiki/Home for that purpose.
Basic file uploading works fine and does it's job but now I would like to int... | How to use valum's file uploader in conjunction with Amazon S3 storage? | I have a file upload form where the file gets uploaded to an S3 bucket at Amazon. I am using https://bitbucket.org/david/django-storages/wiki/Home for that purpose.
Basic file uploading works fine and does it's job but now I would like to integrate an Ajax file uploader into the form and I settled with "valum's file-u... | [
"I made it work by configuring the uploader to use the hidden iframe method. Now it works together nicely with django's backend. However, I am missing some convience features like drag&drop now.\n"
] | [
0
] | [] | [] | [
"amazon_s3",
"django",
"file_upload",
"javascript",
"python"
] | stackoverflow_0005665381_amazon_s3_django_file_upload_javascript_python.txt |
Q:
python smtp gmail authentication error (sending email through gmail smtp server)
I have the following code
import smtplib
from email.mime.text import MIMEText
smtpserver = 'smtp.gmail.com'
AUTHREQUIRED = 1 # if you need to use SMTP AUTH set to 1
smtpuser = 'admin@myhost.com' # for SMTP AUTH, set SMTP username h... | python smtp gmail authentication error (sending email through gmail smtp server) | I have the following code
import smtplib
from email.mime.text import MIMEText
smtpserver = 'smtp.gmail.com'
AUTHREQUIRED = 1 # if you need to use SMTP AUTH set to 1
smtpuser = 'admin@myhost.com' # for SMTP AUTH, set SMTP username here
smtppass = '123456' # for SMTP AUTH, set SMTP password here
RECIPIENTS = ['onl... | [
"Port 587 obviously needs to be open, but it probably is (or you wouldn't have gotten the detailed error msg in question). Python 2.5 vs 2.6 should make no difference. I think the issue has to do with \"solving a captcha\" once on the computer for which logins are currently getting rejected; follow the detailed ins... | [
6,
2
] | [] | [] | [
"gmail",
"python",
"smtp",
"smtplib"
] | stackoverflow_0001384535_gmail_python_smtp_smtplib.txt |
Q:
python - Letter Frequency
Write a Python function called hist() which takes a string as an argument, and creates a visual representation of the frequency of its alphabetic letters by printing each letter in uppercase the number of times it appears in the string, with each letter on a separate line, grouped from mo... | python - Letter Frequency | Write a Python function called hist() which takes a string as an argument, and creates a visual representation of the frequency of its alphabetic letters by printing each letter in uppercase the number of times it appears in the string, with each letter on a separate line, grouped from most to least.
| [
"A MUCH simpler approach is:\nimport string\ndef hist(s):\n d = {}\n for i in s.upper():\n if i.isalpha():\n d[i] = d[i] + 1 if i in d else 1\n for k in sorted(d.keys()):\n print k*d[k]\n\n",
"Your code is similar, you don't need to read the file.\ndef hist(inputstr):\n lowlet... | [
2,
0
] | [] | [] | [
"python"
] | stackoverflow_0005607264_python.txt |
Q:
How to write a Fabric script that uncomments a particular line of a user's .bashrc file?
How would you write a Fabric script that uncomments the line
#force_color_prompt=yes
from the logged-in user's .bashrc file?
Note: This question is specifically about editing this particular line, not about simply appending ... | How to write a Fabric script that uncomments a particular line of a user's .bashrc file? | How would you write a Fabric script that uncomments the line
#force_color_prompt=yes
from the logged-in user's .bashrc file?
Note: This question is specifically about editing this particular line, not about simply appending force_color_prompt=yes to the end of the file and ignoring this line.
| [
"fabric do have api for that. fabric.contrib.files.uncomment\nfrom fabric.contrib.files import uncomment\nuncomment(\"~/.bashrc\", \"^#force_color_prompt=yes\", char='#')\n\n"
] | [
15
] | [] | [] | [
"bash",
"fabric",
"python"
] | stackoverflow_0005673304_bash_fabric_python.txt |
Q:
Managing a Distributed Cluster?
Suppose that one has set up a cassandra cluster. You've got a 10[TB] database that is distributed evenly between 10 nodes, everything runs smoothly etc.
Suppose that you have 100 machines at your disposal, each trying to read (different) data from the cassandra cluster. in addition,... | Managing a Distributed Cluster? | Suppose that one has set up a cassandra cluster. You've got a 10[TB] database that is distributed evenly between 10 nodes, everything runs smoothly etc.
Suppose that you have 100 machines at your disposal, each trying to read (different) data from the cassandra cluster. in addition, you have many jobs that constantly n... | [
"What you need is a Grid/HPC Framework to handle your distributed infrastructure and to run jobs.\nIn unix/linux there are two systems that might of good use for you. Portable Batch Systems (PBS) or Condor \n\nHow do you manage all these\n tasks/jobs? \n\nBoth Condor and PBS have a master need to act as receptor o... | [
3
] | [] | [] | [
"cassandra",
"cluster_computing",
"distributed_computing",
"python"
] | stackoverflow_0005671141_cassandra_cluster_computing_distributed_computing_python.txt |
Q:
python web based game
I was wondering if it is possible to implement a web based game in python. I have searched the internet and cannot seem to find any tutorial or document pointing to this. Any advice will be appreciated..
A:
Your question is a bit vague but from what I understand you are trying to create a w... | python web based game | I was wondering if it is possible to implement a web based game in python. I have searched the internet and cannot seem to find any tutorial or document pointing to this. Any advice will be appreciated..
| [
"Your question is a bit vague but from what I understand you are trying to create a web based game with Python. \nAs python is a serverside language you could implement the website/server with it but for the client and the game itself you will need a browser based client-side technology. Like Flash, Silverlight, WE... | [
2,
0,
0,
0,
0
] | [] | [] | [
"client_side",
"python",
"server_side",
"web"
] | stackoverflow_0005522809_client_side_python_server_side_web.txt |
Q:
Seasonal Adjustment in R or Python
Does anybody know of a routine to do seasonal adjustment in Python or even better, in R? Here is an example data-set (South African CPI), which tends to have spikes in the first few months of the year:
I would like to find the underlying pressures stripping out the seasonal fact... | Seasonal Adjustment in R or Python | Does anybody know of a routine to do seasonal adjustment in Python or even better, in R? Here is an example data-set (South African CPI), which tends to have spikes in the first few months of the year:
I would like to find the underlying pressures stripping out the seasonal factors, but I'd ideally like to use somethi... | [
"Step 1. Define the data.\n(Obtained from http://www.statssa.gov.za/publications/P0141/P0141February2011.pdf)\nCPI <- c(102.3, 103.1, 104.3, 105.7, 106.2, 106.6, 107, 108.2, 108.5, 108.9, \n 108.9, 108.9, 109.2, 109.5, 110.2, 111.1, 111.3, 111.5, 111.5, \n 112.2, 112.3, 112.4, 112.6, 112.8, 113, 113.5... | [
14,
0
] | [] | [] | [
"python",
"r",
"time_series"
] | stackoverflow_0005673658_python_r_time_series.txt |
Q:
Referencing Blobs in GAE the smart way
I'm migrating a site from IIS to GAE and am trying to batch upload a lot of images. Further to that particular challenge, I have one that concerns me more. All of the content for the site (stored in a DB) reference the images as such:
http://myurl.com/images/some-folder/maybe... | Referencing Blobs in GAE the smart way | I'm migrating a site from IIS to GAE and am trying to batch upload a lot of images. Further to that particular challenge, I have one that concerns me more. All of the content for the site (stored in a DB) reference the images as such:
http://myurl.com/images/some-folder/maybe-another-folder/image-name.jpg
I have create... | [
"You should have the upload form specify a complete path to the file as an additional field, and either ignore the upload filename entirely, or append it to the provided path.\nThen, you should create a Datastore model that has a BlobReferenceProperty referencing the blob, with the full path as the key name. That w... | [
2,
1
] | [] | [] | [
"blobstore",
"google_app_engine",
"image",
"python"
] | stackoverflow_0005671901_blobstore_google_app_engine_image_python.txt |
Q:
URL mapping in Python/Django
I just started to learn Django and Python.
I use the online book from djangobook.com
In chapter 3, (http://djangobook.com/en/1.0/chapter03/) I am trying out the sample to add x hours to current time. My files below:
urls.py
from django.conf.urls.defaults import patterns, include, url
f... | URL mapping in Python/Django | I just started to learn Django and Python.
I use the online book from djangobook.com
In chapter 3, (http://djangobook.com/en/1.0/chapter03/) I am trying out the sample to add x hours to current time. My files below:
urls.py
from django.conf.urls.defaults import patterns, include, url
from mysite.views import current_da... | [
"You forget to import hours_ahead in urls.py:\nfrom mysite.views import current_datetime, hours_ahead\n\n"
] | [
5
] | [] | [] | [
"django",
"python"
] | stackoverflow_0005674353_django_python.txt |
Q:
Rewriting Django template {% for %} into a Model method
I have existing code that works:
{% for author in seminar.authors.all %}
{{ author.first_name}} {{ author.last_name }}
{% if forloop.last %}{% else %}, {% endif %}
{% endfor %}
As you may have guessed, seminar.authors is a m2m field. Generic, nothing sp... | Rewriting Django template {% for %} into a Model method | I have existing code that works:
{% for author in seminar.authors.all %}
{{ author.first_name}} {{ author.last_name }}
{% if forloop.last %}{% else %}, {% endif %}
{% endfor %}
As you may have guessed, seminar.authors is a m2m field. Generic, nothing special.
I know how to write Model methods, but im not sure how... | [
"Are you sure your second extra requirement is correct? Surely with just two names you want \"and\" and no comma?\nAnyway, there's nothing particularly difficult about this. The trick is to get the queryset's length first - note that it's actually more efficient to use len rather than .count() here, because count()... | [
1
] | [] | [] | [
"django",
"loops",
"python"
] | stackoverflow_0005674139_django_loops_python.txt |
Q:
Ordering an array for maximal pairwise matches
I have an array:
array([[ 4, 10],
[ 4, 2],
[ 0, 7],
[ 5, 11],
[ 6, 8],
[ 3, 6],
[ 9, 7],
[ 2, 11],
[ 9, 5],
[ 8, 1]])
I want a method by which to order the value pairs so that as many as possible p... | Ordering an array for maximal pairwise matches | I have an array:
array([[ 4, 10],
[ 4, 2],
[ 0, 7],
[ 5, 11],
[ 6, 8],
[ 3, 6],
[ 9, 7],
[ 2, 11],
[ 9, 5],
[ 8, 1]])
I want a method by which to order the value pairs so that as many as possible pairwise 2-element sets have a common value. This is... | [
"You've described a graph where the vertices are numbers, and the edges are your pairs.\nYour conditions specify that each number appears once or twice in the list. This means that connected components in your graph are lines (or cycles). You can find them using this algorithm:\n\n[Line exists] If possible, pick a ... | [
5,
2,
1,
0
] | [] | [] | [
"arrays",
"numpy",
"python"
] | stackoverflow_0004912046_arrays_numpy_python.txt |
Q:
Django: sorl-thumbnail and hosting image files on my own file server
I like very much sorl-thumbnail library and I want to store image files not in current application (django) server, but to (another) my own file server with webserver for serving static files.
Do I have to write custom django storage or not?
Ho... | Django: sorl-thumbnail and hosting image files on my own file server | I like very much sorl-thumbnail library and I want to store image files not in current application (django) server, but to (another) my own file server with webserver for serving static files.
Do I have to write custom django storage or not?
How can I upload files to remote static file server(s)?
What if I have many ... | [
"Hmm, perhaps I am not answering the question you meant to ask (don't know anything about sorl-thumbnail), but my first instinct is to cut django out of the picture. If you have some separate server which can serve the files up statically, then just deploy that server. Sure your django application will generate li... | [
0,
0
] | [] | [] | [
"django",
"file_upload",
"python",
"sorl_thumbnail"
] | stackoverflow_0005674931_django_file_upload_python_sorl_thumbnail.txt |
Q:
Where do I change this Python code snippet to save the temp file in the tmp-folder?
this is a code example implementing a file lock, so the application can only open one instance. It currently works, but saves the the lock file in the Home-folder (Ubuntu). If the application crashes, the lock file does not get rem... | Where do I change this Python code snippet to save the temp file in the tmp-folder? | this is a code example implementing a file lock, so the application can only open one instance. It currently works, but saves the the lock file in the Home-folder (Ubuntu). If the application crashes, the lock file does not get removed which is not good....
I can not easily see where I should change the code to save it... | [
"Use tempfile\n",
"At the end of the script:\nlock = flock('tmp.lock', True).acquire()\n\nThe 'tmp.lock' is the path to the file in the current directory. Change it to the path you need, i.e. 'c:/tmp-folder/tmp.lock'.\nlock = flock('c:/tmp-folder/tmp.lock', True).acquire()\n\nHowever, as @g19fanatic notes: are yo... | [
1,
0
] | [] | [] | [
"lockfile",
"python"
] | stackoverflow_0005675243_lockfile_python.txt |
Q:
Django models - problem importing
I've refactored my models files into a module - this way it's much easier to maintain the code since it has grown quite a bit.
The funny thing is though that it won't work for one of the classes that references another class that references the fist one in it's turn:
UPD: the cycl... | Django models - problem importing | I've refactored my models files into a module - this way it's much easier to maintain the code since it has grown quite a bit.
The funny thing is though that it won't work for one of the classes that references another class that references the fist one in it's turn:
UPD: the cycling references are confusing python and... | [
"To avoid cyclic imports, specify FK model as a string, e.g\ncollection = models.ForeignKey('Collection') # Collection is in the same module\n\nor\ncollection = models.ForeignKey('myapp.Collection') # Collection is in another app\n\n"
] | [
30
] | [] | [] | [
"class",
"django",
"django_models",
"python"
] | stackoverflow_0005675328_class_django_django_models_python.txt |
Q:
using threads in twisted
for example, I want to run two tasks ( using threads ), waiting while this tasks is end and after run next several tasks ( using threads too )
How to do this using twisted ? Any example ?
A:
Actually combing threads and twisted is bad idea. The whole purpose of twisted is to actually mod... | using threads in twisted | for example, I want to run two tasks ( using threads ), waiting while this tasks is end and after run next several tasks ( using threads too )
How to do this using twisted ? Any example ?
| [
"Actually combing threads and twisted is bad idea. The whole purpose of twisted is to actually model your code in such a way that it may run concurrently (without blocking) using it's deffered mechanism.\nHaving said that, if you have a task which cannot escape but will always block, there is a twisted construct av... | [
5
] | [] | [] | [
"python",
"twisted"
] | stackoverflow_0005675388_python_twisted.txt |
Q:
python dict ends empty after iteration
I have problem using dict in python, I just end up with empty dictionary.
looks like I erase the data each itartion
this code suppose to generate a tests that include tests for each site.
thanks in advance
tests={}
for t in Test.objects.all():
for s in Site.objects.all()... | python dict ends empty after iteration | I have problem using dict in python, I just end up with empty dictionary.
looks like I erase the data each itartion
this code suppose to generate a tests that include tests for each site.
thanks in advance
tests={}
for t in Test.objects.all():
for s in Site.objects.all():
site={}
for sv in s.siteve... | [
"Are you sure that you have Test and Site objects, that the Site objects have versions, and that each siteversion's has a value for its version property and that they are all distinct? Try putting in some print statements to debug.\nAlso, this sort of thing:\nsite.update({sv.version:result})\n\nis unnecessarily cl... | [
3,
2,
1
] | [] | [] | [
"dictionary",
"django",
"python"
] | stackoverflow_0005674822_dictionary_django_python.txt |
Q:
How to store count values in python
I want to compare two tables based on their total number of rows. So i use count(*) to count the total number of rows in both table.
My code is:
cur1.execute ("""SELECT COUNT(*) FROM mytable;""")
In order to store the total count return by this query,
I use
row = cur1.fetchone(... | How to store count values in python | I want to compare two tables based on their total number of rows. So i use count(*) to count the total number of rows in both table.
My code is:
cur1.execute ("""SELECT COUNT(*) FROM mytable;""")
In order to store the total count return by this query,
I use
row = cur1.fetchone()
result1 = row[0]
but it didn't hel... | [
"cursor.fetchone() \n\ngives you the result directly..so no need to take its zeroeth element..what you want is given to you directly when you say:\nrow = cur1.fetchone()\n\n"
] | [
1
] | [] | [] | [
"postgresql",
"python"
] | stackoverflow_0005675506_postgresql_python.txt |
Q:
Parsing html content with python and modifying it
I am new to python and i don't know many things.I want to parse an html page,modify it and show it in my own page.I try use beautifulsoup in order to parse html but some errors are generated.I searched on the web but i don't know any specific way to do this.Can any... | Parsing html content with python and modifying it | I am new to python and i don't know many things.I want to parse an html page,modify it and show it in my own page.I try use beautifulsoup in order to parse html but some errors are generated.I searched on the web but i don't know any specific way to do this.Can anyone help me?
| [
"Read the BeautifulSoup documentation - and come back if you have real issues.\n",
"you can see an example here\nBesides two more discussion in this site:How to tell BeautifulSoup to extract the content of a specific tag as text? and Using Beautiful Soup Python module to replace tags with plain text\nBut I think... | [
1,
1
] | [] | [] | [
"beautifulsoup",
"html",
"python"
] | stackoverflow_0005675531_beautifulsoup_html_python.txt |
Q:
Fabric says 'no route to host', even though I can access it over SSH
I'm having some issues uploading a file to a server with Fabric. I get the following output:
Fatal error: Low level socket error connecting to host ssh.example.com: No route to host
Aborting.
The weird thing is, when I connect manually using ss... | Fabric says 'no route to host', even though I can access it over SSH | I'm having some issues uploading a file to a server with Fabric. I get the following output:
Fatal error: Low level socket error connecting to host ssh.example.com: No route to host
Aborting.
The weird thing is, when I connect manually using ssh (same host string, I copy-pasted it from the fabfile to make sure), it w... | [
"I had the same issue. Had not investigated it but using the IP-Address instead the hostname helped. This particular host had an IPv6 AAAA record but my client had no IPv6 connection, maybe this is the reason. HTH\n"
] | [
6
] | [] | [] | [
"fabric",
"python",
"ssh"
] | stackoverflow_0005374982_fabric_python_ssh.txt |
Q:
Selenium error `AssertionError: Lists differ` in tearDown
I am a beginner to Python and my first task is to implement automated test scripts for my app build using PHP and Python. For this I started using Selenium IDE and then import the code in Python and paste it into my editor.
But when I am trying to run that ... | Selenium error `AssertionError: Lists differ` in tearDown | I am a beginner to Python and my first task is to implement automated test scripts for my app build using PHP and Python. For this I started using Selenium IDE and then import the code in Python and paste it into my editor.
But when I am trying to run that script from my editor it's throwing an error :
E
==============... | [
"In your dash.py, you have the following line\nself.assertEqual([], self.verificationErrors) \n\nwhich means, that you check that our verificationErrors is empty.\nIn your run, this list is not empty, it contains two entries :\n\nFalse is not True\nTrue is not False\n\nBasically, this means that your test, whatever... | [
1
] | [] | [] | [
"python",
"selenium_rc"
] | stackoverflow_0005673558_python_selenium_rc.txt |
Q:
Translate a list of multiple words into a list of multiple numbers using a dictionary in Python(2.7.1)
I have a code "aaabbbcccdddeee" that I split up into 3 letter words (such as 'aaa','bbb','ccc' . . . and so on) and assigned a number value to them using d=dict(zip(('aaa','bbb','ccc','ddd','eee'),(123,234,345,45... | Translate a list of multiple words into a list of multiple numbers using a dictionary in Python(2.7.1) | I have a code "aaabbbcccdddeee" that I split up into 3 letter words (such as 'aaa','bbb','ccc' . . . and so on) and assigned a number value to them using d=dict(zip(('aaa','bbb','ccc','ddd','eee'),(123,234,345,456,567)))
If I have a random sequence of 3 letter words
RANDOM="'aaa','bbb','ddd','ccc','eee','ddd','bbb','a... | [
"Iterate.\ny = [d[x] for x in L]\n\n",
"y = map(d.get, RANDOM)\n\nExample:\n>>> d = dict(zip(('aaa','bbb','ccc','ddd','eee'), (123,234,345,456,567)))\n>>> RANDOM = ['aaa','bbb','ddd','ccc','eee','ddd','bbb','aaa','eee','ccc']\n>>> y = map(d.get, RANDOM)\n>>> y\n[123, 234, 456, 345, 567, 456, 234, 123, 567, 345]\n... | [
4,
1,
0
] | [] | [] | [
"dictionary",
"list",
"python",
"translate"
] | stackoverflow_0005656423_dictionary_list_python_translate.txt |
Q:
Taking four items instead of on in a for loop
I have an array of bytes and what I want to do is take four bytes from the array, do something with it and then take the next four bytes. Is it at all possible to do this is a list comprehension or make a for loop take four items from the array instead of one?
A:
def... | Taking four items instead of on in a for loop | I have an array of bytes and what I want to do is take four bytes from the array, do something with it and then take the next four bytes. Is it at all possible to do this is a list comprehension or make a for loop take four items from the array instead of one?
| [
"def clumper(s, count=4):\n for x in range(0, len(s), count):\n yield s[x:x+count]\n\n>>> list(clumper(\"abcdefghijklmnopqrstuvwxyz\"))\n['abcd', 'efgh', 'ijkl', 'mnop', 'qrst', 'uvwx', 'yz']\n>>> list(clumper(\"abcdefghijklmnopqrstuvwxyz\", 5))\n['abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy', 'z']\n\n",
... | [
4,
4,
3,
0
] | [] | [] | [
"python"
] | stackoverflow_0005676302_python.txt |
Q:
What is the best way to define local variables dynamically in a method
When I call a function, I would like to be able to define dynamic variable names in the function, like so...
def build_ports(portlist):
for idx, portname in enumerate(portlist):
chassis, slot, port = portname.split('/')
var... | What is the best way to define local variables dynamically in a method | When I call a function, I would like to be able to define dynamic variable names in the function, like so...
def build_ports(portlist):
for idx, portname in enumerate(portlist):
chassis, slot, port = portname.split('/')
vartxt = "p%i" % idx
locals()[vartxt] = Port() # Class defining a port... | [
"Use lists instead of this insanity called variable variables.\ndef build_ports(portlist)\n ports = []\n for idx, portname in enumerate(portlist):\n ports.append(Port())\n ports[-1].port_method1()\n if idx > 5:\n ports[-1].port_method2()\n\nInstead of using ports[-1], you might... | [
6,
3
] | [
"Check out exec.\nEdit: Yes, I meant exec.\n"
] | [
-1
] | [
"python"
] | stackoverflow_0005676497_python.txt |
Q:
reading and writing date time information in database/Oracle
I queried a SQL table to arrive at the following list L
L= ['S14', 'G7', '1', datetime.datetime(2011, 1, 30, 0, 0), 'R13', 100000]
I want to first change the date format to (yy,mm,dd) which I managed to do by
now=L[3]
new_format=now.date().isoformat()... | reading and writing date time information in database/Oracle | I queried a SQL table to arrive at the following list L
L= ['S14', 'G7', '1', datetime.datetime(2011, 1, 30, 0, 0), 'R13', 100000]
I want to first change the date format to (yy,mm,dd) which I managed to do by
now=L[3]
new_format=now.date().isoformat()
which gave me (2011-01-30)
I need this format of the date to do ... | [
"You can use:\ndatetime.datetime.strptime(mdyDate, 'm/d/y')\n\nto get the string back to datetime.\nBut why don't you use datetime.datetime the whole time? It is perfect for calculations/date comparisons.\n",
"If you want to have Python datetime as 'MM/DD/YYYY' then use strftime(\"%m/%d/%y\"), but Python have gre... | [
1,
0
] | [] | [] | [
"python"
] | stackoverflow_0005676711_python.txt |
Q:
XML POST REST Request using Python
Does anyone have a simple example of sending an XML POST request to a RESTful API with Python? I am trying to use the urllib2 Python library to "create a new project" in the Harvest API, with no luck. The payload variable is a valid XML document that is a near copy/paste of the... | XML POST REST Request using Python | Does anyone have a simple example of sending an XML POST request to a RESTful API with Python? I am trying to use the urllib2 Python library to "create a new project" in the Harvest API, with no luck. The payload variable is a valid XML document that is a near copy/paste of their documentation (under the Create New P... | [
"It's common to return a 200 response even when a 201 response would strictly be more appropriate. Are you sure that the request isn't correctly processed even if you are getting a 'correct' response?\n",
"You're using a local opener everywhere except on the line where you create the response, where you use self.... | [
1,
1
] | [] | [] | [
"harvest",
"post",
"python",
"rest",
"xml"
] | stackoverflow_0001546041_harvest_post_python_rest_xml.txt |
Q:
Statically analyzing a Python module to find assignments
I want to let my users write an __init__.py module like this:
'''
This is the simpack's docstring.
Bla bla bla.
'''
name = 'Name of the simpack'
tags = ['list', 'of', 'simpack-tags']
__version__ = '0.9.3'
And I want my program to be able to get all of t... | Statically analyzing a Python module to find assignments | I want to let my users write an __init__.py module like this:
'''
This is the simpack's docstring.
Bla bla bla.
'''
name = 'Name of the simpack'
tags = ['list', 'of', 'simpack-tags']
__version__ = '0.9.3'
And I want my program to be able to get all of these things: The docstring, the name, the tags and the version... | [
"What you propose smells of difficulty and lack of robustness ... the ast component is likely to introduce version dependencies in your code.\nAlternative: Instead of trying to analyse thepackage/__init__.py[co]?, have the users write a thepackage/userconfig.py. Then you can do import thepackage.userconfig without ... | [
2,
0
] | [] | [] | [
"abstract_syntax_tree",
"code_analysis",
"python"
] | stackoverflow_0005670083_abstract_syntax_tree_code_analysis_python.txt |
Q:
Python is a bit slow. How can I speed up this code?
Python is disappointing me. I searched a code for port scan, found this. Runned it. the program I used for scanning. It was very fast according to python code. the code is below.
Can you help me about accelerating my code. What can i du for it?.
#!/usr/bin/env py... | Python is a bit slow. How can I speed up this code? | Python is disappointing me. I searched a code for port scan, found this. Runned it. the program I used for scanning. It was very fast according to python code. the code is below.
Can you help me about accelerating my code. What can i du for it?.
#!/usr/bin/env python
from socket import *
if __name__ == '__main__'... | [
"You are opening a thousand connections one after another. This has to take at least 1000 times the round trip time to the server. Python has nothing to do with it, this is just a very basic fact of networks.\nWhat you can do to speed this up is opening the connections in parallel, using threading or a event based ... | [
6,
5,
4
] | [] | [] | [
"performance",
"python"
] | stackoverflow_0005677119_performance_python.txt |
Q:
problem with python imports (MySQLdb) and apache python_egg_cache
I have trouble with php calling a python script, or its calling the script but stops somewhere on the way when trying to import MySQLdb
now after adding, to my user .bash_profile, following this guide How do you fix a Trac installation that begins g... | problem with python imports (MySQLdb) and apache python_egg_cache | I have trouble with php calling a python script, or its calling the script but stops somewhere on the way when trying to import MySQLdb
now after adding, to my user .bash_profile, following this guide How do you fix a Trac installation that begins giving errors relating to PYTHON_EGG_CACHE?
export PYTHON_EGG_CACHE /var... | [
"Have a look at trac's bug tracker or this question. You should be able to fix apache's environment in some way (most likely in a distribution/os specific way), or just upgrade trac.\nUpdate: The problem is not specific to Trac/Genshii, it happens with each python application running inside apache and trying to ins... | [
0
] | [] | [] | [
"apache",
"mysql",
"php",
"python",
"python_egg_cache"
] | stackoverflow_0005677512_apache_mysql_php_python_python_egg_cache.txt |
Q:
python how to force subprocess.call to not wait for the called command to complete
Im using subprocess.call to execute a bat file. subprocess.call is waiting for the bat file to complete before it continues. I want it to start the bat then continue on. Looking at the documents for subprocess it didnt look like ... | python how to force subprocess.call to not wait for the called command to complete | Im using subprocess.call to execute a bat file. subprocess.call is waiting for the bat file to complete before it continues. I want it to start the bat then continue on. Looking at the documents for subprocess it didnt look like it had an option to not wait for the command to complete.
Is there a way to do this or a... | [
"subprocess.Popen is what you are looking for!\n"
] | [
9
] | [] | [] | [
"python",
"subprocess"
] | stackoverflow_0005677391_python_subprocess.txt |
Q:
PyQt4 Scatterplot with Clickable and Selectable Points
I'm trying to create a scatterplot with about 1000 data points in a way so that each data point can be selected by clicking on them using a mouse, which will result in bringing up a context menu which will allow the user to remove or change the color of the da... | PyQt4 Scatterplot with Clickable and Selectable Points | I'm trying to create a scatterplot with about 1000 data points in a way so that each data point can be selected by clicking on them using a mouse, which will result in bringing up a context menu which will allow the user to remove or change the color of the data point. I've been following the tutorials for matplotlib,... | [
"Oops I was creating two instances of patches.Circle for each data point. After passing in the first instance to my SelectablePoint class, everything worked fine.\n",
"I was interested to your code but I did get the event with this change in the SelectablePoint.\nIs this better ? Well, it now clicks entire scree... | [
3,
0
] | [] | [] | [
"clickable",
"matplotlib",
"pyqt4",
"python",
"scatter_plot"
] | stackoverflow_0005055972_clickable_matplotlib_pyqt4_python_scatter_plot.txt |
Q:
remove items from queryset for nested regrouping
I've been working on a project that takes into consideration performance as the top priority therefore am trying to use single to queries at each page to collect all the needed information.
Any who, I got to a point where I have one query set that need to be regrou... | remove items from queryset for nested regrouping | I've been working on a project that takes into consideration performance as the top priority therefore am trying to use single to queries at each page to collect all the needed information.
Any who, I got to a point where I have one query set that need to be regrouped based on column (left, right, center) and then aga... | [
"I haven't tested this, but you might try:\n{% regroup dict by col_mapper as column_gr %}\n\n{% for column in column_gr %} \n {{ column.grouper }}<br>\n {# assign the grouper to another variable #}\n {% with column.grouper as grouper %}\n {% regroup grouper by main_title as item_gr %}... | [
1
] | [] | [] | [
"django",
"orm",
"python"
] | stackoverflow_0005676570_django_orm_python.txt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.