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:
django, apache, mod_wsgi and python py-scrypt not working together
I am running a ec2 instance to host some Django websites. The websites are being served by Apache with the use of mod_wsgi
Since a few days I am trying to deploy a new webplatform we are developing but I am running into a problem that seems impossi... | django, apache, mod_wsgi and python py-scrypt not working together | I am running a ec2 instance to host some Django websites. The websites are being served by Apache with the use of mod_wsgi
Since a few days I am trying to deploy a new webplatform we are developing but I am running into a problem that seems impossible for me to solve. For security reasons we use scrypt 0.4 to secure th... | [
"See:\nhttp://code.google.com/p/modwsgi/wiki/FrequentlyAskedQuestions#Apache_Process_Crashes\nThe message 'premature end of script headers' is usually indicative of your code crashing the daemon process. You can verify this by looking for segmentation fault or similar message in main Apache error log file. If you e... | [
0
] | [] | [] | [
"apache",
"django",
"mod_wsgi",
"python",
"scrypt"
] | stackoverflow_0005552095_apache_django_mod_wsgi_python_scrypt.txt |
Q:
problem with soaplib (lxml) with apache2 + mod_wsgi
when I launch my application with apache2+modwsgi
I catch
Exception Type: ImportError
Exception Value: DLL load failed: The specified module could not be found.
in line
from lxml import etree
with Django dev server all works fine
Visual C++ Redistributabl... | problem with soaplib (lxml) with apache2 + mod_wsgi | when I launch my application with apache2+modwsgi
I catch
Exception Type: ImportError
Exception Value: DLL load failed: The specified module could not be found.
in line
from lxml import etree
with Django dev server all works fine
Visual C++ Redistributable 2008 installed
Dependency walker told that msvcrt90.dll... | [
"It is indeed because of 'msvcrt90.dll'. From somewhere in micro patch revisions of Python 2.6 they stopped building in automatic dependencies on the DLL for extension modules and relied on Python executable doing it. When embedded in other systems however you are then dependent on that executable linking to DLL an... | [
2
] | [] | [] | [
"apache2",
"cx_oracle",
"lxml",
"mingw",
"python"
] | stackoverflow_0005552162_apache2_cx_oracle_lxml_mingw_python.txt |
Q:
Python BeautifulSoup Automatically tracking content table rows andcolumns
First let me say that I am new to Stack and to Python. I just started working with it last week. I am however a seasoned PHP/C++/Pascal/ADA/B/Forth (showing my age) programmer.
I have written a script that pulls product pages from a website... | Python BeautifulSoup Automatically tracking content table rows andcolumns | First let me say that I am new to Stack and to Python. I just started working with it last week. I am however a seasoned PHP/C++/Pascal/ADA/B/Forth (showing my age) programmer.
I have written a script that pulls product pages from a website and stores them in my local MySQL database. I did this so that I can crawl the... | [
"Here's how I'd tackle it:\nfrom BeautifulSoup import BeautifulSoup\n\ndoc = '''<div>\n <table>\n <tr><td> </td><td><b>Item</b></td><td> </td><td><b>Description</b></td><td> </td><td><b>Part No.</b></td><td> </td><td><b>Color</b></td><td> </td></tr>\n <tr><td> </td><td>&nbs... | [
0,
0
] | [] | [] | [
"beautifulsoup",
"html_parsing",
"python",
"web_crawler"
] | stackoverflow_0005556005_beautifulsoup_html_parsing_python_web_crawler.txt |
Q:
Serial Key Generation and Validation
I'm toying around with writing creating a serial code generator/validator, but I can't seem to get how to do a proper check.
Here's my generator code:
# Serial generator
# Create sequences from which random.choice can choose
Sequence_A = 'ABCDEF'
Sequence_B = 'UVWQYZ'
Sequence... | Serial Key Generation and Validation | I'm toying around with writing creating a serial code generator/validator, but I can't seem to get how to do a proper check.
Here's my generator code:
# Serial generator
# Create sequences from which random.choice can choose
Sequence_A = 'ABCDEF'
Sequence_B = 'UVWQYZ'
Sequence_C = 'NOPQRS'
Sequence_D = 'MARTIN'
impor... | [
"The expression `range(1, 5)' creates a list of numbers from 1 to 4. So in your first test, you're asking whether the first character in your serial number is equal to that list:\n\"1\" == [1, 2, 3, 4]\n\nProbably not...\nWhat you probably want to know is whether a digit is in the range (i.e. from 1 to 5, I assume,... | [
1,
0
] | [] | [] | [
"python"
] | stackoverflow_0005559964_python.txt |
Q:
PyQt4.QtWebKit + Background Transparency
If you have a compositing window manager, this will give you a transparent window:
import PyQt4.QtGui
a = PyQt4.QtGui.QApplication([])
import PyQt4.QtCore
import PyQt4.QtWebKit
w = PyQt4.QtWebKit.QWebView()
w.setAttribute(PyQt4.QtCore.Qt.WA_TranslucentBackground)
w.show()
a... | PyQt4.QtWebKit + Background Transparency | If you have a compositing window manager, this will give you a transparent window:
import PyQt4.QtGui
a = PyQt4.QtGui.QApplication([])
import PyQt4.QtCore
import PyQt4.QtWebKit
w = PyQt4.QtWebKit.QWebView()
w.setAttribute(PyQt4.QtCore.Qt.WA_TranslucentBackground)
w.show()
a.exec_()
But this will not have a transparent... | [
"The problem here is lazy instantiation. Initially, the WebKit view is not instantiated, and so you get a transparent background. As soon as you access w.page(), the WebKit view is actually instantiated, and so the default white background appears. I am not aware of any way of getting transparency then from inside ... | [
0,
0
] | [] | [] | [
"pyqt4",
"python",
"transparency"
] | stackoverflow_0005559524_pyqt4_python_transparency.txt |
Q:
Get sorted combinations
I have a input like
A = [2,0,1,3,2,2,0,1,1,2,0].
Following I remove all the duplicates by
A = list(Set(A))
A is now [0,1,2,3]. Now I want all the pair combinations that I can make with this list, however they do not need to be unique... thus [0,3] equals [3,0] and [2,3] equals [3,2]. In... | Get sorted combinations | I have a input like
A = [2,0,1,3,2,2,0,1,1,2,0].
Following I remove all the duplicates by
A = list(Set(A))
A is now [0,1,2,3]. Now I want all the pair combinations that I can make with this list, however they do not need to be unique... thus [0,3] equals [3,0] and [2,3] equals [3,2]. In this example it should retur... | [
">>> A = [2,0,1,3,2,2,0,1,1,2,0]\n>>> A = sorted(set(A)) # list(set(A)) is not usually in order\n>>> from itertools import combinations\n>>> list(combinations(A, 2))\n[(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)]\n\n>>> map(list, combinations(A, 2))\n[[0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3]]\n\n\n>>> he... | [
13
] | [] | [] | [
"combinations",
"python"
] | stackoverflow_0005560479_combinations_python.txt |
Q:
NoSql solution to store 20[TB] of data, as vector/array?
I need to build a system to efficiently store & maintain a huge amount (20 [TB]) of data (and be able to access it in 'vector' form). Here are my dimensions:
(1) time (given as an integer of the form YYYYMMDDHHMMSS)
(2) field (a string of any given length, ... | NoSql solution to store 20[TB] of data, as vector/array? | I need to build a system to efficiently store & maintain a huge amount (20 [TB]) of data (and be able to access it in 'vector' form). Here are my dimensions:
(1) time (given as an integer of the form YYYYMMDDHHMMSS)
(2) field (a string of any given length, representing a name of a hospital)
(3) instrumentID (an intege... | [
"MongoDB scales awesomely and supports many of the indexing features you'd typically find in an RDBMS such as compound key indexes. You can use a compound index on the name and time attributes in your data. Then you can retrieve all instrument readings with a particular name and date range.\n[Now in the simple case... | [
3
] | [] | [] | [
"nosql",
"python"
] | stackoverflow_0005560394_nosql_python.txt |
Q:
Insert image to Picasa in Python Google App Engine Sdk through urlfetch
I try to insert an image from a Flex application to picasa web through Google App Engine Sdk. I want to do a simple urlfetch instead of the python client library. The code i following:
def Insert(self, sessionToken, album_or_uri, title, f... | Insert image to Picasa in Python Google App Engine Sdk through urlfetch | I try to insert an image from a Flex application to picasa web through Google App Engine Sdk. I want to do a simple urlfetch instead of the python client library. The code i following:
def Insert(self, sessionToken, album_or_uri, title, filename_or_handle):
result = urlfetch.fetch(url=album_or_uri,
... | [
"Payload should be a string, not a file-like object. How it should be encoded depends on the API you're calling - see the docs for the API to determine that, and any other headers etc you need to set. It's unlikely you need to base64 encode it - just pass the contents of the image in directly.\nIf you're still havi... | [
2
] | [] | [] | [
"google_app_engine",
"http",
"picasa",
"python",
"urlfetch"
] | stackoverflow_0005555323_google_app_engine_http_picasa_python_urlfetch.txt |
Q:
numpy arrays: filling and extracting data quickly
See important clarification at bottom of this question.
I am using numpy to speed up some processing of longitude/latitude coordinates. Unfortunately, my numpy "optimizations" made my code run about 5x more slowly than it ran without using numpy.
The bottleneck see... | numpy arrays: filling and extracting data quickly | See important clarification at bottom of this question.
I am using numpy to speed up some processing of longitude/latitude coordinates. Unfortunately, my numpy "optimizations" made my code run about 5x more slowly than it ran without using numpy.
The bottleneck seems to be in filling the numpy array with my data, and t... | [
"You describe your data as being \"lists of lists of lists of coordinates\". From this I'm guessing your extraction looks like this:\nfor x in points:\n for y in x:\n for Z in y:\n # z is a tuple with GPS coordinates\n\nDo this:\n# initially, points is a list of lists of lists\npoints = itertools.... | [
5,
2,
2
] | [] | [] | [
"arrays",
"loading",
"numpy",
"performance",
"python"
] | stackoverflow_0005559888_arrays_loading_numpy_performance_python.txt |
Q:
Setting parameter names and defaults in method created at runtime
I need to give an automatically constructed method positional and default parameters. If I didn't care about the parameter names or defaults I would have the method take *args and **kwargs. Here's an example of what I'm trying to do (note that
def ... | Setting parameter names and defaults in method created at runtime | I need to give an automatically constructed method positional and default parameters. If I didn't care about the parameter names or defaults I would have the method take *args and **kwargs. Here's an example of what I'm trying to do (note that
def make_method(params):
# Create method that's parameters are defined ... | [
"This is a HACK! Also I am not sure I understand how to generate kwargs based on what you asked. But this is a start. Although, I am not sure if it's a good start :)\ndef make_method(params):\n def impl(*args, **kwargs):\n # do stuff with args & kwargs\n print \"I was called with {args} and {kwargs... | [
1
] | [] | [] | [
"python"
] | stackoverflow_0005560051_python.txt |
Q:
What does Ruby have that Python doesn't, and vice versa?
There is a lot of discussions of Python vs Ruby, and I all find them completely unhelpful, because they all turn around why feature X sucks in language Y, or that claim language Y doesn't have X, although in fact it does. I also know exactly why I prefer Pyt... | What does Ruby have that Python doesn't, and vice versa? | There is a lot of discussions of Python vs Ruby, and I all find them completely unhelpful, because they all turn around why feature X sucks in language Y, or that claim language Y doesn't have X, although in fact it does. I also know exactly why I prefer Python, but that's also subjective, and wouldn't help anybody cho... | [
"Ruby has the concepts of blocks, which are essentially syntactic sugar around a section of code; they are a way to create closures and pass them to another method which may or may not use the block. A block can be invoked later on through a yield statement.\nFor example, a simple definition of an each method on Ar... | [
34,
28,
26,
18,
18,
16,
12,
12,
12,
11,
11,
11,
11,
9,
8,
7,
6,
6,
5,
5,
5,
5,
5,
4,
3,
3,
3,
2,
2,
2,
1,
0,
0
] | [
"I am surprised that no one has mentioned Singleton methods.\na=[]\nb=[]\ndef b.some_method do ... end\nb.some_method #fine\na.some_method #raises exception\n\nIt gives granular control over the open class concept. You can also use Eigenclasses to mixin a module into a specific object instead of all objects of a gi... | [
-2,
-3,
-4
] | [
"python",
"ruby"
] | stackoverflow_0001113611_python_ruby.txt |
Q:
Providing arguments to transactions in Datastore Plus (NDB)
I'm having trouble working out how to pass in arguments into transactions when using Datastore Plus.
Could someone please rewrite this regular-datastore example code?
from google.appengine.ext import db
class Accumulator(db.Model):
counter = db.Integ... | Providing arguments to transactions in Datastore Plus (NDB) | I'm having trouble working out how to pass in arguments into transactions when using Datastore Plus.
Could someone please rewrite this regular-datastore example code?
from google.appengine.ext import db
class Accumulator(db.Model):
counter = db.IntegerProperty()
def increment_counter(key, amount):
obj = db.ge... | [
"Assuming you can follow the example from the docs, the answer is to use a lambda (or a named helper function). E.g.\nyield context.transaction(lambda: increment_counter(acc.key(), 5))\n\n"
] | [
6
] | [] | [] | [
"google_app_engine",
"google_cloud_datastore",
"python",
"transactions"
] | stackoverflow_0005559448_google_app_engine_google_cloud_datastore_python_transactions.txt |
Q:
python calendar.HTMLCalendar
I think I want to use pythons built in calendar module to create an HTML calendar with data. I say I think because I'll probably think of a better way, but right now it's a little personal. I don't know if this was intended to be used this way but it seems like it is a little pointle... | python calendar.HTMLCalendar | I think I want to use pythons built in calendar module to create an HTML calendar with data. I say I think because I'll probably think of a better way, but right now it's a little personal. I don't know if this was intended to be used this way but it seems like it is a little pointless if you can't at least making th... | [
"Create a new class inheriting from HTMLCalendar.\nOverride the formatday method.\nWhoever makes comments like \"this library is useless\" obviously doesn't understand Python.\nclass EmployeeScheduleCalendar(HTMLCalendar):\n def formatday(self, day, weekday):\n \"\"\"\n Return a day as a table ce... | [
45,
16,
4,
0,
0
] | [] | [] | [
"calendar",
"html",
"python"
] | stackoverflow_0001101524_calendar_html_python.txt |
Q:
Using get or insert functionality on one to many django models and modelforms
A] Summary:
Using get or insert functionality on one to many django models, checking whether a record or relationship exists prior to adding a new one.
B] Details:
1] I have the following django model structure country (one) to City (man... | Using get or insert functionality on one to many django models and modelforms | A] Summary:
Using get or insert functionality on one to many django models, checking whether a record or relationship exists prior to adding a new one.
B] Details:
1] I have the following django model structure country (one) to City (many)
2] I am using ModelForm for displaying the form on the html page. The forms are ... | [
"Use get_or_create (the equivalent to your get_or_insert):\ncountry, country_is_new = UserReportedCountry.objects.get_or_create(country_name=my_country_name)\ncity, city_is_new = UserReportedCity.objects.get_or_create(country=country, city_name=my_city_name)\n\n"
] | [
0
] | [] | [] | [
"django_forms",
"django_models",
"google_app_engine",
"python"
] | stackoverflow_0005560749_django_forms_django_models_google_app_engine_python.txt |
Q:
Installing PyLucene 3.0.3 on Ubuntu 10.04
I'm attempting to install PyLucene 3.0.3 on Ubuntu 10.04. This has proven considerably challenging, but so far I've:
Patched setuptools to allow building of JCC, as instructed in the PyLucene docs.
Built JCC via: cd pylucene-3.0.3-1/jcc; python setup.py build
Built Lucene... | Installing PyLucene 3.0.3 on Ubuntu 10.04 | I'm attempting to install PyLucene 3.0.3 on Ubuntu 10.04. This has proven considerably challenging, but so far I've:
Patched setuptools to allow building of JCC, as instructed in the PyLucene docs.
Built JCC via: cd pylucene-3.0.3-1/jcc; python setup.py build
Built Lucene 3.0.3 via ant, and installed the jar to /usr/s... | [
"I did this before (but without installing Lucene's default package in Ubuntu). I don't know what exactly is Error 127, but in my case it helped to set NUM_FILES=200 from the original NUM_FILES=2 in my Makefile. For some reason when NUM_FILES=2 it creates really huge files in memory which ubuntu will not handle. Wi... | [
3
] | [] | [] | [
"java",
"lucene",
"makefile",
"pylucene",
"python"
] | stackoverflow_0005560648_java_lucene_makefile_pylucene_python.txt |
Q:
I am unable to find a reg-exp to find the items (marked below in bold italics) in a txt file
------------------------------------------------------------------------------------- Suds ( https://fedorahosted.org/suds/ ) version: 0.3.9 (beta) build: R658-20100210
Service ( ndfdXML ) tns="http://www.weather.gov/fo... | I am unable to find a reg-exp to find the items (marked below in bold italics) in a txt file | ------------------------------------------------------------------------------------- Suds ( https://fedorahosted.org/suds/ ) version: 0.3.9 (beta) build: R658-20100210
Service ( ndfdXML ) tns="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl" Prefixes (2)
ns0 = "http://schemas.xmlsoap.org/soap/e... | [
"Do you want a regex that finds all of them, or one for each? What data do you need back (I assume the contents of the () and object name)?\nGuessing from what you have, I assume something like this could work:\n((CornerPoints|LatLonListZipCode|other|names)\\(.*\\)))\n\nThat will match one of the names in the first... | [
0,
0,
0
] | [] | [] | [
"file",
"python",
"regex",
"text_files"
] | stackoverflow_0005560809_file_python_regex_text_files.txt |
Q:
How to read text from a Tkinter Text Widget
from Tkinter import *
window = Tk()
frame=Frame(window)
frame.pack()
text_area = Text(frame)
text_area.pack()
text1 = text_area.get('0.0',END)
def cipher(data):
As,Ts,Cs,Gs, = 0,0,0,0
for x in data:
if 'A' == x:
As+=1
elif x == 'T'... | How to read text from a Tkinter Text Widget | from Tkinter import *
window = Tk()
frame=Frame(window)
frame.pack()
text_area = Text(frame)
text_area.pack()
text1 = text_area.get('0.0',END)
def cipher(data):
As,Ts,Cs,Gs, = 0,0,0,0
for x in data:
if 'A' == x:
As+=1
elif x == 'T':
Ts+=1
elif x =='C':
... | [
"I think you misunderstand some concepts of Python an Tkinter.\nWhen you create the Button, command should be a reference to a function, i.e. the function name without the (). Actually, you call the cipher function once, at the creation of the button. You cannot pass arguments to that function. You need to use glob... | [
12
] | [] | [] | [
"python",
"tkinter"
] | stackoverflow_0005560828_python_tkinter.txt |
Q:
Why is Django Displaying Escaped Strings for Photo URLs?
For some reason, Django seems to be displaying my ImageField URL strings escaped. See below (ImageWithThumbsFieldFile uses an ImageField behind the scenes, and I tested it with a normal ImageField as well and the problem still existed.)
>>> from … import Use... | Why is Django Displaying Escaped Strings for Photo URLs? | For some reason, Django seems to be displaying my ImageField URL strings escaped. See below (ImageWithThumbsFieldFile uses an ImageField behind the scenes, and I tested it with a normal ImageField as well and the problem still existed.)
>>> from … import UserProfile
>>> u = UserProfile.objects.get(pk=1)
>>> u
<UserProf... | [
"As far as I can tell, this is due to Amazon S3 not having folders. For some reason the django-storages app outputs the urls this way. I thought it was wrong, but the images are working. Just pretty weird to see the urls like that.\n"
] | [
0
] | [] | [] | [
"django",
"mysql",
"python"
] | stackoverflow_0005527182_django_mysql_python.txt |
Q:
What is the most Pythonic way to pass objects between imported libraries of code?
I have a program which imports two modules, one we will call operations (which is just a series of functions) and the other we call tracking (which is a class). The program tracking module monitors a series of messages, has some err... | What is the most Pythonic way to pass objects between imported libraries of code? | I have a program which imports two modules, one we will call operations (which is just a series of functions) and the other we call tracking (which is a class). The program tracking module monitors a series of messages, has some error state flags, and so forth. The program sorts information in tracking by severity an... | [
"There are a lot of ways you could refactor this, but one place you might start is to add a track() function to your operations module. Have it do nothing by default.\n def track(message): # use the right signature though!\n pass\n\nIn your operations module you would then call your track() function anywhere y... | [
4,
3,
3
] | [] | [] | [
"python"
] | stackoverflow_0005557035_python.txt |
Q:
Including many-to-many from another model in field in django admin interface
Greetings,
I'm sure there is a simple solution to what I'm trying to do but unfortunately I wasn't able to find it in the documentation.
I have the following model (simplified version shown):
models.py:
class Student(models.Model):
stud... | Including many-to-many from another model in field in django admin interface | Greetings,
I'm sure there is a simple solution to what I'm trying to do but unfortunately I wasn't able to find it in the documentation.
I have the following model (simplified version shown):
models.py:
class Student(models.Model):
student_id = models.IntegerField(primary_key=True, unique=True,
db_index=True, m... | [
"You can use the inlines in your related model, or this blog post might be of some help.\n"
] | [
1
] | [] | [] | [
"django",
"foreign_keys",
"many_to_many",
"python"
] | stackoverflow_0005561111_django_foreign_keys_many_to_many_python.txt |
Q:
convert string to pre defined python variable
I wanted to know How can I convert string to python defined variables.
Basically I want to do this.
if value1 operator value2:
print True
my operator is a string '==' , '>', '<', '!='
so that it becomes
if value1 == value2:
print True
I tried operato... | convert string to pre defined python variable | I wanted to know How can I convert string to python defined variables.
Basically I want to do this.
if value1 operator value2:
print True
my operator is a string '==' , '>', '<', '!='
so that it becomes
if value1 == value2:
print True
I tried operator = getattr(sys.modules[__name__], operator ) but i... | [
"Using the operator module:\nimport operator\n\ndef op(str, value1, value2):\n lookup = {'==': operator.eq, '>': operator.gt,\n '<': operator.lt, '!=': operator.ne}\n if str in lookup:\n return lookup[str](value1, value2)\n\n return False\n\nv1 = 1\nv2 = 2\nprint op(\"!=\", v1, v2)\n# T... | [
1,
0,
0,
0
] | [] | [] | [
"python"
] | stackoverflow_0005561494_python.txt |
Q:
Syntax Error in django
What's causing the syntax error in this urls.py ?
It says
syntax error at Line 27[(r'^xd_receiver\.html$',.....] in ursl.py.
I can't figure out where the problem is.
urlpatterns = patterns('',
# Example:
# (r'^universityDB/', include('universityDB.foo.urls')),
# ... | Syntax Error in django | What's causing the syntax error in this urls.py ?
It says
syntax error at Line 27[(r'^xd_receiver\.html$',.....] in ursl.py.
I can't figure out where the problem is.
urlpatterns = patterns('',
# Example:
# (r'^universityDB/', include('universityDB.foo.urls')),
# Uncomment the admin/doc line... | [
"If you want to name your URLs, you must use the url(...) function, i.e.\nurl(r'^xd_receiver\\.html$', direct_to_template, {'template': 'xd_receiver.html'}, name='xd_receiver')\n\n…rather than:\n(r'^xd_receiver\\.html$', direct_to_template, {'template': 'xd_receiver.html'}, name='xd_receiver')\n\n"
] | [
5
] | [] | [] | [
"django",
"django_models",
"django_templates",
"django_urls",
"python"
] | stackoverflow_0005561630_django_django_models_django_templates_django_urls_python.txt |
Q:
Why does it say Global Name not Defined when it is? Python
I am scripting a very simple guess the animal game where the player does the guessing. I have taken a long time to imput all the information and I know that it is very long-winded and could probably be done in much shorter ways but I am a beginner. The thi... | Why does it say Global Name not Defined when it is? Python | I am scripting a very simple guess the animal game where the player does the guessing. I have taken a long time to imput all the information and I know that it is very long-winded and could probably be done in much shorter ways but I am a beginner. The thing is, part of it is not working. I will put the code in and hig... | [
"When you define those variables, you're setting them within those functions. They're not actually global variables at all. Your main choices are to \n\nconfigure them as global variables,\ncreate \"state\" objects to pass around (like setting data['habitat'] = 'tree' and returning that from the animalchoice functi... | [
3,
2,
1,
0
] | [] | [] | [
"if_statement",
"python",
"syntax_error"
] | stackoverflow_0005544829_if_statement_python_syntax_error.txt |
Q:
simple python chat server by rooms
I am trying to write a simple chat server which sends commands from ajax to fsockopen to the daemon. The daemon if command is listen will hold the request in a array with what room it has assigned. Then when an command comes in as msg it sends that message out to everyone who is ... | simple python chat server by rooms | I am trying to write a simple chat server which sends commands from ajax to fsockopen to the daemon. The daemon if command is listen will hold the request in a array with what room it has assigned. Then when an command comes in as msg it sends that message out to everyone who is in the listening array list for that roo... | [
"The App Engine Channel API probably does what you want: http://code.google.com/appengine/docs/python/channel/overview.html\n\"Comet\" is the more general term to search for if you don't want to run on App Engine. Basically you need some kind of server-side push, which (until websockets is finally ready) must be fa... | [
1
] | [] | [] | [
"ajax",
"chat",
"comet",
"php",
"python"
] | stackoverflow_0005560905_ajax_chat_comet_php_python.txt |
Q:
Values of instance variables of superclass persist across instances of subclass
I'm not sure if this is a fundamental misunderstanding on my part of the way that OOP in Python works, but I'm seeing some extremely strange behavior. Here's a code snippet:
class Foo(object):
def __init__(self, l = []):
pr... | Values of instance variables of superclass persist across instances of subclass | I'm not sure if this is a fundamental misunderstanding on my part of the way that OOP in Python works, but I'm seeing some extremely strange behavior. Here's a code snippet:
class Foo(object):
def __init__(self, l = []):
print "Foo1:", l
self.mylist = l
print "Foo2:", self.mylist
class Bar(... | [
"The problem is that default parameters are bound at module initialization time, not at function invocation time, so there is only one default list that gets shared as the default for all invocations of that function.\nWhat you really want to do is:\ndef __init__(self, l=None):\n if l is None:\n l = []\n ... | [
7,
4
] | [] | [] | [
"oop",
"python"
] | stackoverflow_0005561294_oop_python.txt |
Q:
How do I program a pendulum effect in Python?
I'm working on making a game in Python (teaching myself Python in the process) and I'm trying to add a pendulum function, but I've never programmed a pendulum function before or even seen code that successfully creates a pendulum. So I'm hoping you guys can help me out... | How do I program a pendulum effect in Python? | I'm working on making a game in Python (teaching myself Python in the process) and I'm trying to add a pendulum function, but I've never programmed a pendulum function before or even seen code that successfully creates a pendulum. So I'm hoping you guys can help me out here. How exactly do I create a pendulum function ... | [
"I suppose you need an algorithm (since you say that you want to create a pendulum function). After searching a little bit, i found something that may work for you :\n#!/usr/bin/env python\n\ndef pendulum(T, n, theta0, v0, alpha):\n \"\"\"Return the motion (theta, v, t) of a pendulum.\"\"\"\n dt = T/float(n)\... | [
2
] | [] | [] | [
"pygame",
"python"
] | stackoverflow_0005561732_pygame_python.txt |
Q:
TemplateSyntaxError in Django app
Hi i was trying to implement facebook login for my django app using django-facebook connect using Ajax. I was following this link for implementing it facebook-django integration with ajax. On doing so i am hit with this error " TemplateSyntaxError at /registrationForm/
'facebookco... | TemplateSyntaxError in Django app | Hi i was trying to implement facebook login for my django app using django-facebook connect using Ajax. I was following this link for implementing it facebook-django integration with ajax. On doing so i am hit with this error " TemplateSyntaxError at /registrationForm/
'facebookconnect' is not a valid tag library: Temp... | [
"Your facebookConnect.py file must be within your templatetags package (it must have an __init__.py to make it a package).\nIt also appears that in your settings.INSTALLED_APPS setting, you've added facebookconnect, even though that isn't an app (going by your directory structure). Instead, you should have universi... | [
1
] | [] | [] | [
"django",
"django_models",
"django_templates",
"facebook",
"python"
] | stackoverflow_0005562159_django_django_models_django_templates_facebook_python.txt |
Q:
Proc_open() c++/python
I'm trying to make a call for a c++ / python file with proc_open (bi-directional support needed).
After doing some on-line research I found created this code: (I first tried it with c++, after failure I tried python as well)
PHP:
<?php
$descriptorspec = array(
0 => array("pipe", "r"),
... | Proc_open() c++/python | I'm trying to make a call for a c++ / python file with proc_open (bi-directional support needed).
After doing some on-line research I found created this code: (I first tried it with c++, after failure I tried python as well)
PHP:
<?php
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
... | [
"There are two problems in you code (at least for running your Python script). First, you're not flushing your Python output to it's STDOUT, so it never reaches PHP. This causes fgetc() to block infinitely. It's a simple fix, just add some flush() calls:\n#!/usr/bin/env python\nimport sys\n\nprint 'enter input'\nsy... | [
2,
0,
0
] | [] | [] | [
"c++",
"php",
"python"
] | stackoverflow_0004059117_c++_php_python.txt |
Q:
Toplevel window in Python keeps appearing under the root window
I have a toplevel window that keeps appear underneath the root window, which is pretty annoying. Any idea how to make sure that the toplevel gets the focus when the function is called?
def setup(self):
self.setup_step = 1
setup_window = Toplev... | Toplevel window in Python keeps appearing under the root window | I have a toplevel window that keeps appear underneath the root window, which is pretty annoying. Any idea how to make sure that the toplevel gets the focus when the function is called?
def setup(self):
self.setup_step = 1
setup_window = Toplevel(self)
setup_window.config(bg = "#000000", height = "600", wid... | [
"You can try by making the toplevel window transient.\n",
"You might try raising it and giving it focus. It could be that you window manager wants the window with focus to always be on top. \n"
] | [
2,
0
] | [] | [] | [
"python",
"tk_toolkit",
"tkinter"
] | stackoverflow_0005554954_python_tk_toolkit_tkinter.txt |
Q:
Web application admin generators
Since Symfony 1.x's admin generator, I found this kind of tool really useful to prototype applications, show something very quickly to customers etc.
Now for Symfony2, admin generator does not seems to be a priority (see here and here)
Django's admin generator seems very interestin... | Web application admin generators | Since Symfony 1.x's admin generator, I found this kind of tool really useful to prototype applications, show something very quickly to customers etc.
Now for Symfony2, admin generator does not seems to be a priority (see here and here)
Django's admin generator seems very interesting...
Which web application admin gener... | [
"Django's automatic admin app is excellent. Once you've written your models, it automatically creates a full-featured admin app around them where you can create, update and delete records. It's also extensible and customizable for just about whatever you need.\nHere's a pretty good overview about it. Django (and... | [
12,
7,
4,
2,
2,
2,
1,
1,
1
] | [] | [] | [
"frameworks",
"php",
"python",
"ruby"
] | stackoverflow_0005460011_frameworks_php_python_ruby.txt |
Q:
Django Admin Interface: how to show different model based on a user's selection?
I am creating a Poll application using Django. The workflow for the Admin user is as follows:
Admin clicks on the "Add Question" which shows the Admin a simple page with a dropdown list of 3 types(True/False,Multiple choice, Single c... | Django Admin Interface: how to show different model based on a user's selection? | I am creating a Poll application using Django. The workflow for the Admin user is as follows:
Admin clicks on the "Add Question" which shows the Admin a simple page with a dropdown list of 3 types(True/False,Multiple choice, Single choice) of Questions she can create. Basically there will be 3 types of Question Models... | [
"This isn't really behavior you can expect to be baked into django. \nTake advantage of what django does ship with, the CRUD interfaces, and set up a start page that has a drop down list that redirects to the appropriate model via some JavaScript.\n<script>\n// I'm using jQuery since I can type it as fast as pseudo... | [
1,
0
] | [] | [] | [
"django",
"django_admin",
"django_forms",
"django_models",
"python"
] | stackoverflow_0005560642_django_django_admin_django_forms_django_models_python.txt |
Q:
Django application with user images hosted in Amazon S3
I want to create a web application where user can upload their own images and they will be hosted on Amazon S3... but the problem is that I will need them resized (and croped) in various sizes (that can be eventually changed when design of the site is changed... | Django application with user images hosted in Amazon S3 | I want to create a web application where user can upload their own images and they will be hosted on Amazon S3... but the problem is that I will need them resized (and croped) in various sizes (that can be eventually changed when design of the site is changed?).
What is the right way to do it... upload file to S3 and t... | [
"You can look into using sorl-thumbnai which supports django's storage backends so you are free to switch to a backend using S3. In this case it would be recommendable to have your django installation run on EC2, which will grant you a good connection to S3.\n"
] | [
1
] | [] | [] | [
"amazon_s3",
"boto",
"django",
"python"
] | stackoverflow_0005562741_amazon_s3_boto_django_python.txt |
Q:
retrieving request.get variables in django/python
i have certain variables in my request.GET which are like
product-21cad54c-fafe-11dd-9f2b-001b639ca120, product-11cvcfd1-fafe-11dd-9f2b-001b639ca120,
(the id is part of the variable name)
I want to store the id's of all these product variables, how can i retrieve ... | retrieving request.get variables in django/python | i have certain variables in my request.GET which are like
product-21cad54c-fafe-11dd-9f2b-001b639ca120, product-11cvcfd1-fafe-11dd-9f2b-001b639ca120,
(the id is part of the variable name)
I want to store the id's of all these product variables, how can i retrieve these ids seperately?
| [
"In your view, you can treat request.GET a bit like a dict. You can use:\nrequest.GET.keys()\n\nIn the case of a url with the form: http://foo/?bar=baz&bing=boom, you would get ['bar','bing'].\nIs this what you are trying to do?\n[After comment]\nIn that case, you should be able to:\nfor key in request.GET.keys():\... | [
4
] | [] | [] | [
"django",
"python"
] | stackoverflow_0005562954_django_python.txt |
Q:
Storing user 'friends' in GAE datastore
I'm trying to make a facebook sort of social networking site (not a facebook app) for fun using flask and google app engine. I'm currently working out how to store friends in the datastore.
I want it to be somewhat like facebook, in that a user will request to be another's f... | Storing user 'friends' in GAE datastore | I'm trying to make a facebook sort of social networking site (not a facebook app) for fun using flask and google app engine. I'm currently working out how to store friends in the datastore.
I want it to be somewhat like facebook, in that a user will request to be another's friend and once accepted, they can see each ot... | [
"I think what you are trying has nothing to be confused. In your model, an friendship class is having two references of the type user property.\nfreindship=FriendShip()\nfriendship.user1=#assign a key of user or user object\nfriendship.user2=#assign a key of user or user object\nfriendhsip.put()\n\nHere user1 and ... | [
0,
0
] | [] | [] | [
"google_app_engine",
"google_cloud_datastore",
"python"
] | stackoverflow_0005562677_google_app_engine_google_cloud_datastore_python.txt |
Q:
How would I perform this query in Django?
class ExternalUser(models.Model):
user = models.ForeignKey(User)
external_account_id = models.CharField(max_length=200, null=True, blank=True)
class ExternalFriends(models.Model):
external_user = models.ForeignKey(ExternalUser)
external_account_id = models... | How would I perform this query in Django? | class ExternalUser(models.Model):
user = models.ForeignKey(User)
external_account_id = models.CharField(max_length=200, null=True, blank=True)
class ExternalFriends(models.Model):
external_user = models.ForeignKey(ExternalUser)
external_account_id = models.CharField(max_length=200, null=True, blank=Tru... | [
"Sure it can be done more efficiently but...\nExternalUser.objects.filter(external_account_id__in=[friend.id for friend in all_friends])\n\n"
] | [
1
] | [] | [] | [
"database",
"django",
"mysql",
"python"
] | stackoverflow_0005563176_database_django_mysql_python.txt |
Q:
How to test django caching?
Is there a way to be sure that a page is coming from cache on a production server and on the development server as well?
The solution shouldn't involve caching middleware because not every project uses them. Though the solution itself might be a middleware.
Just checking if the data is ... | How to test django caching? | Is there a way to be sure that a page is coming from cache on a production server and on the development server as well?
The solution shouldn't involve caching middleware because not every project uses them. Though the solution itself might be a middleware.
Just checking if the data is stale is not a very safe testing ... | [
"We do a lot of component caching and not all of them are updated at the same time. So we set host and timestamp values in a universally included context processor. At the top of each template fragment we stick in:\n<!-- component_name {{host}} {{timestamp}} -->\n\nThe component_name just makes it easy to do a View... | [
20,
16,
8,
2
] | [] | [] | [
"caching",
"django",
"django_cache",
"python"
] | stackoverflow_0000347812_caching_django_django_cache_python.txt |
Q:
Using while loop to add elements in a list without overwriting previous elements
I'm working with events and database classes.
I created a while loop that will keep appending my event (objects) in my database.
Also there is a command that will keep running in the if main block as long as the user doesn't type the ... | Using while loop to add elements in a list without overwriting previous elements | I'm working with events and database classes.
I created a while loop that will keep appending my event (objects) in my database.
Also there is a command that will keep running in the if main block as long as the user doesn't type the command "exit".
My problem is that whenever the command asks for an event to be added,... | [
"I think you want to do that:\ndef parse(command, a_lst):\n '''Parse a command string.'''\n a,b = command.split(None,1)\n if a == \"event\":\n a_lst.append(b)\n\n\nstore_event = Database() # where I should save my event objects\nparse('event blahblahbla',store_event)\nparse('event youtchouiya',store... | [
1
] | [] | [] | [
"python"
] | stackoverflow_0005563014_python.txt |
Q:
Python error: execute() first
When I try to run this view/function, I get the following error execute() first.
def homepage(request, parem1, parem2):
# open sql connection
cursor = connection.cursor()
if parem1 == 'p':
if parem2 == 'all':
cursor.execute((" SELECT eventname, id,... | Python error: execute() first | When I try to run this view/function, I get the following error execute() first.
def homepage(request, parem1, parem2):
# open sql connection
cursor = connection.cursor()
if parem1 == 'p':
if parem2 == 'all':
cursor.execute((" SELECT eventname, id, party, DATE_FORMAT(eventdate, GET_... | [
"Presumably you've hit a case where parem1 is not 'p' and parem2 is not 'APR'. In this case, you haven't made any calls to execute.\nPerhaps you should restrict the if/else to just defining the string to be executed, with a catch-all default, and do the execute call outside the if block.\n"
] | [
3
] | [] | [] | [
"django",
"mysql",
"python"
] | stackoverflow_0005563907_django_mysql_python.txt |
Q:
How do you implement multiple data types for an object in Django?
I'd like to know the best way to associate various data types with an object in Django. Some of the types should be string, boolean, image file, choice from a list, or a link. For example, say you have a Product model. For product X, you'll want ... | How do you implement multiple data types for an object in Django? | I'd like to know the best way to associate various data types with an object in Django. Some of the types should be string, boolean, image file, choice from a list, or a link. For example, say you have a Product model. For product X, you'll want to add an image attribute, a string for the model name, and a link. For... | [
"You can either make a single model that allows for blank/null values for each field. Or use django's model inheritance if you are setting up types of products that share similar desired attributes or fall into categories. It seems like you are asking for optional attributes which would just require you to define o... | [
1,
0
] | [] | [] | [
"django",
"python"
] | stackoverflow_0005546499_django_python.txt |
Q:
reading from multiple txt files - strip data and save to xls
i'm very new to python, so far i have written the following code below, which allows me to search for text files in a folder, then read all the lines from it, open an excel file and save the read lines in it. (Im still unsure whether this does it for all... | reading from multiple txt files - strip data and save to xls | i'm very new to python, so far i have written the following code below, which allows me to search for text files in a folder, then read all the lines from it, open an excel file and save the read lines in it. (Im still unsure whether this does it for all the text files one by one)
Having run this, i only see the file t... | [
"Can be condensed in\nimport glob\n\nlist_of_files = glob.glob('./*.txt')\n\nwith open(\"stripD.xls\", \"w\") as fout:\n for fileName in list_of_files:\n data_list = open( fileName, \"r\" ).readlines()\n fout.write(data_list[17])\n fout.writelines(data_list[44:])\n\nAre you aware that writel... | [
3,
2,
2
] | [] | [] | [
"excel",
"python",
"text"
] | stackoverflow_0005563193_excel_python_text.txt |
Q:
Javascript / Django Design Pattern
I just have a question about how to achieve DRY with javascript that generates html on the fly. I have a list of elements that are loaded dynamically and populated by the django template a la
{{ tag.title }}
{% if request.user.is_authenticated %}
<a name="del-tag" data-id="{{ ta... | Javascript / Django Design Pattern | I just have a question about how to achieve DRY with javascript that generates html on the fly. I have a list of elements that are loaded dynamically and populated by the django template a la
{{ tag.title }}
{% if request.user.is_authenticated %}
<a name="del-tag" data-id="{{ tag.id }}" class = "tag-x" title="Remove T... | [
"jquery(I'm assuming that's jquery that you are using) has a clone feature that can clone DOM elements. Given that you should be able to clone one of the html elements that already exist and change the value of the attributes, and then append it back to the DOM. I have not done this myself but it should work in the... | [
1,
1,
0
] | [] | [] | [
"django",
"dry",
"javascript",
"python"
] | stackoverflow_0005560893_django_dry_javascript_python.txt |
Q:
How to make DNS queries on Linux (with python) bypassing nsswitch.conf and no additional packages
I'd like to make DNS queries to check if some entries in the /etc/hosts file are obsolete (now working DNS) or conflicting with DNS answers. nsswitch.conf is configured to lookup /etc/hosts first.
gethostbyname() or g... | How to make DNS queries on Linux (with python) bypassing nsswitch.conf and no additional packages | I'd like to make DNS queries to check if some entries in the /etc/hosts file are obsolete (now working DNS) or conflicting with DNS answers. nsswitch.conf is configured to lookup /etc/hosts first.
gethostbyname() or getaddrinfo() will not work because they both use the OSes mechasnims (nsswitch.conf).
I know about the ... | [
"The obvious options:\n\nPyDNS\ndnspython\nCall res_query via the libresolv C API (e.g. using ctypes)\n\n",
"Twisted Names contains a DNS client.\n",
"I always liked evdns\nhttp://linux.die.net/man/3/evdns\nThere appears to be a python binding called pyevent\nhttp://code.google.com/p/pyevent/source/browse/trunk... | [
1,
1,
0,
0
] | [] | [] | [
"linux",
"python"
] | stackoverflow_0005563813_linux_python.txt |
Q:
How should I indicate that my Python shell script is returning an error?
I’m writing a shell script in Python (#!/usr/bin/env python). I’m a bit new to shell scripting in general, so apologies if I’m misunderstanding something.
My current understanding is that if my shell script works successfully, I should call s... | How should I indicate that my Python shell script is returning an error? | I’m writing a shell script in Python (#!/usr/bin/env python). I’m a bit new to shell scripting in general, so apologies if I’m misunderstanding something.
My current understanding is that if my shell script works successfully, I should call sys.exit() to indicate that it’s succeeded (i.e. return 0).
If I’ve encountered... | [
"Most Shell utilites have various return values depending on the error that occurs.\nThe standard is when exiting with a status code of 0, it means the execution ended successfully.\nFor other error codes, this is highly dependant on the utility itself. You're most likely to learn about error codes in the man pages... | [
7,
6
] | [] | [] | [
"python",
"shell"
] | stackoverflow_0005564550_python_shell.txt |
Q:
Appengine model filtering problem
I've got an entity class:
class User(db.Model):
local = db.TextProperty(required=True)
jid = db.TextProperty(required=True)
Later in code I'm checking if a user exists:
def parseMessageFromJid(self, message, mesFrom) :
#user = User.all().filter(' jid', mesFrom.low... | Appengine model filtering problem | I've got an entity class:
class User(db.Model):
local = db.TextProperty(required=True)
jid = db.TextProperty(required=True)
Later in code I'm checking if a user exists:
def parseMessageFromJid(self, message, mesFrom) :
#user = User.all().filter(' jid', mesFrom.lower().strip()).get()
user = db.G... | [
"TextProperty is not indexed.\nUse StringProperty\n"
] | [
3
] | [] | [] | [
"filter",
"google_app_engine",
"model",
"python"
] | stackoverflow_0005564495_filter_google_app_engine_model_python.txt |
Q:
how to request authentication url only once, not twice, with python's urllib2 library
usually, we request an authentication url with python urllib2 library, usage is as this page describe, but this will cause 2 request for server , the first one is responsed with a 401 error, and then the second one is the client ... | how to request authentication url only once, not twice, with python's urllib2 library | usually, we request an authentication url with python urllib2 library, usage is as this page describe, but this will cause 2 request for server , the first one is responsed with a 401 error, and then the second one is the client encodes username/passwd into authentication header and request again. But, if you do know ... | [
"Yeah, that's how password manager from urllib works. It only sends auth information after receiving 401 from the server. You could subclass lots of stuff and change that behavior, but it seems easier to just encode the information into the header yourself like you did in the example.\n"
] | [
1
] | [] | [] | [
"authentication",
"python",
"urllib2"
] | stackoverflow_0005564197_authentication_python_urllib2.txt |
Q:
run .sql files from within sqlalchemy
Any idea on how I could run a bunch of .sql files that contains lots of functions from within sqlalchemy, after I create the schema ? I've tried using DDL(), engine.text(<text>).execute(), engine.execute(<text>). None of them work, they are either failing because improper esca... | run .sql files from within sqlalchemy | Any idea on how I could run a bunch of .sql files that contains lots of functions from within sqlalchemy, after I create the schema ? I've tried using DDL(), engine.text(<text>).execute(), engine.execute(<text>). None of them work, they are either failing because improper escape or some other weird errors. I am using s... | [
"You can't do that. You must parse the file and split it into individual SQL commands, and then execute each one separately in a transaction.\n"
] | [
1
] | [] | [] | [
"python",
"sqlalchemy"
] | stackoverflow_0005563437_python_sqlalchemy.txt |
Q:
Pycharm 1.2 Ignoring A Directory Named cvs
Am using Pycharm 1.2 on OSX 10.6 . One of my project directories is named cvs, but it is not showing up in the project explorer. I have tried uninstalling cvs version control plugin but this didn't resolve it. When i try to manually create the directory , i get a messag... | Pycharm 1.2 Ignoring A Directory Named cvs | Am using Pycharm 1.2 on OSX 10.6 . One of my project directories is named cvs, but it is not showing up in the project explorer. I have tried uninstalling cvs version control plugin but this didn't resolve it. When i try to manually create the directory , i get a message < trying to create a directory with an ignored... | [
"Settings | File Types | Ignore files and folders, remove CVS from the ignored list.\n"
] | [
5
] | [] | [] | [
"intellij_idea",
"pycharm",
"python"
] | stackoverflow_0005564624_intellij_idea_pycharm_python.txt |
Q:
glpk err , import glpk module not found
I am not able to Run glpk module based programs, on python 2.7.1 , Mac OS platform.
I am not sure if glpk module is installed successfully.
kindly help me, i am new to this.
A:
Maybe GLPK is trying to load "_glpkpi.so" but it can not find it, try to append this library to ... | glpk err , import glpk module not found | I am not able to Run glpk module based programs, on python 2.7.1 , Mac OS platform.
I am not sure if glpk module is installed successfully.
kindly help me, i am new to this.
| [
"Maybe GLPK is trying to load \"_glpkpi.so\" but it can not find it, try to append this library to your path\nimport sys \nsys.path.append('/usr/lib/python-support/python-glpk/python2.7')\n\nOf course, you have to change '/usr/lib/python-support/python-glpk/python2.7' for the correct path of your \"_glpkpi.so\" ... | [
0
] | [] | [] | [
"python"
] | stackoverflow_0005563066_python.txt |
Q:
PyQt: how to use QWebPage with an anonimous proxy
This is driving me crazy.
I want to show in a QWebPage an url, but i want to do it passing by an anonimous proxy.
Code
#setting up the proxy
proxy = QNetworkProxy()
proxy.setHostName("189.75.98.199") #just examples
proxy.setPort(1111)
proxy.setType = QNetworkProxy... | PyQt: how to use QWebPage with an anonimous proxy | This is driving me crazy.
I want to show in a QWebPage an url, but i want to do it passing by an anonimous proxy.
Code
#setting up the proxy
proxy = QNetworkProxy()
proxy.setHostName("189.75.98.199") #just examples
proxy.setPort(1111)
proxy.setType = QNetworkProxy.HttpProxy
#setting the manager
manager = QNetworkAcc... | [
"got it to work\nin this way it works, using setApplicationProxy. I still don't understand why setting proxy parameters after instance creation doesn't work (as in the initial example)\ndef set_proxy(self, proxy):\n\n proxy_url = QUrl(proxy)\n\n if unicode(proxy_url.scheme()).startswith('http'):\n pro... | [
4
] | [] | [] | [
"proxy",
"python",
"qnetworkaccessmanager",
"qt",
"qwebpage"
] | stackoverflow_0005423013_proxy_python_qnetworkaccessmanager_qt_qwebpage.txt |
Q:
How to avoid django "clashes with related m2m field" error?
I have a lot of models with voting functionality, so I created a structure like this:
class Voteable(models.Model):
likes_balance = models.IntegerField(default=0, editable=False)
votes = models.ManyToManyField(User, blank=True, editable=False)
... | How to avoid django "clashes with related m2m field" error? | I have a lot of models with voting functionality, so I created a structure like this:
class Voteable(models.Model):
likes_balance = models.IntegerField(default=0, editable=False)
votes = models.ManyToManyField(User, blank=True, editable=False)
likes = models.ManyToManyField(User, blank=True, editable=False)... | [
"I found a solution in Django documention.\nIt's possible to write in abstract models things like this:related_name=\"%(app_label)s_%(class)s_related\"\n",
"Normally if you add a related_name as suggested in your M2M definition, it should work :\nclass Voteable(models.Model):\n likes_balance = models.IntegerFi... | [
10,
2
] | [] | [] | [
"django",
"django_models",
"python"
] | stackoverflow_0005564782_django_django_models_python.txt |
Q:
Troubleshooting Python YouTube-download script
I have been using youtube-dl for a while now with no issues, but now I keep getting an error saying
ERROR: unable to download video (format may not be available) for all videos.
What may the issue be?
A:
Works with the most current version of yt-dl, which can be... | Troubleshooting Python YouTube-download script | I have been using youtube-dl for a while now with no issues, but now I keep getting an error saying
ERROR: unable to download video (format may not be available) for all videos.
What may the issue be?
| [
"Works with the most current version of yt-dl, which can be found here:\nhttp://rg3.github.com/youtube-dl/download.html\n",
"I have fixed this issue like the following and made it working.\nNote: using the below mentioned command twice is mandatory, I think. I tried it once only, but it didn't work so after execu... | [
2,
1
] | [] | [] | [
"python",
"youtube"
] | stackoverflow_0004435898_python_youtube.txt |
Q:
NoSql With My Own Custom Binary Files?
Originally, I had to deal with just 1.5[TB] of data. Since I just needed fast write/reads (without any SQL), I designed my own flat binary file format (implemented using python) and easily (and happily) saved my data and manipulated it on one machine. Of course, for backup pu... | NoSql With My Own Custom Binary Files? | Originally, I had to deal with just 1.5[TB] of data. Since I just needed fast write/reads (without any SQL), I designed my own flat binary file format (implemented using python) and easily (and happily) saved my data and manipulated it on one machine. Of course, for backup purposes, I added 2 machines to be used as exa... | [
"Perhaps some of the commentary on the Kivaloo system developed for Tarsnap will help you decide what's most appropriate: http://www.daemonology.net/blog/2011-03-28-kivaloo-data-store.html\nWithout knowing more about your application (size/type of records, frequency of reading/writing) or custom format it's hard to... | [
1,
1
] | [] | [] | [
"distributed",
"linux",
"python"
] | stackoverflow_0005560523_distributed_linux_python.txt |
Q:
Why is this shell script calling itself as python script?
Obviously this shell script is calling itself as a Python script:
#!/bin/sh
## repo default configuration
##
REPO_URL='git://android.git.kernel.org/tools/repo.git'
REPO_REV='stable'
magic='--calling-python-from-/bin/sh--'
"""exec" python -E "$0" "$@" """#... | Why is this shell script calling itself as python script? | Obviously this shell script is calling itself as a Python script:
#!/bin/sh
## repo default configuration
##
REPO_URL='git://android.git.kernel.org/tools/repo.git'
REPO_REV='stable'
magic='--calling-python-from-/bin/sh--'
"""exec" python -E "$0" "$@" """#$magic"
if __name__ == '__main__':
import sys
if sys.argv[-... | [
"Your first question: this is done to fix unix systems (or emulations thereof) that do not handle the #! correctly or at all. The high art is to make a script that is correct in shell as well as in the other language. For perl, one often sees something like:\nexec \"/usr/bin/perl\"\n if 0;\n\nThe exec is interpre... | [
8
] | [] | [] | [
"android",
"python",
"sh"
] | stackoverflow_0005565340_android_python_sh.txt |
Q:
WTForms validators.optional: continue validation of empty fields?
I have a problem with WTForms validators.optional() because it stops the validation chain if the field is empty (WTForms docs). This means that the validation does not continue with custom functions, which can result in type errors.
Code example:
c... | WTForms validators.optional: continue validation of empty fields? | I have a problem with WTForms validators.optional() because it stops the validation chain if the field is empty (WTForms docs). This means that the validation does not continue with custom functions, which can result in type errors.
Code example:
class MyForm(form):
myfield = TextField('My Field', [validators.Opti... | [
"You could just change the order in which your validators are listed. If your custom validators are placed before the optional validator it should provide the desired effect as they're evaluated in order.\n"
] | [
10
] | [] | [] | [
"python",
"validation",
"wtforms"
] | stackoverflow_0005507294_python_validation_wtforms.txt |
Q:
Python web service for a java application?
Forgive me if this is a stupid question. I am completely new to building web services and complete web apps.
I want to develop a particular functionality for a java based web application. However this functionality is simpler to develop with Python. So is it possible If ... | Python web service for a java application? | Forgive me if this is a stupid question. I am completely new to building web services and complete web apps.
I want to develop a particular functionality for a java based web application. However this functionality is simpler to develop with Python. So is it possible If i develop this web service with Python and use i... | [
"I think it is possible. Let's assume that your webservice method returns a json string. You can use this string, convert into a HashMap in Java and work with the data.\nI personally prefer cherrypy, for the ease of creating a webservice. It has an inbuilt server too. \nYou can use FlexJSON to convert json string i... | [
1,
1,
0,
0
] | [] | [] | [
"java",
"python",
"web_applications",
"web_services"
] | stackoverflow_0005515157_java_python_web_applications_web_services.txt |
Q:
Detecting hangs with Python urllib2.urlopen
I'm using Python's urllib2 to send an HTTP post:
import socket, urllib, urllib2
socket.setdefaulttimeout(15)
postdata = urllib.urlencode({'value1' : 'a string', 'value2' : 'another string'})
headers = {
'User-Agent': 'Agent',
'Content-Type': 'application/x-... | Detecting hangs with Python urllib2.urlopen | I'm using Python's urllib2 to send an HTTP post:
import socket, urllib, urllib2
socket.setdefaulttimeout(15)
postdata = urllib.urlencode({'value1' : 'a string', 'value2' : 'another string'})
headers = {
'User-Agent': 'Agent',
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'text/html, *... | [
"You can use signals, first set a handler for your signal\nimport signal\n...\ndef handler(signum, frame):\n print 'Signal handler called with signal', signum\n...\nsignal.signal(signal.SIGALRM, handler)\n\nand put an alarm just before the urlopen call\nsignal.alarm(5)\nresponse = urllib2.urlopen(request)\nsigna... | [
10
] | [] | [] | [
"networking",
"python",
"sockets"
] | stackoverflow_0005565291_networking_python_sockets.txt |
Q:
openpyxl cell style not reporting correctly
Using the python library openpyxl I am reading an XLSX file created in excel 2007. it is empty apart from cell A1 which is coloured yellow and has the value "test" written in it. I can easily retrieve the value from that cell, however when I attempt to determine the fill... | openpyxl cell style not reporting correctly | Using the python library openpyxl I am reading an XLSX file created in excel 2007. it is empty apart from cell A1 which is coloured yellow and has the value "test" written in it. I can easily retrieve the value from that cell, however when I attempt to determine the fill colour I get the following results:
this_sheet.c... | [
"Openpyxl is still in development, and styles are not yet completely implemented, thus you can encounter some issues here and there. Don't hesitate to open an issue on the project bug tracker if you want.\n"
] | [
5
] | [] | [] | [
"openpyxl",
"python",
"xlsx"
] | stackoverflow_0005560675_openpyxl_python_xlsx.txt |
Q:
Django query: Want to count an empty value
I seem to have a problem trying to count. I have a list item where each item can store many statuses, although I am only interested in it's latest status only. Now look at my views.
storage_items = StorageItem.objects\
.filter(client=client_id,itemstatushi... | Django query: Want to count an empty value | I seem to have a problem trying to count. I have a list item where each item can store many statuses, although I am only interested in it's latest status only. Now look at my views.
storage_items = StorageItem.objects\
.filter(client=client_id,itemstatushistory__isnull=False)\
.distinct(... | [
"Try this:\nstorage_items = models.StorageItem.objects.filter(client=client_id).distinct()\n\ntotal_items_in_stock = [item for item in storage_items\n if not item.itemstatushistory_set.exists() or \n item.itemstatushistory_set.latest().status.description not in ['Destroyed','Permanent Retrieval']]\... | [
0,
0
] | [] | [] | [
"count",
"django",
"python",
"views"
] | stackoverflow_0005564977_count_django_python_views.txt |
Q:
How can I do this?
l = [u'Dav watson', u'Davis']
Result should be:
[
{
first_name: 'Dav',
last_name: 'Watson'
}, {
firstname:'Davis'
}
]
A:
import string
l = [u'Dav watson', u'Davis']
[dict(zip(('first_name', 'last_name'), map(string.capitalize, l[0].split()))),
{'firstname... | How can I do this? | l = [u'Dav watson', u'Davis']
Result should be:
[
{
first_name: 'Dav',
last_name: 'Watson'
}, {
firstname:'Davis'
}
]
| [
"import string\nl = [u'Dav watson', u'Davis']\n\n[dict(zip(('first_name', 'last_name'), map(string.capitalize, l[0].split()))),\n {'firstname': l[1]}]\n\n# returns:\n\n[{'first_name': u'Dav', 'last_name': u'Watson'}, {'firstname': u'Davis'}]\n\n"
] | [
5
] | [] | [] | [
"python",
"string"
] | stackoverflow_0005566018_python_string.txt |
Q:
how to get [(1, 2, 3, 4), (5, 6, 7, 8)] in my code using python
this is my code :
a = [(1,2),(5,6)]
b = [(3,4),(7,8)]
print zip(a,b)
and it show :
[((1, 2), (3, 4)), ((5, 6), (7, 8))]
but i want get :
[(1, 2, 3, 4), (5, 6, 7, 8)]
so what can i do ,
thanks
A:
Try this:
[aa+bb for aa,bb in zip(a,b)]
A:
>>> a... | how to get [(1, 2, 3, 4), (5, 6, 7, 8)] in my code using python | this is my code :
a = [(1,2),(5,6)]
b = [(3,4),(7,8)]
print zip(a,b)
and it show :
[((1, 2), (3, 4)), ((5, 6), (7, 8))]
but i want get :
[(1, 2, 3, 4), (5, 6, 7, 8)]
so what can i do ,
thanks
| [
"Try this:\n[aa+bb for aa,bb in zip(a,b)]\n\n",
">>> a = [(1,2),(5,6)]\n>>> b = [(3,4),(7,8)]\n>>> [x+y for x,y in zip(a,b)]\n[(1, 2, 3, 4), (5, 6, 7, 8)]\n>>> \n\n",
"you can use the following list comprehension:\n[x + y for (i, x) in enumerate(a) for (j, y) in enumerate(b) if i == j]\n\nResult:\n[(1, 2, 3, 4)... | [
8,
6,
3
] | [] | [] | [
"python"
] | stackoverflow_0005566160_python.txt |
Q:
Running Bulk Synchronous Parallel Model (BSP) in Python
The BSP Parallel Programming Model has several benefits - the programmer need not explicitly care about synchronization, deadlocks become impossible and reasoning about speed becomes much easier than with traditional methods. There is a Python interface to th... | Running Bulk Synchronous Parallel Model (BSP) in Python | The BSP Parallel Programming Model has several benefits - the programmer need not explicitly care about synchronization, deadlocks become impossible and reasoning about speed becomes much easier than with traditional methods. There is a Python interface to the BSPlib in the SciPy:
import Scientific.BSP
I wrote a litt... | [
"A minor thing, but Scientific Python != SciPy in your question...\nIf you download the ScientificPython sources you'll see a README.BSP, a README.MPI, and a README.BSPlib. Unfortunately, there's not really much mention made of the information there on the online webpages.\nThe README.BSP is pretty explicit about... | [
3
] | [] | [] | [
"parallel_processing",
"python"
] | stackoverflow_0005565453_parallel_processing_python.txt |
Q:
Executing a function (with a parameter) every X seconds in python
I want to run a code that runs a function with a parameter (eg. greet(h)) every 5 seconds. I tried using threading but it doesn't work. It executes just once. See the code below and the errors:
import threading
oh_hi = "Hi guys"
def greeting(hello... | Executing a function (with a parameter) every X seconds in python | I want to run a code that runs a function with a parameter (eg. greet(h)) every 5 seconds. I tried using threading but it doesn't work. It executes just once. See the code below and the errors:
import threading
oh_hi = "Hi guys"
def greeting(hello):
print "%s" % hello
threading.Timer(1, greeting(oh_hi)).start(... | [
"As others have pointed out, the error is because you're not passing the proper arguments to the threading.Timer() method. Correcting that will run your function, once, after 5 seconds. There are a number of ways to get it to repeat. \nAn object-oriented approach would be to derive a new threading.Thread subclass. ... | [
4,
3,
0,
0
] | [] | [] | [
"python"
] | stackoverflow_0005564009_python.txt |
Q:
Methods in a class -Python
In python how to know the methods of a class
Ex: import datetime is a module which has a date class in it..
And print datetime.date.today()
will yield todays date.
How to know all the methods of a class
help(datetime) and dir(datetime) are the only way..?
A:
First solution
Following ... | Methods in a class -Python | In python how to know the methods of a class
Ex: import datetime is a module which has a date class in it..
And print datetime.date.today()
will yield todays date.
How to know all the methods of a class
help(datetime) and dir(datetime) are the only way..?
| [
"First solution\nFollowing Björn's answer and the Dive-into-Python chapter using callable(getattr(classname)):\n>>> import datetime\n>>> c=datetime.datetime\n>>> methodList = [method for method in dir(c) if callable(getattr(c, method))]\n>>> methodList\n['__add__', '__class__', '__delattr__', '__eq__', '__format__'... | [
5,
2,
1,
1
] | [] | [] | [
"python"
] | stackoverflow_0005565557_python.txt |
Q:
Python - Prime Number exercise
Note, this is not my homework assignment! I'm just trying to understand Python (and math, sadly) at the same time. I know the ultimate goal of this program is to get a list of prime numbers in the range 1 to 20, however, once it gets to the "for x in range..." line, I'm getting lost ... | Python - Prime Number exercise | Note, this is not my homework assignment! I'm just trying to understand Python (and math, sadly) at the same time. I know the ultimate goal of this program is to get a list of prime numbers in the range 1 to 20, however, once it gets to the "for x in range..." line, I'm getting lost and the tutorial doesn't explain it ... | [
"a)\nfor x in range (2,n)\n\nis the same like\nfor (x = 2; x < n; x++)\n\nin some other language: a loop where x gets integer values between 2 and n-1 included.\nb)\nfor x in range (2,n): \n\nthis n comes from the first def isprime(n) and is whatever this function is later called with. In this case it is always the... | [
7,
3,
0
] | [] | [] | [
"python"
] | stackoverflow_0005566807_python.txt |
Q:
Python + OpenGL = "Command terminated"
I'm on Ubuntu, with Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2
with OpenGL version 3.0.0
and I've just downloaded http://pypi.python.org/pypi/PyOpenGL-Demo.
I ran the first example in NeHe directory, lesson11.pym without modify it.
Hit ESC key to q... | Python + OpenGL = "Command terminated" | I'm on Ubuntu, with Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2
with OpenGL version 3.0.0
and I've just downloaded http://pypi.python.org/pypi/PyOpenGL-Demo.
I ran the first example in NeHe directory, lesson11.pym without modify it.
Hit ESC key to quit.
Command terminated
What can it be?
| [
"Do you have working 3d support? My guess is no. OpenGL isn't going to work without it.\n"
] | [
0
] | [] | [] | [
"opengl",
"python"
] | stackoverflow_0005567045_opengl_python.txt |
Q:
Installing turbogears 2.1 on Windows 7 x86 error "The system cannot find the file specified"
I created enviroment in C:\Projects2010\Python\Environments:
C:\Python27\Scripts\virtualenv.exe myenv
Then ran activate.bat:
C:\Projects2010\Python\Environments\myenv\Scripts\activate.bat
Then ran pip:
C:\Projects2010\Py... | Installing turbogears 2.1 on Windows 7 x86 error "The system cannot find the file specified" | I created enviroment in C:\Projects2010\Python\Environments:
C:\Python27\Scripts\virtualenv.exe myenv
Then ran activate.bat:
C:\Projects2010\Python\Environments\myenv\Scripts\activate.bat
Then ran pip:
C:\Projects2010\Python\Environments\myenv\Scripts\pip.exe install -i http://www.turbogears.org/2.1/downloads/current... | [
"To avoid such \"build\" errors, it is best to use a binary package manager\n\nInstall ActivePython (32-bit) \nType pypm -E C:\\Projects2010\\Python\\Environments\\myenv install tg.devtools\n\n"
] | [
1
] | [] | [] | [
"pip",
"python",
"turbogears",
"windows"
] | stackoverflow_0005563049_pip_python_turbogears_windows.txt |
Q:
calculating Levenshtein Distance using word lists
first i want to say that i am a newbie in python. I trying to calculate the Levenshtein Distance for many lists of word. Until now i succeed writing the code for a pair of word, but i'm having some problems doing it for lists. I just habe two lists with words one b... | calculating Levenshtein Distance using word lists | first i want to say that i am a newbie in python. I trying to calculate the Levenshtein Distance for many lists of word. Until now i succeed writing the code for a pair of word, but i'm having some problems doing it for lists. I just habe two lists with words one below the other like this:
carlos
stiv
peter
I want to u... | [
"I finally got the code working with some help from a friend :)\nYou can compute the Levenshtein distance and compare it to every word from the second list changing the last line in the script, i.e: print(list1[0], list2[i]), to compare the first word from the list1 to every word in list2.\nThanks\n#!/usr/bin/env p... | [
13,
5
] | [] | [] | [
"levenshtein_distance",
"python"
] | stackoverflow_0005551053_levenshtein_distance_python.txt |
Q:
How do I integrate existing scripts into Django?
I have just been introduced to the Django framework and I would like to use this framework for a lot of my system based Perl/Python/wlst scripts for my group. How can I take the normal command line output and have it output the browser in near real time? I have look... | How do I integrate existing scripts into Django? | I have just been introduced to the Django framework and I would like to use this framework for a lot of my system based Perl/Python/wlst scripts for my group. How can I take the normal command line output and have it output the browser in near real time? I have looked into serialization but I can't seem to find any goo... | [
"You want do siplay external script results in the web browser? Then, I suggest you make those scripts write their results to database and then use django models to fetch and display the info.\nIf you want to execute the script each time user opens the webpage and display a result, use this python code:\ndef comman... | [
1,
0
] | [] | [] | [
"django",
"perl",
"python",
"wlst"
] | stackoverflow_0005567732_django_perl_python_wlst.txt |
Q:
Django - How to allow users to enter decimals in scientific notation?
I want users to be able to enter a standard decimal value like 1.51 or enter a value in scientific notation like 4.08E+13.
I set up a decimal field in my model but when I try to enter the above example I get this validation message:
"Ensure that... | Django - How to allow users to enter decimals in scientific notation? | I want users to be able to enter a standard decimal value like 1.51 or enter a value in scientific notation like 4.08E+13.
I set up a decimal field in my model but when I try to enter the above example I get this validation message:
"Ensure that there are no more than 3 decimal places."
Side note:
I did notice that Py... | [
"This looks like a Django bug, DecimalField.validate() is wrong for positive exponents:\n>>> from django.forms import DecimalField\n>>> f = DecimalField(max_digits=10, decimal_places=1)\n>>> f.validate(Decimal('1E+2'))\nTraceback (most recent call last):\n...\nValidationError: [u'Ensure that there are no more than ... | [
2
] | [] | [] | [
"decimal",
"django",
"django_models",
"python",
"scientific_notation"
] | stackoverflow_0005566121_decimal_django_django_models_python_scientific_notation.txt |
Q:
How to move stored procedure to django model class and use them in filter/exclude?
How to move stored procedure to django model class and use them in filter/exclude?
As said here What is the best way to access stored procedures in Django's ORM it should be possible.
In another word, how can i accomplish something... | How to move stored procedure to django model class and use them in filter/exclude? | How to move stored procedure to django model class and use them in filter/exclude?
As said here What is the best way to access stored procedures in Django's ORM it should be possible.
In another word, how can i accomplish something like this:
class Project(models.Model):
name = models.CharField()
def is_finish... | [
"Not sure why you are referring to stored procedures in this context.\nBut if i understand your example correct, your problem is that you can filter only by modelfields that have a corresponding field in a database table.\nAnd therefore you can't use django's orm to filter by methods and properties.\nBut you can ac... | [
1,
0
] | [] | [] | [
"django",
"django_models",
"python",
"stored_procedures"
] | stackoverflow_0005565936_django_django_models_python_stored_procedures.txt |
Q:
Changing versions of Python in command line
Python 2.5 came installed on my Mac. I downloaded Python 3.2 and have it running in my IDE. When I open the terminal in Mac and type in Python, it tells me I'm working with 2.5.
1) What do I enter in the command line to change from 2.5 to 3.2?
2) Once I get to 3.2 (usi... | Changing versions of Python in command line | Python 2.5 came installed on my Mac. I downloaded Python 3.2 and have it running in my IDE. When I open the terminal in Mac and type in Python, it tells me I'm working with 2.5.
1) What do I enter in the command line to change from 2.5 to 3.2?
2) Once I get to 3.2 (using your answer), how do I get back to 2.5 if I wa... | [
"You can simply type python3.2 instead of just python to use python 3.2.\n"
] | [
5
] | [] | [] | [
"macos",
"python"
] | stackoverflow_0005568330_macos_python.txt |
Q:
Is a function returning different number of elements depending on one input parameter considered bad practice?
I have a function that treats and returns data, but according to a boolean input parameter, should do a slightly different treatment (not different enough to justify a new function, I think). This slightl... | Is a function returning different number of elements depending on one input parameter considered bad practice? | I have a function that treats and returns data, but according to a boolean input parameter, should do a slightly different treatment (not different enough to justify a new function, I think). This slightly different treatment also requires the returning of an additional parameter.
Let's say I have this.
def func(data,... | [
"No, I don't think so. Now your caller has to know about your function internals, specifically that your option changes the return type. That's just another thing for the caller to remember, and is poor encapsulation.\nI would either split this into two functions (preferred), or return a None placeholder, or return... | [
3,
1
] | [] | [] | [
"python"
] | stackoverflow_0005568926_python.txt |
Q:
Django : calling custom methods while User signup
I'm trying to create an App in Django, which requires a pre-defined method to be called at the time of new user registration/signup. Any idea if there is an app like django-registration or django-userena which allows calling such methods without any hacking in the ... | Django : calling custom methods while User signup | I'm trying to create an App in Django, which requires a pre-defined method to be called at the time of new user registration/signup. Any idea if there is an app like django-registration or django-userena which allows calling such methods without any hacking in the code.
| [
"You could try using Django Signals. Then you can hook into the save method on a new user model.\n"
] | [
1
] | [] | [] | [
"django",
"python"
] | stackoverflow_0005568985_django_python.txt |
Q:
Pythonic way to handle updating status string between functions?
This seems like a remedial topic, but I'm a bit unsure of how to deal with this. Every solution I think of seems messy.
I'm working with some code that builds up a message while performing several actions, then ultimately returns that msg with an ht... | Pythonic way to handle updating status string between functions? | This seems like a remedial topic, but I'm a bit unsure of how to deal with this. Every solution I think of seems messy.
I'm working with some code that builds up a message while performing several actions, then ultimately returns that msg with an http response. Currently it looks somewhat like this:
try:
pdict = ... | [
"put your message in an array, pass it around, and just append each part to it.\njust before sending it, do a ''.join(msg).\n",
"Consider putting your messages in a list and appending to it as you go?\nmessages = []\ntry:\n pdict = parser.parseProtocol(id)\n messages.append(\"parsing worked\")\nexcept:\n ... | [
1,
1,
1
] | [] | [] | [
"python"
] | stackoverflow_0005568990_python.txt |
Q:
Python inheritance, class level variables, __init__ takes no arguments
Edit: This is a silly mistake, look at the answers, but my init method does not define a self variable.
I have several python classes that are stages in a pipeline. They inherit from a base class.
class StageBase(object):
key = Segments.NON... | Python inheritance, class level variables, __init__ takes no arguments | Edit: This is a silly mistake, look at the answers, but my init method does not define a self variable.
I have several python classes that are stages in a pipeline. They inherit from a base class.
class StageBase(object):
key = Segments.NONE
_preprocessors = []
def __init__():
self.closing = False
... | [
"You need to add the default self parameter to __init__:\ndef __init__(self):\n\n",
"init must have at least one argument in its signature:\ndef __init__(self):\n pass\n\nHere the error comes probably from FacebookGraphStage. Check its init method (and the other ones in your files) to solve the problem\n",
"... | [
8,
3,
1
] | [] | [] | [
"pipelining",
"python"
] | stackoverflow_0005569555_pipelining_python.txt |
Q:
how to turn a tuple to a string and back in python / how to edit an associative array on a web page
The problem I'm really trying to solve:
I have a square table of true/false values, with rows and columns labelled by strings.
I want to display this as an html form with checkboxes, allow the user to tick and untic... | how to turn a tuple to a string and back in python / how to edit an associative array on a web page | The problem I'm really trying to solve:
I have a square table of true/false values, with rows and columns labelled by strings.
I want to display this as an html form with checkboxes, allow the user to tick and untick elements, then submit the form, and then I want to reconstruct the array from the form.
The subproblem ... | [
"Your second problem is impossible without remembering a state on the server. The client must and shall always be seen as unsafe. There is no sane way of getting the same strings back as you sent. The user can always hack in on some way.\nUnless you want to do this cryptographically, which I really doubt :)\nHoweve... | [
1,
1,
0
] | [] | [] | [
"python"
] | stackoverflow_0005558717_python.txt |
Q:
Retrieve output of a Python program using AJAX
test.html
{% extends 'base.html' %}
{% block extra_js %}
<script language="Javascript">
function xmlhttpPost(strURL) {
var xmlHttpReq = false;
var self = this;
// Mozilla/Safari
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest... | Retrieve output of a Python program using AJAX | test.html
{% extends 'base.html' %}
{% block extra_js %}
<script language="Javascript">
function xmlhttpPost(strURL) {
var xmlHttpReq = false;
var self = this;
// Mozilla/Safari
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
}
// IE
else if (window.ActiveXObjec... | [
"What do you expect? That the string 10 appears in the page?\nIt will not, because you have the following problems:\n\nyour web server is not configured to interpret Python programs (as it just returns the source code)\nyour python code will not write anything to standard output, and a web server, after it ended pr... | [
1
] | [] | [] | [
"ajax",
"python"
] | stackoverflow_0005569401_ajax_python.txt |
Q:
PyLab title/legend labels with multiple line of text
Is it possible to make multiple lines of text inside a title/legend label in pylab?
A:
Yes, just use the \n escape sequence inside it.
element = pylab.plot(range(100))
pylab.legend([element],[ "first line \n second line"])
| PyLab title/legend labels with multiple line of text | Is it possible to make multiple lines of text inside a title/legend label in pylab?
| [
"Yes, just use the \\n escape sequence inside it.\nelement = pylab.plot(range(100))\npylab.legend([element],[ \"first line \\n second line\"])\n\n"
] | [
17
] | [] | [] | [
"matplotlib",
"python"
] | stackoverflow_0005568288_matplotlib_python.txt |
Q:
hg convert --authors wrongUsers <-- what is the format of the file?
Related here. Instructions here guide with example:
john=John Smith <John.Smith@someplace.net>
tom=Tom Johnson <Tom.Johnson@bigcity.com>
but what does it mean? Suppose I want to replace "hh <right@gmail.com>" with "hhh <right@gmail.com>", what wo... | hg convert --authors wrongUsers <-- what is the format of the file? | Related here. Instructions here guide with example:
john=John Smith <John.Smith@someplace.net>
tom=Tom Johnson <Tom.Johnson@bigcity.com>
but what does it mean? Suppose I want to replace "hh <right@gmail.com>" with "hhh <right@gmail.com>", what would that line look like? What do the terms username, mapping and filename... | [
"The convert extension uses a literal text substitution.\nA quick experiment shows if you want to replace hh <right@gmail.com>, you simply create an author map file with these contents:\nhh <right@gmail.com> = hhh <right@gmail.com>\nThe left-hand side must be an exact match for the author you want to replace. If i... | [
7
] | [] | [] | [
"mercurial",
"python"
] | stackoverflow_0005569853_mercurial_python.txt |
Q:
How should support for alternate credential types in twisted.pb be implemented?
My project has been trying to implement a credential checker using scrypt. We've tried implementing our own credentials and checker objects, but we've had a lot of trouble getting pb to use them.
Pb seems hard-coded to use MD5 hashes o... | How should support for alternate credential types in twisted.pb be implemented? | My project has been trying to implement a credential checker using scrypt. We've tried implementing our own credentials and checker objects, but we've had a lot of trouble getting pb to use them.
Pb seems hard-coded to use MD5 hashes over the wire, which absolutely won't work in our implementation; we don't have a way ... | [
"PB isn't exactly hard-coded to use MD5 hashes over the wire; that's just the authentication protocol as it's currently implemented. You can do pretty much whatever you want by implementing your own authentication protocol - which, in PB, just means an object that you get to call some authentication methods on.\nM... | [
4,
2
] | [] | [] | [
"broker",
"credentials",
"perspective",
"python",
"twisted"
] | stackoverflow_0005440581_broker_credentials_perspective_python_twisted.txt |
Q:
Why Does My Put request fail?
Using Python 2.5 and httplib......
I am admittedly a python novice.....but this seems straight forward, why doesn't this work?
httpConn = HTTPConnection('127.0.0.1', 44789)
httpConn.request('PUT','/ShazaamMon/setmfgdata.cgi?serial=', hwSerialNum)
httpResp = httpConn.getresponse()
xml... | Why Does My Put request fail? | Using Python 2.5 and httplib......
I am admittedly a python novice.....but this seems straight forward, why doesn't this work?
httpConn = HTTPConnection('127.0.0.1', 44789)
httpConn.request('PUT','/ShazaamMon/setmfgdata.cgi?serial=', hwSerialNum)
httpResp = httpConn.getresponse()
xmlResp = httpResp.read()
httpConn.cl... | [
"I think you should replace PUT with GET.\nYou should consider sanitizing the input, trye\nhttpConn.request('GET','/ShazaamMon/setmfgdata.cgi?serial=%s' % (urllib.quote(hwSerialNum)))\n\n",
"HTTP 404 means that the resource you requested does not exist. Are you sure that the URL is correct?\nMoreover, you put in ... | [
2,
1,
0
] | [] | [] | [
"http",
"http_put",
"python"
] | stackoverflow_0005567988_http_http_put_python.txt |
Q:
Python: Ensuring my class gets pickled only with the latest protocol
I'm developing a class which can be meaningfully pickled only using protocol 2 (and upwards on Python 3.) When an older protocol is used, hard-to-trace bugs happen. I want to save the users of the class some debugging pain, so I want the class to... | Python: Ensuring my class gets pickled only with the latest protocol | I'm developing a class which can be meaningfully pickled only using protocol 2 (and upwards on Python 3.) When an older protocol is used, hard-to-trace bugs happen. I want to save the users of the class some debugging pain, so I want the class to immediately raise an exception if it's being pickled with a protocol of l... | [
"You can implement the __reduce_ex__() method on your class. It receives one parameter, which is the protocol version. Simply raise an exception if the version is not 2.\n"
] | [
2
] | [] | [] | [
"pickle",
"python"
] | stackoverflow_0005570680_pickle_python.txt |
Q:
unpacking a tuple with print
the second unpacking is not working with print, what is the reason?
for a in stok.iteritems():
... c, b = a
... print c, b
this one is valid
but this one is not
for a in stok.iteritems():
... print c, b = a
A:
You can't do an assignment (a = b) inside a print statement. They're b... | unpacking a tuple with print | the second unpacking is not working with print, what is the reason?
for a in stok.iteritems():
... c, b = a
... print c, b
this one is valid
but this one is not
for a in stok.iteritems():
... print c, b = a
| [
"You can't do an assignment (a = b) inside a print statement. They're both statements, so they have to be done separately.\nIf it helps, you can do: for c, b in stok.iteritems():.\n",
"The reason is that c, b = a is a statement and not an expression (i.e., it does something, but doesn't have a value) and therefor... | [
6,
2,
1,
0
] | [] | [] | [
"python"
] | stackoverflow_0005570787_python.txt |
Q:
Patching Python packages, installed as dependencies with Pip
I have a Python project, which can be installed using Pip. Along with installing the project, Pip downloads and installs some Python packages as dependencies. There's py-amqplib among them. To achieve the desired functionality I need to apply a patch to ... | Patching Python packages, installed as dependencies with Pip | I have a Python project, which can be installed using Pip. Along with installing the project, Pip downloads and installs some Python packages as dependencies. There's py-amqplib among them. To achieve the desired functionality I need to apply a patch to py-amqplib after its installation. Is there any way to do it autom... | [
"You could fork the project (there seems to be a py-amqplib-repo on github) and apply your patches.\nIf your patch gets integrated upstream, fine.\nIf not, you can still use pip to install your patched fork directly:\n http://www.pip-installer.org/en/latest/logic.html\n"
] | [
4
] | [] | [] | [
"pip",
"python"
] | stackoverflow_0005570666_pip_python.txt |
Q:
Python url title problem
import lxml.html, sys
for arg in sys.argv:
url2 = arg
t = lxml.html.parse(url2)
if arg == "":
url = raw_input("Website URL: ")
t = lxml.html.parse(url)
print t.find(".//title").text
Problem is with [if arg == "":]
I want to have something like "if there is no arg, then:", ... | Python url title problem | import lxml.html, sys
for arg in sys.argv:
url2 = arg
t = lxml.html.parse(url2)
if arg == "":
url = raw_input("Website URL: ")
t = lxml.html.parse(url)
print t.find(".//title").text
Problem is with [if arg == "":]
I want to have something like "if there is no arg, then:", but I don't know how.
How can ... | [
"Try this:\nif len(sys.argv) == 1:\n print 'no arg'\n\nEdit: There is one more issue in your code:\nfor arg in sys.argv:\n ...\n\nShould be:\nfor arg in sys.argv[1:]:\n ...\n\nsince the first argument is the python file name itself\n"
] | [
2
] | [] | [] | [
"python"
] | stackoverflow_0005570981_python.txt |
Q:
Python Not Enabled In Vim
I am trying to get the Xdebug vim plugin to work which depends on python. Here is my environment: Windows 7 Professional 64bit, Vim 7.3. I got everything set up for this plugin, but when I hit F5 nothing happens. I found some blogs describing some additional steps to get this working on W... | Python Not Enabled In Vim | I am trying to get the Xdebug vim plugin to work which depends on python. Here is my environment: Windows 7 Professional 64bit, Vim 7.3. I got everything set up for this plugin, but when I hit F5 nothing happens. I found some blogs describing some additional steps to get this working on Windows. All of them stressed ma... | [
"I made the following changes, and now python is working (The conditional echo statement is never reached). I uninstalled Vim and re-installed it. I uninstalled the 64 bit versions of Python 2.7.1 and 3.1.3. I installed the 32 bit version of python 2.7.1.\nI am guessing the change that made the difference is using ... | [
6,
1
] | [] | [] | [
"python",
"vim",
"vim_plugin",
"xdebug"
] | stackoverflow_0005560490_python_vim_vim_plugin_xdebug.txt |
Q:
Using Regular Expressions to Import a Large Amount of Data
I need to import a large amount of building codes from a text file to a SQL database. So far I have written the following code which successfully returns the code number and title. How can I match the text after a code's title to the beginning of the ne... | Using Regular Expressions to Import a Large Amount of Data | I need to import a large amount of building codes from a text file to a SQL database. So far I have written the following code which successfully returns the code number and title. How can I match the text after a code's title to the beginning of the next code?
Test.txt:
101.1 Title. This is an example code.
101.... | [
"Use re.split instead of re.findall. In your case:\n>>> re.split('(\\d{3,4}.[\\d.]+?){1}\\s([\\w\\s]+[.]){1}',text)\n\n['', '101.1', 'Title.', ' This is an example code.\\n\\n', '101.1.2', 'Local Fees.', ' The local jurisdiction may charge fees for building permit violations per Section 300.1.\\n']\n\n",
"It look... | [
3,
0,
0,
0
] | [] | [] | [
"python",
"regex"
] | stackoverflow_0005570011_python_regex.txt |
Q:
How do I store a fetched entity in memcache for App Engine?
Because each new request in App Engine creates a new Handler, the entity I'd like to alter and put (using POST) has to be retrieved again. This seems wasteful, since I've populated the form with the information from GET a moment earlier.
How do I store a... | How do I store a fetched entity in memcache for App Engine? | Because each new request in App Engine creates a new Handler, the entity I'd like to alter and put (using POST) has to be retrieved again. This seems wasteful, since I've populated the form with the information from GET a moment earlier.
How do I store a key, fetched entity, or key/entity pair in memcache for App Engi... | [
"From here:\ndef get_data():\n data = memcache.get(\"key\")\n if data is not None:\n return data\n else:\n data = self.query_for_data()\n memcache.add(\"key\", data, 60)\n return data\n\nMemcache will store anything that is 'pickleable'.\nYou get access to memcache with the foll... | [
3,
0
] | [] | [] | [
"google_app_engine",
"memcached",
"python",
"tipfy"
] | stackoverflow_0003392990_google_app_engine_memcached_python_tipfy.txt |
Q:
Required commandline options in Python using argparse
I have the following scenario for command line argument. If there is a particular option then there should be some other required options. For example if there is -- create then there should be --name. Also if there is --remove then there should be --id. Is it ... | Required commandline options in Python using argparse | I have the following scenario for command line argument. If there is a particular option then there should be some other required options. For example if there is -- create then there should be --name. Also if there is --remove then there should be --id. Is it possible to implement this scenario with argparse? or someo... | [
"This can be done with subcommands as long as you don't mind create and remove not being preceded with hyphens. This may make sense anyway, since those verbs are often used as actions rather than options.\n",
"Optional is implicit, required must be specified:\nhttp://docs.python.org/library/argparse.html#require... | [
8,
1
] | [] | [] | [
"argparse",
"python"
] | stackoverflow_0005571998_argparse_python.txt |
Q:
Python data structure design
The data structure should meet the following purpose:
each object is unique with certain key-value pairs
the keys and values are not predetermined and can contain any string value
querying for objects should be fast
Example:
object_123({'stupid':True, 'foo':'bar', ...})
structure.ge... | Python data structure design | The data structure should meet the following purpose:
each object is unique with certain key-value pairs
the keys and values are not predetermined and can contain any string value
querying for objects should be fast
Example:
object_123({'stupid':True, 'foo':'bar', ...})
structure.get({'stupid':True, 'foo':'bar', ...... | [
"The simplest solution I can think of is to use sorted tuple keys:\ndef key(d): return tuple(sorted(d.items()))\n\nx = {}\nx[key({'stupid':True, 'foo':'bar', ...})] = object_123\n\nx.get(key({'stupid':True, 'foo':'bar', ...})) => object_123\n\nAnother option would be to come up with your own hashing scheme for your... | [
6,
0,
0
] | [] | [] | [
"data_structures",
"python"
] | stackoverflow_0005572037_data_structures_python.txt |
Q:
In Linux, how do I compile and install code for different versions of Python?
See the title for the question. In particular, in Linux, how do I compile and install PyGTK 2.24 for different versions of Python?
Do I have to specify options and paths while using "configure, make, make install" or "setup.py?"
A:
#py... | In Linux, how do I compile and install code for different versions of Python? | See the title for the question. In particular, in Linux, how do I compile and install PyGTK 2.24 for different versions of Python?
Do I have to specify options and paths while using "configure, make, make install" or "setup.py?"
| [
"#python2.6 setup.py\n\nor\n#python2.5 setup.py\n\nwill make the difference\nEdit: for PyGTK please refer to this FAQ\n"
] | [
1
] | [] | [] | [
"compilation",
"installation",
"linux",
"pygtk",
"python"
] | stackoverflow_0005572157_compilation_installation_linux_pygtk_python.txt |
Q:
Cloning a list (definition and items) over SOAP?
Due to paranoid Sharepoint administrators we have the need clone an existing list over the SOAP API ourselves..Is there an (easy) way to accomplish this? We already have a Python based API for accessing the list items and field descriptions over SOAP - I am not sure... | Cloning a list (definition and items) over SOAP? | Due to paranoid Sharepoint administrators we have the need clone an existing list over the SOAP API ourselves..Is there an (easy) way to accomplish this? We already have a Python based API for accessing the list items and field descriptions over SOAP - I am not sure if this is enough for create a 1:1 copy ourselves...i... | [
"There is not an \"easy\" way to do this. You would have to retrieve the schema from the web service, and modify it before instantiating it somewhere else. It depends a bit on where the clone operation is destined, but you will have to change the schema in some way to some degree, regardless of the destination. ... | [
0,
0
] | [] | [] | [
"python",
"sharepoint",
"sharepoint_2010",
"soap"
] | stackoverflow_0005568942_python_sharepoint_sharepoint_2010_soap.txt |
Q:
OS independent printing with Python
I am developing an application which has to be able to print a couple of pages with Python. Now I am searching for a method to create these pages and print them. It should work on Linux and Windows. The pages contain tables, images and text.
I developed the GUI with PyGtk, but I... | OS independent printing with Python | I am developing an application which has to be able to print a couple of pages with Python. Now I am searching for a method to create these pages and print them. It should work on Linux and Windows. The pages contain tables, images and text.
I developed the GUI with PyGtk, but I think it's convenient to create an image... | [
"GTK+ has its own printing system, but if you're looking for something Python specific, check out Reportlab.\nPrinting on Linux is pretty easy with CUPS (just use lp). On Windows, there's no native PDF support though you could print the generated file using the Adobe Reader ActiveX control (here's an example of do... | [
4,
2,
1
] | [] | [] | [
"pdf",
"printing",
"pygtk",
"python"
] | stackoverflow_0005572489_pdf_printing_pygtk_python.txt |
Q:
Python - Forward IMAP Email with Attachments (imaplib, smtplib)
I'm having trouble forwarding mail with attachments. Can anyone point me in the right direction? I'm guessing it's in the Fetch statement but am unsure.
import sys
import uuid
import re
import smtplib
import email
address = ''
username = ''
password ... | Python - Forward IMAP Email with Attachments (imaplib, smtplib) | I'm having trouble forwarding mail with attachments. Can anyone point me in the right direction? I'm guessing it's in the Fetch statement but am unsure.
import sys
import uuid
import re
import smtplib
import email
address = ''
username = ''
password = ''
def checkMail():
M = imaplib.IMAP4_SSL(address)
M.login... | [
"If you want to use imaplib, why not just fetch the whole message (RFC822)? See this similar SO question:\nHow to fetch an email body using imaplib in python?\n",
"It was the fetch... adding a fetch for (BODY[]) did the trick.\n"
] | [
0,
0
] | [] | [] | [
"email",
"python"
] | stackoverflow_0005572589_email_python.txt |
Q:
Matplotlib - Contour plot with single value
I want to make a contour plot of some data, but it is possible that all values in the field at the same value. This causes an error in matplotlib, which makes sense since there really isn't a contour to be created. For example, if you run the code below, you will get a... | Matplotlib - Contour plot with single value | I want to make a contour plot of some data, but it is possible that all values in the field at the same value. This causes an error in matplotlib, which makes sense since there really isn't a contour to be created. For example, if you run the code below, you will get an error, but delete the second definition of zi a... | [
"Well, contourf handles it perfectly, it's contour that chokes.\nWhy not just do this:\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nxi = np.array([0., 0.5, 1.0])\nyi = np.array([0., 0.5, 1.0])\nzi = np.ones((3,3))\n\ntry:\n CS = plt.contour(xi, yi, zi, 15, linewidths=0.5, colors='k')\nexcept ValueErro... | [
10
] | [] | [] | [
"colorbar",
"contour",
"matplotlib",
"python"
] | stackoverflow_0005572500_colorbar_contour_matplotlib_python.txt |
Q:
Newbie App Engine Datastore question - Models and .filter()
I am currently testing GAE and I am having some trouble adapting to the datastore ...
Given the example model:
class Category(db.Model):
name = db.StringProperty()
date_time = db.DateProperty(auto_now_add=True)
class Link(db.Model):
... | Newbie App Engine Datastore question - Models and .filter() | I am currently testing GAE and I am having some trouble adapting to the datastore ...
Given the example model:
class Category(db.Model):
name = db.StringProperty()
date_time = db.DateProperty(auto_now_add=True)
class Link(db.Model):
category = db.ReferenceProperty(Category, collection_name='link... | [
"Your code is fine, just put a space between type and = \nlink = category.links.filter('type =', 'in').get()\n\n"
] | [
4
] | [] | [] | [
"google_app_engine",
"python"
] | stackoverflow_0005572523_google_app_engine_python.txt |
Q:
How to create a gsignal without parameters in pygtk
The pygtk signal documentation is pretty clear about signals creation, but I could not create a signal that doesn't take parameters.
What I want is to define (like in the example):
class MyGObjectClass(gobject.GObject):
__gsignals__ = {
"some-signal": (... | How to create a gsignal without parameters in pygtk | The pygtk signal documentation is pretty clear about signals creation, but I could not create a signal that doesn't take parameters.
What I want is to define (like in the example):
class MyGObjectClass(gobject.GObject):
__gsignals__ = {
"some-signal": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE),
}
and ... | [
"Just use an empty tuple as the third argument.\n__gsignals__ = {\n \"some-signal\": (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),\n}\n\n"
] | [
6
] | [] | [] | [
"gobject",
"pygobject",
"pygtk",
"python",
"signals"
] | stackoverflow_0005572527_gobject_pygobject_pygtk_python_signals.txt |
Q:
Converting a StringIO object to a Django ImageFile
I'm trying to take data from a StringIO (or cStringIO, more specifically) and convert it to a django.core.files.images.ImageFile.
But it doesn't work. Any by that, I mean that it fails in a multitude of ways, and Google has failed me.
So far I've got:
pi = Product... | Converting a StringIO object to a Django ImageFile | I'm trying to take data from a StringIO (or cStringIO, more specifically) and convert it to a django.core.files.images.ImageFile.
But it doesn't work. Any by that, I mean that it fails in a multitude of ways, and Google has failed me.
So far I've got:
pi = ProductImage(product=product)
image = ImageFile(image_file)
ima... | [
"Use django.core.files.base.ContentFile(image_file):\npi = ProductImage(product=product)\npi.source_image.save(image_name, ContentFile(image_file.read()))\npi.save()\n\n"
] | [
16
] | [] | [] | [
"django",
"python",
"stringio"
] | stackoverflow_0005572466_django_python_stringio.txt |
Q:
SWIG_SHARED_PTR macro with templated class
I'm using SWIG with boost shared pointers to create python extensions. My current issue is that the SWIG_SHARED_PTR macro seems to work differently with templated classes. I'll give two examples, one without templates (example), and one with templates (example2).
First ... | SWIG_SHARED_PTR macro with templated class | I'm using SWIG with boost shared pointers to create python extensions. My current issue is that the SWIG_SHARED_PTR macro seems to work differently with templated classes. I'll give two examples, one without templates (example), and one with templates (example2).
First I'll include the code, and at the end show the d... | [
"SWIG can be very touchy about the order in which objects are exposed to it, with its internal type system.\nTry moving your %template statements so that they come before your SWIG_SHARED_PTR statements.\n",
"In example2.i the lines\nSWIG_SHARED_PTR(base_int_sptr, base_int) \nSWIG_SHARED_PTR_DERIVED(derived_int_s... | [
1,
0
] | [] | [] | [
"c++",
"python",
"shared_ptr",
"swig",
"templates"
] | stackoverflow_0005559147_c++_python_shared_ptr_swig_templates.txt |
Q:
django admin site - filtering available objects for user
I have models that belong to some 'group' (Company class). I want to add users, who will also belong to a one group and should be able to edit/manage/add objects with membership in associated group.
something like:
class Company()
class Something()
compan... | django admin site - filtering available objects for user | I have models that belong to some 'group' (Company class). I want to add users, who will also belong to a one group and should be able to edit/manage/add objects with membership in associated group.
something like:
class Company()
class Something()
company = ForeignKey(Company)
user Microsoft_admin
company = Fore... | [
"hey, maybe you can do something like this \n",
"There are a few different ways to do it. The magic words that you're looking for are \"row level permissions\". Search for that and \"Django\" and you should find what you're looking for.\nBeyond a certain point though, it's easier to roll your own views. It all de... | [
3,
0,
0
] | [] | [] | [
"django",
"django_admin",
"python"
] | stackoverflow_0002908895_django_django_admin_python.txt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.