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:
Oauth2 Python Package Twitter Authentication without Entering PIN
I am trying to setup this Twitter authorization without having the user to enter the pin in our screen but I am having trouble getting the correct setup I am always directed to enter the PIN. trying to use and follow this package https://github.com/... | Oauth2 Python Package Twitter Authentication without Entering PIN | I am trying to setup this Twitter authorization without having the user to enter the pin in our screen but I am having trouble getting the correct setup I am always directed to enter the PIN. trying to use and follow this package https://github.com/simplegeo/python-oauth2
Here is my current code
env = Environment(loade... | [
"Switched packages to Tweepy and followed this example\nhttp://packages.python.org/tweepy/html/auth_tutorial.html\n"
] | [
0
] | [] | [] | [
"oauth",
"python",
"twitter",
"twitter_oauth"
] | stackoverflow_0007770922_oauth_python_twitter_twitter_oauth.txt |
Q:
Understanding raw_input function in Python
I have the following code:
age = raw_input("How old are you? ")
height = raw_input("How tall are you? ")
weight = raw_input("How much do you weigh? ")
print " So, you're %r old, %r tall and %r heavy." %(age, height, weight)
Ok so the raw_input function can standard outpu... | Understanding raw_input function in Python | I have the following code:
age = raw_input("How old are you? ")
height = raw_input("How tall are you? ")
weight = raw_input("How much do you weigh? ")
print " So, you're %r old, %r tall and %r heavy." %(age, height, weight)
Ok so the raw_input function can standard output without a trailing newline. The function then ... | [
"When you type a response to the raw_input() you finish by entering a newline. Since each character you enter is also displayed as you type, the newline shows up as well.\nIf you modified the python builtins and changed raw_input you could get it to terminate on '.' instead of '\\n'. An interaction might look like:... | [
4,
1
] | [] | [] | [
"python",
"raw_input"
] | stackoverflow_0007812028_python_raw_input.txt |
Q:
Set top QDockWidget for a bunch of tabbified QDockWidgets
H there.
Can someone please tell me how to set a tabbified QDockWidget to pop to the front (be the active dock)?
In the picture below, the "full" tab is selected and it's contents are visible but I want to set the "mouth" tab to the selected tab and have it... | Set top QDockWidget for a bunch of tabbified QDockWidgets | H there.
Can someone please tell me how to set a tabbified QDockWidget to pop to the front (be the active dock)?
In the picture below, the "full" tab is selected and it's contents are visible but I want to set the "mouth" tab to the selected tab and have its contents visible.
Code:
self.dockList = []
approvedAdded = F... | [
"A tabified dockwidget can be set as the selected tab like this:\ndockwidget.raise_()\n\nEDIT\nHere's a runnable example based on the code in the question:\nfrom PyQt4 import QtCore, QtGui\n\nclass Window(QtGui.QMainWindow):\n def __init__(self):\n QtGui.QMainWindow.__init__(self)\n self.setWindowT... | [
4
] | [] | [] | [
"pyqt",
"python",
"qdockwidget"
] | stackoverflow_0007810021_pyqt_python_qdockwidget.txt |
Q:
Python: How to add three text files into one variable and then split it into a list
I'm using Python 2.5 and trying to make a variable called total and adding three files to it. Then i compress total and convert it into hex and split it into a list of strings with maximum length of 4096 characters.
Currently I hav... | Python: How to add three text files into one variable and then split it into a list | I'm using Python 2.5 and trying to make a variable called total and adding three files to it. Then i compress total and convert it into hex and split it into a list of strings with maximum length of 4096 characters.
Currently I have a list of the files and i'm concatenating it all to total in this way
filelist = ['debu... | [
"My personal favorite is a list comprehension:\nmsglist = [ hextotal[i:i+4096] for i in range(0,len(hextotal),4096) ]\n\n",
"msglist = []\nfor start in range(0, len(hextotal), 4096):\n msglist.append(hextotal[start:start+4096])\n\nYou can slice beyond the end of something; it'll automatically just give you onl... | [
3,
2,
1,
1
] | [] | [] | [
"concatenation",
"file",
"python",
"split",
"string"
] | stackoverflow_0006480445_concatenation_file_python_split_string.txt |
Q:
Convert binary data to signed integer
I read a binary file and get an array with characters. When converting two bytes to an integer I do 256*ord(p1) + ord(p0). It works fine for positive integers but when I get a negative number it doesn't work. I know there is something with the first bit in the most significant... | Convert binary data to signed integer | I read a binary file and get an array with characters. When converting two bytes to an integer I do 256*ord(p1) + ord(p0). It works fine for positive integers but when I get a negative number it doesn't work. I know there is something with the first bit in the most significant byte but with no success.
I also understa... | [
"-2 is not correct for the values you have specified, and byte order matters. struct uses > for big-endian (most-significant byte first) and < for little-endian (least-significant byte first):\n>>> import struct\n>>> struct.pack('>h',-2)\n'\\xff\\xfe'\n>>> struct.pack('<h',-2)\n'\\xfe\\xff'\n>>> p1=chr(254) # 0xFE... | [
2,
1,
0,
0,
0,
0
] | [] | [] | [
"python"
] | stackoverflow_0007810704_python.txt |
Q:
Connect class, static or instance?
I am trying to write a class that encapsulates the logic to:
build a specific url based on another class's properties and host/port information from a config file
make a connection
parses the response
class Foo(object):
def __init__(self, a, b):
self.a = a
se... | Connect class, static or instance? | I am trying to write a class that encapsulates the logic to:
build a specific url based on another class's properties and host/port information from a config file
make a connection
parses the response
class Foo(object):
def __init__(self, a, b):
self.a = a
self.b = b
self.connect_id = None
... | [
"A single class should ideally represent a clear and cohesive set of behaviour. Sometimes it isn't always clear what the best fit is, but in your case, I would code each of your steps as a distinct class or function something like this:\ndef build_url(foo):\n # build the url from foo\n return the_url\n\ndef g... | [
1,
0
] | [] | [] | [
"class",
"oop",
"python",
"static_methods"
] | stackoverflow_0007811854_class_oop_python_static_methods.txt |
Q:
Search for a line that contains some text, replace complete line python
So I am trying to search for a certain string which for example could be:
process.control.timeout=30, but the 30 could be anything. I tried this:
for line in process:
line = line.replace("process.control.timeout", "process.control.timeout=... | Search for a line that contains some text, replace complete line python | So I am trying to search for a certain string which for example could be:
process.control.timeout=30, but the 30 could be anything. I tried this:
for line in process:
line = line.replace("process.control.timeout", "process.control.timeout=900")
outFile.write(line)
But this will bring me back process.control.ti... | [
"Without regex:\nfor line in process:\n if \"process.control.timeout\" in line:\n # You need to include a newline if you're replacing the whole line\n line = \"process.control.timeout=900\\n\" \n outFile.write(line)\n\nor \noutFile.writelines(\"process.control.timeout=900\\n\" \n ... | [
4,
1,
0
] | [] | [] | [
"python",
"regex",
"replace"
] | stackoverflow_0007812524_python_regex_replace.txt |
Q:
Python: binary/hex string conversion?
I have a string that has both binary and string characters and I would like to convert it to binary first, then to hex.
The string is as below:
<81>^Q<81>"^Q^@^[)^G ^Q^A^S^A^V^@<83>^Cd<80><99>}^@N^@^@^A^@^@^@^@^@^@^@j
How do I go about converting this string in Python so that... | Python: binary/hex string conversion? | I have a string that has both binary and string characters and I would like to convert it to binary first, then to hex.
The string is as below:
<81>^Q<81>"^Q^@^[)^G ^Q^A^S^A^V^@<83>^Cd<80><99>}^@N^@^@^A^@^@^@^@^@^@^@j
How do I go about converting this string in Python so that the output in hex format is similar to thi... | [
"You can use ord and hex like this :\n>>> s = 'some string'\n>>> hex_chars = map(hex,map(ord,s))\n>>> print hex_chars\n['0x73', '0x6f', '0x6d', '0x65', '0x20', '0x73', '0x74', '0x72', '0x69', '0x6e', '0x67']\n>>> hex_string = \"\".join(c[2:4] for c in hex_chars)\n>>> print hex_string\n736f6d6520737472696e67\n>>>\n\... | [
29,
12,
1
] | [] | [] | [
"binary",
"hex",
"python"
] | stackoverflow_0001238002_binary_hex_python.txt |
Q:
Array Assignment in numpy / : colon equivalent
I am trying to relate the python/numpy indices of two arrays with different sizes, but I cannot pass index one from the small array to the large array through a subroutine.
For example, I have two numpy arrays: a1 and a2. a1.shape = (240,33,258) and a2.shape = (240,4... | Array Assignment in numpy / : colon equivalent | I am trying to relate the python/numpy indices of two arrays with different sizes, but I cannot pass index one from the small array to the large array through a subroutine.
For example, I have two numpy arrays: a1 and a2. a1.shape = (240,33,258) and a2.shape = (240,40,33,258). I am finding indices in a1 and relating t... | [
"You should be able to use slice(None) to represent :. As in\n[index[0], slice(None), index[1], index[2]]\n\n",
"As said, : is shorthand for slice(None). You can also use np.s_[index[0],:,index[1],index[2]] as a convenience syntax for constructing slice tuples.\n"
] | [
7,
2
] | [] | [] | [
"indexing",
"numpy",
"python"
] | stackoverflow_0007813305_indexing_numpy_python.txt |
Q:
Python left multiplication of of a matrix with inverse of a sparse matrix
I'm trying to calculate an expression of the form K = P*C.T*S^-1 (implementation of a Kalman filter)
All the involved matrices are sparse, and I would of course like to avoid calculating the actual inverse.
I tried using
import scipy.sparse... | Python left multiplication of of a matrix with inverse of a sparse matrix | I'm trying to calculate an expression of the form K = P*C.T*S^-1 (implementation of a Kalman filter)
All the involved matrices are sparse, and I would of course like to avoid calculating the actual inverse.
I tried using
import scipy.sparse.linalg as spln
self.K = self.P.dot(spln.spsolve(S.T, C).T)
The problem is th... | [
"As a workaround can do\nimport numpy as np\nfrom scipy.sparse.linalg import splu\n\ndef spsolve2(a, b):\n a_lu = splu(a)\n out = np.empty((A.shape[1], b.shape[1]))\n for j in xrange(b.shape[1]):\n out[:,j] = a_lu.solve(b[:,j])\n return out\n\nself.K = self.P.dot(spsolve2(S.T, C).T)\n\nBut yes, i... | [
2
] | [] | [] | [
"linear_equation",
"numpy",
"python",
"scipy",
"sparse_matrix"
] | stackoverflow_0007767958_linear_equation_numpy_python_scipy_sparse_matrix.txt |
Q:
Python - write/ADD a new record in file with Json format
I want to add a new record at the end of my file Json, For now it contains
{
"1":
{
"coef":987,
"Term":
{
"x1":6,"x2":0,"x3":8
}
}
}
im reading this file like thi... | Python - write/ADD a new record in file with Json format | I want to add a new record at the end of my file Json, For now it contains
{
"1":
{
"coef":987,
"Term":
{
"x1":6,"x2":0,"x3":8
}
}
}
im reading this file like this :
try:
json_data=open ("/home/sage/content.txt")
... | [
"After reading the data , you can't add to the file, you need to create a new file (with the same name if you want):\n data['added_data'] = 'some data added'\n write_file = open(\"/home/sage/content.txt\", \"w\")\n write_file.write(json.dumps(data))\n\n",
"If you are using python 2.5 or newer you should use with ... | [
3,
3
] | [] | [] | [
"python",
"python_3.x",
"sage"
] | stackoverflow_0007813095_python_python_3.x_sage.txt |
Q:
Is there an SQL alternative like Python's Shelve for Android/Java?
Shelve is an ultra-simple No-SQL persistence layer which allows you to trivially persist a mapping of objects. It's a commonly used package in Python because it allows you to trivially add persistence to any application.
It's simplistic nature mea... | Is there an SQL alternative like Python's Shelve for Android/Java? | Shelve is an ultra-simple No-SQL persistence layer which allows you to trivially persist a mapping of objects. It's a commonly used package in Python because it allows you to trivially add persistence to any application.
It's simplistic nature means it's somewhat limited - but it's surprisingly useful. You can map any... | [
"You can use SharedPrefences from DataStore. It's pretty much what you need. You don't need full SQLite power for this.\n",
"You said preference to Java API answers so I probably won't get preference, but Couchbase Mobile is the best Android No-SQL I have ever come across.\nhttp://www.couchbase.org/get/couchbase-... | [
1,
1
] | [] | [] | [
"android",
"java",
"nosql",
"persistence",
"python"
] | stackoverflow_0007813892_android_java_nosql_persistence_python.txt |
Q:
PyQT Listen for SystemWide Key and mouse events
I'm trying to write an application that listens for systemwide key and mouse events matching certain patterns and responds to them.
I plan on making the application run in the background. No it is not a keylogger, it is a legit application with a good intent.
I'm pla... | PyQT Listen for SystemWide Key and mouse events | I'm trying to write an application that listens for systemwide key and mouse events matching certain patterns and responds to them.
I plan on making the application run in the background. No it is not a keylogger, it is a legit application with a good intent.
I'm planning to user PyQT or more likely PySide for this app... | [
"I think you'll almost certainly need a third party library for this.\nI have no experience of using it, but the Qxt extension library has a QxtGlobalShortcut class, and there are PyQt bindings for it the shape of pygs. Both projects seem to support all the major platforms.\nEDIT\nSorry, I didn't read your question... | [
0
] | [] | [] | [
"macos",
"pyqt",
"pyside",
"python",
"qt"
] | stackoverflow_0007812617_macos_pyqt_pyside_python_qt.txt |
Q:
Python sorting with "key" function insufficiencies
On one hand it is easy to see given a key function, one can easily implement a sort that does the same thing using a compare function. The reduction is as follows:
def compare(x,y):
return key(x) - key(y)
On the other, how do we know for sure we are not losin... | Python sorting with "key" function insufficiencies | On one hand it is easy to see given a key function, one can easily implement a sort that does the same thing using a compare function. The reduction is as follows:
def compare(x,y):
return key(x) - key(y)
On the other, how do we know for sure we are not losing potential sortings by restricting every kinds of sort ... | [
"Use functools.cmp_to_key, this will guarantee the same sorting behavior as your compare function. The source for this function can be found on Python's Sorting How To document.\n"
] | [
6
] | [] | [] | [
"comparator",
"key",
"python",
"sorting"
] | stackoverflow_0007814117_comparator_key_python_sorting.txt |
Q:
Need Help Making a "python" Program - How do i get my select menu to start the diffrent conversions when i given an input (1 or 2)
Ive been working on this tempeture converter but have been troubling conbining the two programs (Celsius to Fahrenheit) and (Fahrenheit to Celsius), i can get the display menu to print... | Need Help Making a "python" Program - How do i get my select menu to start the diffrent conversions when i given an input (1 or 2) | Ive been working on this tempeture converter but have been troubling conbining the two programs (Celsius to Fahrenheit) and (Fahrenheit to Celsius), i can get the display menu to print but cant manage to figure out how to select a converter.
# Tempeture Converter
def convert():
print 'Conversions Menu';
print '... | [
"In the select function, you have \nchoice = input('...')\n\nbut then you check \nif (input == '1'):\n ...\n\nthat second input should be choice. The same thing applies to the elif(input == '2'): statement. Again input should be replaced by choice. Or alternatively you can use raw_input with '1' and '2' as J.F. ... | [
2,
1,
1
] | [] | [] | [
"python"
] | stackoverflow_0007813916_python.txt |
Q:
Python: Inline if to print non-empty strings?
I'm trying to print out just the non-empty strings in a list. I can't seem to get the below to work, what am I doing wrong??
print item in mylist if item is not ""
A:
The following is invalid syntax: print item in mylist if item is not ""
You could perhaps achieve... | Python: Inline if to print non-empty strings? | I'm trying to print out just the non-empty strings in a list. I can't seem to get the below to work, what am I doing wrong??
print item in mylist if item is not ""
| [
"The following is invalid syntax: print item in mylist if item is not \"\"\nYou could perhaps achieve what you want using a list comprehension:\n>>> mylist = [\"foo\",\"bar\",\"\",\"baz\"]\n>>> print [item for item in mylist if item]\n['foo', 'bar', 'baz']\n\n",
"You could create a generator to grab the items in ... | [
7,
2,
1
] | [] | [] | [
"if_statement",
"python"
] | stackoverflow_0007813669_if_statement_python.txt |
Q:
Django Tastypie: How to Authenticate with API Key
I'm making an internal API with TastyPie. I have
from tastypie.authentication import ApiKeyAuthentication
class MyResource(ModelResource):
Meta:
authentication = ApiKeyAuthentication()
With Auth rules disabled, my API works great. With it on, I get a 401 (UN... | Django Tastypie: How to Authenticate with API Key | I'm making an internal API with TastyPie. I have
from tastypie.authentication import ApiKeyAuthentication
class MyResource(ModelResource):
Meta:
authentication = ApiKeyAuthentication()
With Auth rules disabled, my API works great. With it on, I get a 401 (UNAUTHORIZED) response no matter what I try.
I'm sure thi... | [
"Add the username and api_key parameters to your GET variables. Make sure that you have the\ncurl http://localhost:8000/api/v1/books/?username=issackelly\\&api_key=123456789adfljafal\n\nMake sure to follow the other instructions from teh docs when setting it up:\nApiKeyAuthentication\nAs an alternative to requirin... | [
19
] | [] | [] | [
"django",
"python",
"tastypie"
] | stackoverflow_0007814128_django_python_tastypie.txt |
Q:
Add Mongo Index Via Javascript
I want to add an index to my mongo collection outside of the interactive Mongo shell.
We're building in Python, so I could set it through MongoEngine, however, I'd greatly prefer to set the indexes directly.
Can I use db.eval() to make this happen?
A:
You can use collection_name.... | Add Mongo Index Via Javascript | I want to add an index to my mongo collection outside of the interactive Mongo shell.
We're building in Python, so I could set it through MongoEngine, however, I'd greatly prefer to set the indexes directly.
Can I use db.eval() to make this happen?
| [
"You can use collection_name.create_index API from Python.\nhttp://api.mongodb.org/python/1.11/api/pymongo/collection.html \nIf using Javascript, the problem with eval() is that it needs a write lock, and creating an index itself needs a write lock. I do not think you can use eval() for anything that needs a write ... | [
2,
0
] | [] | [] | [
"indexing",
"mongodb",
"python"
] | stackoverflow_0007814219_indexing_mongodb_python.txt |
Q:
Is it possible to use web2py language in javascript file (.js)?
I'm trying to use AJAX with web2py language but I have a problem
My code is:
javascript
$(document).ready(function(){
$(".className").click(function(){
jQuery.ajax({
type:'POST',
url:'getName',
data:{
itemName:'a'
... | Is it possible to use web2py language in javascript file (.js)? | I'm trying to use AJAX with web2py language but I have a problem
My code is:
javascript
$(document).ready(function(){
$(".className").click(function(){
jQuery.ajax({
type:'POST',
url:'getName',
data:{
itemName:'a'
},
timeout: 20000,
success: function(msg) {
... | [
"The short answer is that you can't directly extract data from the db in javascript using web2py. You have to query the db with web2py, and then use web2py to send your query data to the javascript (or more accurately since you're using ajax, use jquery/javascript to pull your query data down from web2py). Make s... | [
1
] | [] | [] | [
"python",
"web2py"
] | stackoverflow_0007794407_python_web2py.txt |
Q:
Pick a key from a dictionary python
go through a dictionary picking keys from it in a loop?
For example lets say I have the following dictionary: {'hello':'world', 'hi':'there'}. Is there a way to for loop through the dictionary and print hello, hi?
on a similar note is there a way to say myDictionary.key[1] and ... | Pick a key from a dictionary python | go through a dictionary picking keys from it in a loop?
For example lets say I have the following dictionary: {'hello':'world', 'hi':'there'}. Is there a way to for loop through the dictionary and print hello, hi?
on a similar note is there a way to say myDictionary.key[1] and that will return hi?
| [
"You can iterate over the keys of a dict with a for loop:\n>>> for key in yourdict:\n>>> print(key)\nhi\nhello\n\nIf you want them as a comma separated string you can use ', '.join.\n>>> print(', '.join(yourdict))\nhi, hello\n\n\n\non a similar note is there a way to say myDictionary.key1 and that will return hi... | [
4,
4,
2,
1,
0
] | [] | [] | [
"dictionary",
"python"
] | stackoverflow_0007811130_dictionary_python.txt |
Q:
Pyjamas + Django => CSRF confusion, 403 errors
I've got Pyjamas and Django running via Apache2 with mod_wsgi on Windows 7. I do not believe I'm getting issues from the setups of these things, though: the only thing that is not working is trying to POST information from Pyjamas-generated forms. Trying to use Pyjama... | Pyjamas + Django => CSRF confusion, 403 errors | I've got Pyjamas and Django running via Apache2 with mod_wsgi on Windows 7. I do not believe I'm getting issues from the setups of these things, though: the only thing that is not working is trying to POST information from Pyjamas-generated forms. Trying to use Pyjamas-generated forms in my application produces 403s (t... | [
"You'll need to write some JavaScript to get the CSRF token from the cookie (part of the HTTP request), then add it to the form on submit.\nLook at this answer for a starting point: Django CSRF check failing with an Ajax POST request\nThe key here is that the JavaScript can be as persistent as your Pyjamas-generate... | [
3
] | [] | [] | [
"csrf",
"django",
"json_rpc",
"pyjamas",
"python"
] | stackoverflow_0007814826_csrf_django_json_rpc_pyjamas_python.txt |
Q:
Is there a way to not wrap line when doing PyDev organize import?
PyDev's "Organize Import" will wrap the line at 80 char width like below:
from xyz import A, B, C, \
D, E, F
Is there a way to disable that wrap? or to extend the width?
I tried increasing the line width in eclipse settings, but it didn't seem to wo... | Is there a way to not wrap line when doing PyDev organize import? | PyDev's "Organize Import" will wrap the line at 80 char width like below:
from xyz import A, B, C, \
D, E, F
Is there a way to disable that wrap? or to extend the width?
I tried increasing the line width in eclipse settings, but it didn't seem to work. I think that's only specific in Java editors and not PyDev.
| [
"Yes, it's possible... the margin may be raised in window > preferences > general > editors > text editors > print margin column.\nAnd the option to break in multilines or not may be changed in window > preferences > pydev > editor > code style > imports > 'allow multiline imports...'\n",
"from xyz import (A, B, ... | [
4,
2
] | [] | [] | [
"eclipse",
"pydev",
"python"
] | stackoverflow_0007810646_eclipse_pydev_python.txt |
Q:
Python Connect Four game win function
I have most of my Python version of Connect Four coded, except for the win function and the gravity. Below is the code for determining if the game has been won yet.. It doesn't function, currently the only way the game ends is if all the spots are taken up. Any ideas?
winners ... | Python Connect Four game win function | I have most of my Python version of Connect Four coded, except for the win function and the gravity. Below is the code for determining if the game has been won yet.. It doesn't function, currently the only way the game ends is if all the spots are taken up. Any ideas?
winners = [ [1,2,3,4],[2,3,4,5],[3,4,5,6],[4,5,6,7]... | [
"I think your issue is that you are checking to see if a players moves match one of the win conditions exactly. This is possible but probably won't happen that often, for example a player might make the moves [2, 3, 1, 4] which should count as a win, but [2, 3, 1, 4] is not in winners so you will not get a match. ... | [
1
] | [] | [] | [
"python",
"tkinter"
] | stackoverflow_0007814939_python_tkinter.txt |
Q:
Can python input handle inline \n?
I am trying to write a program that will accept user input which will be a pasted block of text (including multiple newlines/carriage-returns). I'm having trouble finding info on how (if) Python can handle this. Normal behavior is for the input command to complete as soon as the ... | Can python input handle inline \n? | I am trying to write a program that will accept user input which will be a pasted block of text (including multiple newlines/carriage-returns). I'm having trouble finding info on how (if) Python can handle this. Normal behavior is for the input command to complete as soon as the first \n is encountered.
| [
"When I first saw your question I read \"input command\" as \"the command being input\", not as \"the input() function\". I'm now assuming here that you're gathering data from the command line.\nThe problem with taking input with newlines in it is: when do you stop accepting input? The following example gets around... | [
4
] | [] | [] | [
"input",
"python"
] | stackoverflow_0007814979_input_python.txt |
Q:
Speed Up Initial Execution of Python Command Line App
I've prototyped a command line application for quick note-taking using Python and argparse. Right now it basically just launches Vim and then shoves the buffer into a SQLite database.
The problem is, loading Python is slow on both of my machines (~2/3GHz Intel... | Speed Up Initial Execution of Python Command Line App | I've prototyped a command line application for quick note-taking using Python and argparse. Right now it basically just launches Vim and then shoves the buffer into a SQLite database.
The problem is, loading Python is slow on both of my machines (~2/3GHz Intel Core 2 Duos) and the most basic functionality (printing a ... | [
"You can make use of a similar technique used by the infamous \"Microsoft Office Quick Start\" or the \"Java Quick Start\" and, IIRC even the \"Adobe Fast-something\"...\nThe trick is to try and keep all the libraries of the program in the disk cache, all the time.\nYou can get it with a simple crontab command, pro... | [
2
] | [] | [] | [
"command_line",
"python"
] | stackoverflow_0007812115_command_line_python.txt |
Q:
Self in Class Demanding Argument
For some reason most instances of classes are returning Type errors saying that insufficient arguments were passed, the problem is with self.
This works fine:
class ExampleClass:
def __init__(self, some_message):
self.message = some_message
print ("New ExampleCl... | Self in Class Demanding Argument | For some reason most instances of classes are returning Type errors saying that insufficient arguments were passed, the problem is with self.
This works fine:
class ExampleClass:
def __init__(self, some_message):
self.message = some_message
print ("New ExampleClass instance created, with message:")
... | [
"You have to instantiate the class:\ntest = Test() #test is an instance of class Test\n\ninstead of\ntest = Test #test is the class Test\ntest.say() #TypeError: unbound method say() must be called with Test instance as first argum ent (got nothing instead)\n\nif you are curious you can try this:\ntest = ... | [
4,
2,
1
] | [] | [] | [
"class",
"python",
"python_3.x",
"self",
"typeerror"
] | stackoverflow_0007815182_class_python_python_3.x_self_typeerror.txt |
Q:
Python and Dynamically Extending C++ Classes
So I'm running into a problem with my custom types, functions and attributes in Python.
When I'm in Python, and I want to set an attribute on one of my custom types (for example Vector4), my code gets a NULL for the const char* attribute_name argument (and yes, I am imp... | Python and Dynamically Extending C++ Classes | So I'm running into a problem with my custom types, functions and attributes in Python.
When I'm in Python, and I want to set an attribute on one of my custom types (for example Vector4), my code gets a NULL for the const char* attribute_name argument (and yes, I am importing my module).
Oddly enough, when I hard code... | [
"The problem was in my implementation of getattro.\n"
] | [
0
] | [] | [] | [
"c++",
"embedding",
"extending",
"python"
] | stackoverflow_0007759827_c++_embedding_extending_python.txt |
Q:
GQL Query Object Memory Leak
I have a long running background process that parses a few hundred thousand lines of a CSV. I noticed that the process has a memory leak that occasionally causes the task to hit its soft memory limit and terminate. I have narrowed the section of code down to the following chunk of code... | GQL Query Object Memory Leak | I have a long running background process that parses a few hundred thousand lines of a CSV. I noticed that the process has a memory leak that occasionally causes the task to hit its soft memory limit and terminate. I have narrowed the section of code down to the following chunk of code:
class BaseModel(db.Model):
_... | [
"I'm unable to reproduce this using your refcount code and a trivial snippet below (on shell.appspot.com or a fresh app):\nfrom google.appengine.ext import db\nimport logging\nimport sys\nimport types\n\ndef get_refcounts():\n d = {}\n # collect all classes\n for m in sys.modules.values():\n for sym... | [
1
] | [] | [] | [
"google_app_engine",
"gql",
"memory_leaks",
"python"
] | stackoverflow_0007796816_google_app_engine_gql_memory_leaks_python.txt |
Q:
GAE Python 2.7, no _io module?
I can't import WebOb 1.1 with the Python 2.7 runtime, as WebOb imports io, io imports _io, which is blocked by the SDK. Is there a way to whitelist _io? It is obviously not supposed to be blacklisted.
A:
From context, it sounds like you're trying to run your app on the dev_appserve... | GAE Python 2.7, no _io module? | I can't import WebOb 1.1 with the Python 2.7 runtime, as WebOb imports io, io imports _io, which is blocked by the SDK. Is there a way to whitelist _io? It is obviously not supposed to be blacklisted.
| [
"From context, it sounds like you're trying to run your app on the dev_appserver. The dev_appserver does not yet support the Python 2.7 runtime; for now you'll have to do your development and testing on appspot.\n"
] | [
1
] | [] | [] | [
"google_app_engine",
"python",
"webob"
] | stackoverflow_0007801387_google_app_engine_python_webob.txt |
Q:
Retrieving public posts from Facebook using the Graph API
I've spent hours trying to read up on Facebook's Graph API and I am very confused, so apologies if this is a ridiculously easy one to answer.
I have an application written in Python, running on a server. What I want to do (as I have been successfully been a... | Retrieving public posts from Facebook using the Graph API | I've spent hours trying to read up on Facebook's Graph API and I am very confused, so apologies if this is a ridiculously easy one to answer.
I have an application written in Python, running on a server. What I want to do (as I have been successfully been able to do with Twitter using their Streaming API) is collect al... | [
"You can search multiple keywords, just separate them with a plus sign like:\nhttps://graph.facebook.com/search?q=detroit+san+francisco\nThis will return all posts that have 3 three words in them.\nPublic search currently does not require an access_token so you currently don't need to create an application for this... | [
1
] | [] | [] | [
"facebook_graph_api",
"python"
] | stackoverflow_0007806930_facebook_graph_api_python.txt |
Q:
Python, list dicts to json
I have a list of dicts:
for item in list:
listDicts.append(item.AsDict())
How convert listDicts to json string, using simplejson ?
Making the list each dictionary will be an object in JSON.
A:
Have you tried json.dumps(listDicts)? It comes out of the box. I'm not s... | Python, list dicts to json | I have a list of dicts:
for item in list:
listDicts.append(item.AsDict())
How convert listDicts to json string, using simplejson ?
Making the list each dictionary will be an object in JSON.
| [
"Have you tried json.dumps(listDicts)? It comes out of the box. I'm not sure what simplejson would buy you; in fact, I think they're the same thing.\n"
] | [
2
] | [] | [] | [
"python",
"simplejson"
] | stackoverflow_0007815963_python_simplejson.txt |
Q:
Overwrite getter to act differently depending on where it was called in template o not. Django
Is it posible object to know if it getter called in template or not?
Check for same global variables or any ideas?
I wanna Moddel to give field attributes wrapped in div when it is called in template.
A:
No. It is not... | Overwrite getter to act differently depending on where it was called in template o not. Django | Is it posible object to know if it getter called in template or not?
Check for same global variables or any ideas?
I wanna Moddel to give field attributes wrapped in div when it is called in template.
| [
"No. It is not possible. You could write a custom template tag like {% divwrapper model.attr %} or you could write a model method like \"html_dump_all_attrs\" that returned something. But no, your solution won't work.\n"
] | [
0
] | [] | [] | [
"django",
"python"
] | stackoverflow_0007808650_django_python.txt |
Q:
what's the trick behind python's any() function?
One of the pycon2011 talks shared this any() function trick; the explanation was that the loop is in C.
Could someone explain more about it? What is the trick behind it and is there any other use cases?
>>> import itertools, hashlib, time
>>> _md5 = hashlib.md5()
>>... | what's the trick behind python's any() function? | One of the pycon2011 talks shared this any() function trick; the explanation was that the loop is in C.
Could someone explain more about it? What is the trick behind it and is there any other use cases?
>>> import itertools, hashlib, time
>>> _md5 = hashlib.md5()
>>> def run():
... for i in itertools.repeat('foo', 10... | [
"itertools.imap creates a lazy list which contains the function to be evaluated (md5) and it's argument ('foo' string). The md5 calls are not evaluated at this point but prepared along with their arguments (I think they are called thunks). When you then pass this iterator to any function, it goes through all the... | [
4,
0
] | [] | [] | [
"performance",
"python"
] | stackoverflow_0007816008_performance_python.txt |
Q:
How to assign user input to a variable or list
Let's say that I have a line with: a = input("Enter your name and age:")
How can I make the variable "a" store each section of the input, lets say "George 25" as "George, 25" either as a standard variable or a list? All I want to do is be able to store user input as s... | How to assign user input to a variable or list | Let's say that I have a line with: a = input("Enter your name and age:")
How can I make the variable "a" store each section of the input, lets say "George 25" as "George, 25" either as a standard variable or a list? All I want to do is be able to store user input as separate elements in a list or variable so that input... | [
"How about using str.split():\nuser_input_list = input(\"Enter your name and age:\").split(' ')\n\nThis creates a list of each space-separated word in the input.\n>>> 'George 25'.split(' ')\n['George', '25']\n\nThen you can access each part as:\nuser_input_list[0] # George\nuser_input_list[1] # 25\n\nIs that what y... | [
4
] | [] | [] | [
"input",
"list",
"python",
"variables"
] | stackoverflow_0007816214_input_list_python_variables.txt |
Q:
hybrid development environment
Moving from Linux, with its clean Filesystem Hierarchy to windows, i'd like to set up one or more dedicated folders to hold compilers and their related libraries, sysfs like, something like sysfs ... i'd like to find the elegant way to do this.
I mainly develop using C/C++ java and ... | hybrid development environment | Moving from Linux, with its clean Filesystem Hierarchy to windows, i'd like to set up one or more dedicated folders to hold compilers and their related libraries, sysfs like, something like sysfs ... i'd like to find the elegant way to do this.
I mainly develop using C/C++ java and python. and even for C++ projects, m... | [
"What I've seen in the past is projects like this:\n MyProject \\\n docs \\\n source\\\n includes\\\n tests \\\n targets \\\n gcc\\\n xcode\\\n vs2008\\\n vs2010\\\n MyProject\\\n Debugx86\\\n ... | [
0,
0,
0
] | [] | [] | [
"c++",
"java",
"python",
"windows"
] | stackoverflow_0007814351_c++_java_python_windows.txt |
Q:
How do you replace all the occurrences of a certain character in a string?
I am reading a csv into a:
import csv
import collections
import pdb
import math
import urllib
def do_work():
a=get_file('c:/pythonwork/cds/cds.csv')
a=remove_chars(a)
print a[0:10]
def get_file(start_file): #opens original file, rea... | How do you replace all the occurrences of a certain character in a string? | I am reading a csv into a:
import csv
import collections
import pdb
import math
import urllib
def do_work():
a=get_file('c:/pythonwork/cds/cds.csv')
a=remove_chars(a)
print a[0:10]
def get_file(start_file): #opens original file, reads it to array
with open(start_file,'rb') as f:
data=list(csv.reader(f))
... | [
"The problem is that you are not doing anything with the result of replace. In Python strings are immutable so anything that manipulates a string returns a new string instead of modifying the original string.\nline[8] = line[8].replace(letter, \"\")\n\n",
"I would use the translate method without translation tabl... | [
120,
1,
0
] | [] | [] | [
"csv",
"python"
] | stackoverflow_0003588361_csv_python.txt |
Q:
Celery not running, no error message
We are using celery for some django task scheduling on a windows system. It has been ticking along nicely for months without issue. However today, after a restart (these happen almost daily) I am unable to get celery to run. Celerybeat starts normally, however when I run Cel... | Celery not running, no error message | We are using celery for some django task scheduling on a windows system. It has been ticking along nicely for months without issue. However today, after a restart (these happen almost daily) I am unable to get celery to run. Celerybeat starts normally, however when I run Celeryd, it starts to load but then returns t... | [
"Seems RabbitMQ needed to be restarted. I've learned much from this experience.\n"
] | [
1
] | [] | [] | [
"django_celery",
"python",
"windows"
] | stackoverflow_0007815285_django_celery_python_windows.txt |
Q:
Proper capitalization for titles in Python
I'm looking for a library that properly capitalizes a given string by assuming it is a title. I know there is string.title(), but it capitalizes every work, not just the one's that should be capitalized. Anyone know any libraries?
Examples of words that should not be capi... | Proper capitalization for titles in Python | I'm looking for a library that properly capitalizes a given string by assuming it is a title. I know there is string.title(), but it capitalizes every work, not just the one's that should be capitalized. Anyone know any libraries?
Examples of words that should not be capitalized in titles:
Propositions (in, from, etc.... | [
"The term to Google for is \"titlecase\". The first hit is the titlecase package:\n$ pip install titlecase\n...\n$ python\n...\n>>> from titlecase import titlecase\n>>> titlecase('the spam and eggs')\n'The Spam and Eggs'\n\n",
"If you want to capitolise a string but only capitolise certain words, you'll need to s... | [
19,
0
] | [] | [] | [
"python"
] | stackoverflow_0007816347_python.txt |
Q:
How do I store data in memory & be able to update it without race conditions in django?
I plan to use the session to store user preference data.
Is there a cas like API for session like this one in appengine ?
The use case: concurrent ajax calls might update the same object; thus there should no race conditions. I... | How do I store data in memory & be able to update it without race conditions in django? | I plan to use the session to store user preference data.
Is there a cas like API for session like this one in appengine ?
The use case: concurrent ajax calls might update the same object; thus there should no race conditions. I am using Django 1.3
| [
"Neither Python or Django does this for memory. Use Memcache directly, or Redis (my preferred method), or something else.\n",
"Python includes a sqlite3 module which has an in-memory option. Sqlite3 also manages concurrency, assuring atomic commits.\n"
] | [
2,
1
] | [] | [] | [
"django",
"google_app_engine",
"python"
] | stackoverflow_0007816090_django_google_app_engine_python.txt |
Q:
Why doesn't os.normpath collapse a leading double slash?
Under Unix, os.path.normpath collapses multiple slashes into single ones except when exactly two slashes appear that the start of the path. Why the exception?
To illustrate, I get the following transformations:
//double/slash/stays -> //double/slash/stays
/... | Why doesn't os.normpath collapse a leading double slash? | Under Unix, os.path.normpath collapses multiple slashes into single ones except when exactly two slashes appear that the start of the path. Why the exception?
To illustrate, I get the following transformations:
//double/slash/stays -> //double/slash/stays
/double/slash//gone// -> /double/slash/gone/
double//slash//gon... | [
"Because POSIX allows treating a path beginning with two slashes in an implementation-defined manner. In other words, //foo does not necessarily mean the same thing as /foo on all POSIX systems.\nFrom IEEE Std 1003.1:\n\nA pathname that begins with two successive slashes may be interpreted\n in an implementation-d... | [
8
] | [] | [] | [
"filepath",
"python"
] | stackoverflow_0007816818_filepath_python.txt |
Q:
What's a good temporary storage & transport format for Python?
I'm writing a script in Python that will spit out some data organized as a list of dicts:
[{'name': 'first_thing', 'color': 'blue', 'flavour': 'watermelon' },
{'name': 'second_thing', 'color': 'red' },
{'name': 'third_thing', 'color': 'blue', 'size':... | What's a good temporary storage & transport format for Python? | I'm writing a script in Python that will spit out some data organized as a list of dicts:
[{'name': 'first_thing', 'color': 'blue', 'flavour': 'watermelon' },
{'name': 'second_thing', 'color': 'red' },
{'name': 'third_thing', 'color': 'blue', 'size': 'huge!' }]
I am trying to decide on a way to store this data in a ... | [
"Pickle should work fine.\nStore the dicts directly (not in a list) to making appending easier:\n>>> from pickle import dump, load\n>>> f = open('stor.bin', 'w')\n>>> dump(dict(a=1), f)\n>>> dump(dict(b=2), f)\n>>> dump(dict(c=3), f)\n>>> f.close()\n\nIn subsequent sessions, append another dump() directly to the en... | [
2,
1,
1,
0
] | [] | [] | [
"file_io",
"python",
"storage"
] | stackoverflow_0007816113_file_io_python_storage.txt |
Q:
python: make a variable equal an operator (+,/,*,-)
is it possible to assign a variable a maths operator.
this is what I've currently got, just a sample (typed it in now, so dont worry about simple errors)
if image == "lighten":
red_channel = red_channel + 50
else: // image is darken
red_channel = red_cha... | python: make a variable equal an operator (+,/,*,-) | is it possible to assign a variable a maths operator.
this is what I've currently got, just a sample (typed it in now, so dont worry about simple errors)
if image == "lighten":
red_channel = red_channel + 50
else: // image is darken
red_channel = red_channel - 50
notice how i am repeating the exact same code... | [
"import operator\nif (image == 'lighten'):\n op = operator.add\nelse:\n op = operator.sub\n\nred_channel = op(red_channel, 50)\n\nOr, if you have a number of possible operations,\nop = {\n 'lighten':operator.add,\n 'darken':operator.sub,\n ...\n }\nred_channel = op[image](red_channel,50)\n\n",
... | [
6,
2,
1
] | [] | [] | [
"coding_style",
"python"
] | stackoverflow_0007815938_coding_style_python.txt |
Q:
How to connect "Tally ODBC" through python?
I am using Tally.ERP9, I haven't found anything about Tally ODBC connection on net. I want a python script to connect with Tally database. Can I get some links for that and some python scripts to connect tally database using Tally ODBC?
A:
Since it supports ODBC, you m... | How to connect "Tally ODBC" through python? | I am using Tally.ERP9, I haven't found anything about Tally ODBC connection on net. I want a python script to connect with Tally database. Can I get some links for that and some python scripts to connect tally database using Tally ODBC?
| [
"Since it supports ODBC, you might try pyodbc: http://pyodbc.sourceforge.net/\n"
] | [
2
] | [
"I am not aware of direct connection engine is available or not but you can have a look at this post may it will help\nSpecification for Tally SOAP API\n"
] | [
-1
] | [
"python",
"python_3.x"
] | stackoverflow_0007768598_python_python_3.x.txt |
Q:
In Sqlalchemy Strange behaviour while appending an object twice in class relationship attribute
I am facing some odd problems while learning SQLAlchemy. I am using 0.7.2 version of it. These are my test classes:
class User(Base):
__tablename__ = 'users'
id = Column('user_id',Integer,primary_ke... | In Sqlalchemy Strange behaviour while appending an object twice in class relationship attribute | I am facing some odd problems while learning SQLAlchemy. I am using 0.7.2 version of it. These are my test classes:
class User(Base):
__tablename__ = 'users'
id = Column('user_id',Integer,primary_key = True)
name = Column('user_name',String(20))
addresses = relationship("Address",b... | [
"This cannot be seen in your code, but I assume that the code that is executed twice is also executed within two different sessions. This would explain all the side effects you observe:\n\nonly one address: because second session is not aware of the first one (not commit-ed)\naddress ID is increased: this happens b... | [
0
] | [] | [] | [
"foreign_keys",
"python",
"sqlalchemy"
] | stackoverflow_0007805825_foreign_keys_python_sqlalchemy.txt |
Q:
GAE 1.5.5 local SDK fails to run with python2.7 runtime
GAE 1.5.5 looks to have some excellent, long-waited for features. However, they're not working for me yet.
I've downloaded and installed GAE 1.5.5, and am using a degenerate "AAA" app to test.
Here's roughly my app.yaml (with various changes having been made ... | GAE 1.5.5 local SDK fails to run with python2.7 runtime | GAE 1.5.5 looks to have some excellent, long-waited for features. However, they're not working for me yet.
I've downloaded and installed GAE 1.5.5, and am using a degenerate "AAA" app to test.
Here's roughly my app.yaml (with various changes having been made for testing).
app.yaml
application: AAA # mystical creation.
... | [
"I'm have the same issue but on Windows, I posted on the Google App Engine forum and here is an official response I got:\n\nThe Dev server doesn't support 2.7 yet. Currently the only way to test\n 2.7 based code is on appengine\n\n",
"You can use the 2.7 runtime with the local SDK, but just not in threadsafe mod... | [
6,
4,
1
] | [] | [] | [
"google_app_engine",
"python",
"python_2.7"
] | stackoverflow_0007740319_google_app_engine_python_python_2.7.txt |
Q:
Trigger to automatically remove EOL whitespace?
Can one write a perforce trigger to automatically remove whitespace at submission time? Preferably in python? What would that look like? Or can you not modify files as they're being submitted?
A:
To my knowledge this cannot be done, since you cannot put the modi... | Trigger to automatically remove EOL whitespace? | Can one write a perforce trigger to automatically remove whitespace at submission time? Preferably in python? What would that look like? Or can you not modify files as they're being submitted?
| [
"To my knowledge this cannot be done, since you cannot put the modified file-content back to the server. The only two trigger types that allow you to see the file-content with p4 print are change-content and change-commit. For the latter, the files are already submitted on the server and for the former, while you c... | [
0
] | [] | [] | [
"perforce",
"python",
"triggers"
] | stackoverflow_0007814485_perforce_python_triggers.txt |
Q:
Accessing USB port programmatically
I was doing some work on MSP430 series MCU.
I have designed a GUI (using wxPython). Now I want to control microcontroller with GUI, but I can't find any modules in python that can send data to the USB port so that the microcontroller can identify it.
Does there exist any module... | Accessing USB port programmatically | I was doing some work on MSP430 series MCU.
I have designed a GUI (using wxPython). Now I want to control microcontroller with GUI, but I can't find any modules in python that can send data to the USB port so that the microcontroller can identify it.
Does there exist any module that can send and receive data to/from ... | [
"libusb is what you're after. PyUSB may be worth taking a look at also.\n",
"Does the board expose a serial port over the USB? If so, I highly recommend pyserial.\n"
] | [
2,
1
] | [] | [] | [
"python",
"usb"
] | stackoverflow_0007817026_python_usb.txt |
Q:
python MemoryError in shared hosting
I was trying to deploy django on a shared webhost which is not django specific. Host offers old version of python installed, but since I have ssh access ability, I've managed to extend python installation with modules I need (including django) by installing them locally in my h... | python MemoryError in shared hosting | I was trying to deploy django on a shared webhost which is not django specific. Host offers old version of python installed, but since I have ssh access ability, I've managed to extend python installation with modules I need (including django) by installing them locally in my home folder.
Ok, so I've created django pro... | [
"When running it from the command line, you need to specify the Django parameters explicitly. Assuming you are running the script from the same folder as your settings.py is in:\nimport os, sys\nsys.path.append(os.path.dirname(os.path.abspath(__file__)))\nos.environ['DJANGO_SETTINGS_MODULE'] = 'settings'\n\n# ... r... | [
0
] | [] | [] | [
"django",
"python",
"shared_hosting",
"shared_memory"
] | stackoverflow_0007804305_django_python_shared_hosting_shared_memory.txt |
Q:
Exist a diference in use django-admin.py or manage.py
I'm learning something about Django.In some tutorials that i've read is used django-admin.py for execute commands like " syncdb, startapp and startproject", in the others tutorials is used manage.py, So exist any important diference between use django-admin.py ... | Exist a diference in use django-admin.py or manage.py | I'm learning something about Django.In some tutorials that i've read is used django-admin.py for execute commands like " syncdb, startapp and startproject", in the others tutorials is used manage.py, So exist any important diference between use django-admin.py or manage.py ?
| [
"See: django-admin.py and manage.py in Django documentation\nmanage.py is a wrapper around django-admin.py automatically created in each Django project which puts your project's package on sys.path and sets the DJANGO_SETTINGS_MODULE environment variable so that it points to your project's settings.py file.\nSo, I ... | [
6,
1,
1
] | [] | [] | [
"django",
"python"
] | stackoverflow_0007818002_django_python.txt |
Q:
Python error on building Dart on Windows
I'm trying to build Dart on Windows XP (according to the docs) but while using Python to do it, it encounters an error in the script file:
D:\Documents and settings\xxx\Mes documents\Google_Dart\dart>python tools/bui
ld.py --arch=ia32
File "tools/build.py", line 51
print "U... | Python error on building Dart on Windows | I'm trying to build Dart on Windows XP (according to the docs) but while using Python to do it, it encounters an error in the script file:
D:\Documents and settings\xxx\Mes documents\Google_Dart\dart>python tools/bui
ld.py --arch=ia32
File "tools/build.py", line 51
print "Unknown mode %s" % mode
^... | [
"Python 3 removes the print keyword and replaces it with a function by the same name. So, yes, that syntax is Python 2 only.\n"
] | [
3
] | [] | [] | [
"dart",
"python",
"windows"
] | stackoverflow_0007818138_dart_python_windows.txt |
Q:
Python variables in for loop returning TypeError
I am calling a function and need to loop through a range calling the function for each value in the range. The max value is returned by a different function (findPageCount()) than the one I am having a problem with.
For MakeRequest() I can run it with the values ha... | Python variables in for loop returning TypeError | I am calling a function and need to loop through a range calling the function for each value in the range. The max value is returned by a different function (findPageCount()) than the one I am having a problem with.
For MakeRequest() I can run it with the values hard-coded and it works just fine. When I add the for lo... | [
"Use this:\nf = open('/Users/output_test_%d.txt' % i, 'w')\n\nThe string formatter operator % works on the preceding string, so you have to put it directly behind it.\nI would recommend to reformat the whole block like this:\nwith open('/Users/output_test_%d.txt' % i, 'w') as f:\n for line in r:\n try:\n ... | [
6,
3
] | [] | [] | [
"python"
] | stackoverflow_0007818153_python.txt |
Q:
Python - Which is faster to parse Json or XML?
From my observations overall JSON is faster to Parse than XML. I have found two good question regarding this. One is asked for PHP and other is asked for JavaScript. I want to know about python, how python is efficient with them? and which is more efficient to parse.
... | Python - Which is faster to parse Json or XML? | From my observations overall JSON is faster to Parse than XML. I have found two good question regarding this. One is asked for PHP and other is asked for JavaScript. I want to know about python, how python is efficient with them? and which is more efficient to parse.
Also please help in choosing the best Python parser ... | [
"In my opinion, it does not make sense to compare XML and JSON parsing times. Choosing one format over the other depends on your use case.\nIf you only want to store primitive types as supported by JSON in a simple, human-readable format, JSON is the way to go. If you need all the power and complexity of a markup... | [
9
] | [] | [] | [
"json",
"python",
"xml",
"xml_parsing"
] | stackoverflow_0007818030_json_python_xml_xml_parsing.txt |
Q:
django-lfs product template
i'm quite new to django-lfs.
I've been playing with the code trying to build a shop that fix my needs.
I've have run into an issue that i'm not able to fix.
I need to access , from the product view (catalog/product/inline) to the category from where i have access this page.
I can see it... | django-lfs product template | i'm quite new to django-lfs.
I've been playing with the code trying to build a shop that fix my needs.
I've have run into an issue that i'm not able to fix.
I need to access , from the product view (catalog/product/inline) to the category from where i have access this page.
I can see it if y display the breadcrumbs.
... | [
"i've manage this adding a template tag...\nNot exacly what i wanted..but works fine. \n@register.inclusion_tag('tagging/lateral_menu.html', takes_context=True)\ndef lateral_menu(context): \n object = context.get(\"category\") or context.get(\"product\")\n\nif object.__class__.__name__.lower() == \"product\":\n... | [
0
] | [] | [] | [
"django",
"django_lfs",
"e_commerce",
"python"
] | stackoverflow_0007804383_django_django_lfs_e_commerce_python.txt |
Q:
custom find_module always called with 'fullname' equal to None
Im trying to implement custom find_module and load_module methods.
It seems to be called, but the find_module is always called with
both fullname and path always set to None.
I don't understand why.
Here is the program stub:
class TouchImportLoader:
... | custom find_module always called with 'fullname' equal to None | Im trying to implement custom find_module and load_module methods.
It seems to be called, but the find_module is always called with
both fullname and path always set to None.
I don't understand why.
Here is the program stub:
class TouchImportLoader:
def load_module(self, fullname):
return None
class Touch... | [
"Please, read the documentation:\n\nThe find_module() method is called at least with the absolute name of the module being imported. If the module to be imported is contained in package then the parent package’s __path__ attribute is passed in as a second argument.\n\nThe path argument is only passed for packages.\... | [
1
] | [] | [] | [
"import",
"python"
] | stackoverflow_0007816472_import_python.txt |
Q:
Print XML tag attributes using element tree
I'm using following statements to print the value of Title tag. Its working fine. But I'm also want to print <page id='...' ....... Is it possible? thanks
<mediawiki>
<siteinfo>
<sitename>Wiki</sitename>
<namespaces>
... | Print XML tag attributes using element tree | I'm using following statements to print the value of Title tag. Its working fine. But I'm also want to print <page id='...' ....... Is it possible? thanks
<mediawiki>
<siteinfo>
<sitename>Wiki</sitename>
<namespaces>
<namespace key="-2" case="first-letter">Med... | [
"You can try the following:\nimport xml.etree.cElementTree as etree\nfrom pprint import pprint\ntree = etree.parse('find_title.xml')\nfor value in tree.getiterator(tag='title'):\n print value.text\nfor value in tree.getiterator(tag='page'):\n pprint(value.attrib)\n\nIt should output something like this:\n$ py... | [
2
] | [] | [] | [
"python",
"xml_parsing"
] | stackoverflow_0007818335_python_xml_parsing.txt |
Q:
Python/Selenium: How to treat assertions/errors as True or False only for further usage in program?
I am using Python for Selenium RC and I am using the following selenium command:
self.se.get_attribute("CSS")
This command asserts when the respective CSS mentioned is not found on the webpage.
Is it possible for ... | Python/Selenium: How to treat assertions/errors as True or False only for further usage in program? | I am using Python for Selenium RC and I am using the following selenium command:
self.se.get_attribute("CSS")
This command asserts when the respective CSS mentioned is not found on the webpage.
Is it possible for me to avoid the assert from happening and instead of the assert, another command is executed (On the cond... | [
"Assign the value of the method checking if selector is present to a boolean value. Ruby code would be similar to :\nselector_present? = @driver.find_elements(:css, \"div#id_name\").length > 0\n#some other code in your test script\noverall_result = selector_present? && other_selector_present?\noverall_result.should... | [
0,
0
] | [] | [] | [
"css",
"python",
"selenium_rc"
] | stackoverflow_0007818889_css_python_selenium_rc.txt |
Q:
django/python: raw sql with multiple tables
I need to perform a raw sql on multiple tables. I then render the result set. For one table I would do:
sql = "select * from my_table"
results = my_table.objects.raw(sql)
For multiple tables I am doing:
sql = "select * from my_table, my_other_table where ...."
results ... | django/python: raw sql with multiple tables | I need to perform a raw sql on multiple tables. I then render the result set. For one table I would do:
sql = "select * from my_table"
results = my_table.objects.raw(sql)
For multiple tables I am doing:
sql = "select * from my_table, my_other_table where ...."
results = big_model.objects.raw(sql)
But, do I really ne... | [
"\nThis works. Don't know why it didn't before :( From Dennis Baker's comment: \n\nYou do NOT need to have a model with all the fields in it, you just need the first model and fields from that. You do need to have the fields with unique names and as far as I know you should use \"tablename.field as fieldname\" to m... | [
2,
0
] | [] | [] | [
"django",
"python",
"sql"
] | stackoverflow_0007794816_django_python_sql.txt |
Q:
Making a dictionary with sets and values
I have the following lists:
keys = ['god', 'hel', 'helo']
values = ['good','god', 'hell', 'hello']
I want to create a dictionary like this:
{'god':set(['god', 'good']), 'hel':'hell', 'helo': 'hello'}
where the key is determined by reducing repeated letters in the value to... | Making a dictionary with sets and values | I have the following lists:
keys = ['god', 'hel', 'helo']
values = ['good','god', 'hell', 'hello']
I want to create a dictionary like this:
{'god':set(['god', 'good']), 'hel':'hell', 'helo': 'hello'}
where the key is determined by reducing repeated letters in the value to a single letter.
How would I do this programm... | [
"\"all repeated letters are reduced to single letters\"\nActually according to this rule you don't need the keys list, because it will be created from the values.\nAlso I would suggest to use a dict of sets for all values, also for the single ones, such as \"hell\" and \"hello\". It will make the usage of the dicti... | [
3,
1,
0
] | [] | [] | [
"dictionary",
"python"
] | stackoverflow_0007817709_dictionary_python.txt |
Q:
Memory error when dealing with huge data
I would like to draw histogram using matplotlib. However, due to the huge data(a list containing about 100,000 numbers) I sent to the hist() function, error will arise when draw two figures. But it goes smoothly while only drawing either of the two plots. Could anyone help ... | Memory error when dealing with huge data | I would like to draw histogram using matplotlib. However, due to the huge data(a list containing about 100,000 numbers) I sent to the hist() function, error will arise when draw two figures. But it goes smoothly while only drawing either of the two plots. Could anyone help me to deal with this? Thanks in advance.
Here ... | [
"As others have noted, six million bins doesn't sound very useful. But a simple thing would be to reuse the same figure: since the only plot elements that change are things other than the histograms, try something like this:\nvline1 = plt.axvline(...)\nvline2 = plt.axvline(...)\nlgd = legend()\n\nand after the save... | [
3,
0
] | [] | [] | [
"matplotlib",
"python"
] | stackoverflow_0007785958_matplotlib_python.txt |
Q:
Reading XML file tags
I want to read the tag values like <title>,<title_id> from xml file. The value of <title> read successfully. Is it possible to read the <title>,<title_id> with same loop?
Please help me I'm new to XML.
<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.5/" xmlns:xsi="http://www.... | Reading XML file tags | I want to read the tag values like <title>,<title_id> from xml file. The value of <title> read successfully. Is it possible to read the <title>,<title_id> with same loop?
Please help me I'm new to XML.
<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.5/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-insta... | [
"If you are going to be working with XML a lot, I'd suggest you familiarise yourself with XPATH.\nHere's a quick snippet using my XML library of preference, lxml.\nfrom lxml import etree\n\ndoc = etree.XML(\"\"\"\n<mediawiki xmlns=\"http://www.mediawiki.org/xml/export-0.5/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSc... | [
1
] | [] | [] | [
"python",
"wikimedia_dumps",
"xml"
] | stackoverflow_0007819655_python_wikimedia_dumps_xml.txt |
Q:
How to convert a strictly sorted list of strings into dict?
I have a strictly sorted list of strings:
['a',
'b',
'b/c',
'b/d',
'e',
'f',
'f/g',
'f/h',
'f/h/i',
'f/h/i/j']
This list is similar to tree representation. So, I need to convert it to dict:
{'a': {},
'b': {'c': {},
'd': {}},
'e': {},
'... | How to convert a strictly sorted list of strings into dict? | I have a strictly sorted list of strings:
['a',
'b',
'b/c',
'b/d',
'e',
'f',
'f/g',
'f/h',
'f/h/i',
'f/h/i/j']
This list is similar to tree representation. So, I need to convert it to dict:
{'a': {},
'b': {'c': {},
'd': {}},
'e': {},
'f': {'g': {},
'h': {'i': {'j': {}}}}}
As you can see, key... | [
"If you don't insist on None as the leaf value, you can use the compact code\nmy_dict = lambda: defaultdict(my_dict)\nd = my_dict()\nfor x in my_list:\n reduce(defaultdict.__getitem__, x.split(\"/\"), d)\n\nAdmittedly, it isn't that obvious what this code does, but it's succinct :)\n",
"di = {}\nfor a in arr:\... | [
8,
5,
0,
0,
0
] | [] | [] | [
"dictionary",
"list",
"python",
"string",
"tree"
] | stackoverflow_0007818245_dictionary_list_python_string_tree.txt |
Q:
Why are there no simple, cross-platform, C/C++ GUI tookits for higher level languages?
I have a little programming experience and I did get to work with Swing (Java) and wxPython.
Some years ago, I ended up having to port an app I did to OS X and all the problems I've had with wxPython just multiplied. I've start... | Why are there no simple, cross-platform, C/C++ GUI tookits for higher level languages? | I have a little programming experience and I did get to work with Swing (Java) and wxPython.
Some years ago, I ended up having to port an app I did to OS X and all the problems I've had with wxPython just multiplied. I've started looking at alternatives and I could not find anything better than wxPython. QT was the on... | [
"Have you tried Qt? It is a cross platform C++ GUI toolkit for higher level language (PyQt). And it seemed very simple to me.\n",
"What you ask is a simple lib with enormous flexibility. Be able to build 3 * 3 executables, having good documentation and using other libraries all with a different background. And al... | [
5,
2,
0,
0,
0,
0
] | [] | [] | [
"python",
"user_interface"
] | stackoverflow_0005067578_python_user_interface.txt |
Q:
Python logging: different behavior between using fileconfig and programmatic config
I just discovered a different behavior of Python logging, depending on if I use logging with fileconfig and logging with programmatic config.
To demonstrate, I created two minimal examples.
In the first example I'm configuring log... | Python logging: different behavior between using fileconfig and programmatic config | I just discovered a different behavior of Python logging, depending on if I use logging with fileconfig and logging with programmatic config.
To demonstrate, I created two minimal examples.
In the first example I'm configuring logging programmatically. This example works as expected - the debug log message is printed ... | [
"Since fileConfig disables existing loggers by default, call\nlogging.config.fileConfig(\"logging.cfg\")\n\nbefore \nfrom foo import Foo\n\nor call\nlogging.config.fileConfig(\"logging.cfg\",disable_existing_loggers=0)\n\n"
] | [
6
] | [] | [] | [
"logging",
"python"
] | stackoverflow_0007819718_logging_python.txt |
Q:
How to solve import errors while trying to deploy Flask using WSGI on Apache2
I am having an issue deploying a flask app on apache2 using wsgi. I have posted the error logs and config files below. I have tried moving things around, renaming them, etc, but all give me an internal server error. Not sure why I'm gett... | How to solve import errors while trying to deploy Flask using WSGI on Apache2 | I am having an issue deploying a flask app on apache2 using wsgi. I have posted the error logs and config files below. I have tried moving things around, renaming them, etc, but all give me an internal server error. Not sure why I'm getting the import error. Any input / suggestions are appreciated, thanks!
Here is my a... | [
"Thanks to zarf and damjan on irc.freenode.org at #pocoo, they were able to help me get this fixed. The problem was the PythonPath was not correct. We fixed this by using the following wsgi.py\nimport sys\nsys.path.insert(0, \"/sites/flaskfirst\")\n\nfrom app import app\napplication = app\n\n",
"I used your solut... | [
32,
4
] | [] | [] | [
"apache",
"flask",
"python",
"wsgi"
] | stackoverflow_0003696606_apache_flask_python_wsgi.txt |
Q:
Running IPython after changing the filename of python.exe
If I rename the python interpreter from C:\Python27\python.exe to C:\Python27\python27.exe and run it, it will not complain.
But if I now try to run C:\Python27\Scripts\ipython.exe, it will fail to start because now the python interpreter has a different fi... | Running IPython after changing the filename of python.exe | If I rename the python interpreter from C:\Python27\python.exe to C:\Python27\python27.exe and run it, it will not complain.
But if I now try to run C:\Python27\Scripts\ipython.exe, it will fail to start because now the python interpreter has a different filename.
My question is: how do I configure IPython (ms windows)... | [
"Try to find Python in windows registry and changes path to python. After that try to reinstall ipython. \n",
"I do not know if there is a config file where you can change, but you may have to recompile Ipython and change the interpreter variables. But why do you need to rename it to python27.exe when it already ... | [
1,
0,
0,
0
] | [] | [] | [
"interpreter",
"ipython",
"python",
"windows"
] | stackoverflow_0007727017_interpreter_ipython_python_windows.txt |
Q:
Despite multiprocessing, the program is still blocked
I got an application (GUI: wxPython).
When I click on a tree item, the application will do something.
But in this time the rest of the application is blocked until the task is done.
It's ok because the execution runs in the same process.
Now I transfered the ex... | Despite multiprocessing, the program is still blocked | I got an application (GUI: wxPython).
When I click on a tree item, the application will do something.
But in this time the rest of the application is blocked until the task is done.
It's ok because the execution runs in the same process.
Now I transfered the execution in a separate process (with multiprocessing module)... | [
"Try what happens if you use p.start() instead.\n",
"You have to use thread-safe methods when running multiple processes in WxPython. How to handle this is very clearly and thoroughly explained in this Mouse vs Python blog post.\n"
] | [
2,
0
] | [] | [] | [
"multiprocessing",
"python"
] | stackoverflow_0007820716_multiprocessing_python.txt |
Q:
How to divide a list of numbers in a sine function to plot it using matplotlib in python?
i = range(0,40,1)
y = 0.1 * cos((i)/20 * pi)
The error I get is this:
TypeError: unsupported operand type(s) for /: 'list' and 'int'`
I am not sure how to remove that error. I type-casted i to int, but its a list, thus can'... | How to divide a list of numbers in a sine function to plot it using matplotlib in python? | i = range(0,40,1)
y = 0.1 * cos((i)/20 * pi)
The error I get is this:
TypeError: unsupported operand type(s) for /: 'list' and 'int'`
I am not sure how to remove that error. I type-casted i to int, but its a list, thus can't be type-casted. I am following this example. http://msenux.redwoods.edu/math/python/simple.ph... | [
"You should perhaps loop over i to get the individual values: range returns a list.\n>>> for i in range(0, 40):\n... print cos((i)/20.0 * pi)\n\nOr to get the values:\ny = [cos((i)/20.0 * pi) for i in range(0, 40)]\n\n",
"They are using pylab's arange, not simple python range. And this is the problem when imp... | [
2,
2
] | [] | [] | [
"python"
] | stackoverflow_0007821030_python.txt |
Q:
Query String with error "invalid literal for int() with base 10"
I was trying to get a Model object from datastore using the key passed from query string. It worked before that, however, recently, when I named the file from restaurantProfile.html to restaurant_profile.html. I don't know from which part went wrong ... | Query String with error "invalid literal for int() with base 10" | I was trying to get a Model object from datastore using the key passed from query string. It worked before that, however, recently, when I named the file from restaurantProfile.html to restaurant_profile.html. I don't know from which part went wrong caused the problem.
My restaurant key should contains the key. However... | [
"Problem solved by following:\n key = restaurant.key().__str__()\n result_data[key] = restaurant\n\n",
"\nCan anyone tell me what's got wrong here?\n\nit's exactly like it says: restaurant_key is a method. You can't call int() upon that; did you mean to call int() upon the result of calling restaurant_... | [
1,
0
] | [] | [] | [
"django",
"google_app_engine",
"python"
] | stackoverflow_0007157580_django_google_app_engine_python.txt |
Q:
Using class attributes as function parameters?
So I have a working sorting algorithm in Python. (Its exact contents are irrelevant to this question.) It uses a list called 'people' containing class instances, and the function is hard-coded to sort that list by a specific attribute, 'wealth'.
def my_sort(seq):
... | Using class attributes as function parameters? | So I have a working sorting algorithm in Python. (Its exact contents are irrelevant to this question.) It uses a list called 'people' containing class instances, and the function is hard-coded to sort that list by a specific attribute, 'wealth'.
def my_sort(seq):
# sorts by seq[n].wealth
...
my_sort(people)
No... | [
"You could pass the name of the attribute:\ndef my_sort2(seq, keyname):\n sort by getattr(seq[n], keyname)\n\nmy_sort2(people, 'wealth')\n\nor a getter functor:\ndef my_sort2(seq, keyfunc):\n sort by keyfunc(seq[n])\n\nmy_sort2(people, operator.attrgetter('wealth'))\n\nI prefer the latter approach as it is mo... | [
10,
1
] | [] | [] | [
"function",
"python"
] | stackoverflow_0007822249_function_python.txt |
Q:
Override specific admin css files in Django
Overriding admin templates is as easy as creating a folder admin in your templates directory and copying whatever template files you'd like to override into it. I simply want to play with the admin style sheets however, so I made a folder admin in my static files folder ... | Override specific admin css files in Django | Overriding admin templates is as easy as creating a folder admin in your templates directory and copying whatever template files you'd like to override into it. I simply want to play with the admin style sheets however, so I made a folder admin in my static files folder and put css/base.css into it. Unlike the template... | [
"What I'm doing to achieve that is to override base_site.html template like this:\n{% block blockbots %}\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/media/css/my_admin.css\" />\n{{ block.super }}\n{% endblock %}\n\nI put the CSS in blockbotsinstead of extrahead to be sure that is loaded at the end, so it wi... | [
10,
2,
0
] | [] | [] | [
"css",
"django",
"django_admin",
"python"
] | stackoverflow_0007819730_css_django_django_admin_python.txt |
Q:
String construction using OOP and Proxy pattern
I find it very interesting the way how SQLAlchemy constructing query strings, eg:
(Session.query(model.User)
.filter(model.User.age > 18)
.order_by(model.User.age)
.all())
As far as I can see, there applied some kind of Proxy Pattern. In my s... | String construction using OOP and Proxy pattern | I find it very interesting the way how SQLAlchemy constructing query strings, eg:
(Session.query(model.User)
.filter(model.User.age > 18)
.order_by(model.User.age)
.all())
As far as I can see, there applied some kind of Proxy Pattern. In my small project I need to make similar string constructi... | [
"Actually what you are looking at is not a proxy pattern but the builder pattern, and yes your implementation is IMHO is the classic one (using the Fluent interface pattern).\n",
"I don't know what SQLAlchemy does, but I would implement the interface by having the Session.query() method return a Query object with... | [
3,
1
] | [] | [] | [
"design_patterns",
"oop",
"proxy_pattern",
"python",
"sqlalchemy"
] | stackoverflow_0007822101_design_patterns_oop_proxy_pattern_python_sqlalchemy.txt |
Q:
Updated Google App Engine and now I have errors with python manage.py runserver
Yesterday before updating the Google App Engine SDK, I was able to do python manage.py runserver without any problems, but after updating the SDK this morning, I'm getting these errors when trying to do python manage.py runserver I'm n... | Updated Google App Engine and now I have errors with python manage.py runserver | Yesterday before updating the Google App Engine SDK, I was able to do python manage.py runserver without any problems, but after updating the SDK this morning, I'm getting these errors when trying to do python manage.py runserver I'm not sure what the problem is. Any ideas?
WARNING 2011-10-19 09:18:16,284 dev_appserve... | [
"Got it. All I needed to do was change the port number to a different number. I just chose 8084:\npython manage.py runserver 8084\n\n"
] | [
2
] | [] | [] | [
"django_nonrel",
"google_app_engine",
"python"
] | stackoverflow_0007822799_django_nonrel_google_app_engine_python.txt |
Q:
dynamic plotting in wxpython
I have been developing a GUI for reading continuous data from a serial port. After reading the data, some calculations are made and the results will be plotted and refreshed (aka dynamic plotting). I use the wx backend provided in the matplotlib for this purposes. To do this, I basical... | dynamic plotting in wxpython | I have been developing a GUI for reading continuous data from a serial port. After reading the data, some calculations are made and the results will be plotted and refreshed (aka dynamic plotting). I use the wx backend provided in the matplotlib for this purposes. To do this, I basically use an array to store my result... | [
"\nTo do this, I basically use an array\n to store my results, in which I keep\n appending it to\n\nTry limiting the size of this array, either by deleting old data or by deleting every n-th entry (the screen resolution will prevent all entries to be displayed anyway). I assume you write all the data to disk so y... | [
3,
1,
1,
0
] | [] | [] | [
"matplotlib",
"python",
"wxpython"
] | stackoverflow_0001181391_matplotlib_python_wxpython.txt |
Q:
How to edit Context() before it gets rendered? Django
Processor from TEMPLATE_CONTEXT_PROCESSORS is not allowed to edit context or I'm confuse?
Even if i subclass
class MyContext(Context):
def __init__(self, *args, **kwargs):
Context.__init__(self, *args, **kwargs)
Context and try to pass it to conte... | How to edit Context() before it gets rendered? Django | Processor from TEMPLATE_CONTEXT_PROCESSORS is not allowed to edit context or I'm confuse?
Even if i subclass
class MyContext(Context):
def __init__(self, *args, **kwargs):
Context.__init__(self, *args, **kwargs)
Context and try to pass it to context_instance it does not gives me acces to dictionary. It is... | [
"You can just set same variable name and it will overwrite it, check Django docs. You cannot read context inside context processor. You could probably use template tags, but they're not really meant for that. \n"
] | [
0
] | [] | [] | [
"django",
"python"
] | stackoverflow_0007823549_django_python.txt |
Q:
Box2D won't work with Python
I have installed Python 2.6.6 and Box2D 2.0.2b1. And can't create box2d world - b2World().
Simple example:
import Box2D
Box2D.b2World()
No matter what I type into function b2World, I received this error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
... | Box2D won't work with Python | I have installed Python 2.6.6 and Box2D 2.0.2b1. And can't create box2d world - b2World().
Simple example:
import Box2D
Box2D.b2World()
No matter what I type into function b2World, I received this error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
Box2D.b2World()
File "C:\Python2... | [
"Try something like:\nworld = b2World(gravity=(0,-10), doSleep=True)\n\nI had a look at the 2.0.2 version and it looks like you should pass your arguments like this:\nworldAABB=box2d.b2AABB()\nworldAABB.lowerBound = (-100.0, -100.0)\nworldAABB.upperBound = ( 100.0, 100.0)\ngravity = (0.0, -10.0)\nworld = box2d.b2Wo... | [
3
] | [] | [] | [
"box2d",
"python",
"traceback"
] | stackoverflow_0007823893_box2d_python_traceback.txt |
Q:
Searching and deleting the Data in python
I have two files which have a list of sites in them. The master file is called A.txt and the processed file is called B.txt
Contents of A.txt
www.cnn.com
www.google.com
www.gmail.com
www.iamvishal.com
Contents of B.txt
www.cnn.com
www.google.com
I want to make a python s... | Searching and deleting the Data in python | I have two files which have a list of sites in them. The master file is called A.txt and the processed file is called B.txt
Contents of A.txt
www.cnn.com
www.google.com
www.gmail.com
www.iamvishal.com
Contents of B.txt
www.cnn.com
www.google.com
I want to make a python script which compares or searches between the fi... | [
"Read the files into two sets and use set difference. eg:\na = set(line.strip() for line in open('a.txt', 'r'))\nb = set(line.strip() for line in open('b.txt', 'r'))\n\nnew = open('new.txt', 'w')\nnew.write('\\n'.join(a - b))\n\n",
"If the files are small, you could use sets to simplify the code:\nmaster = set(li... | [
3,
2,
2,
0
] | [] | [] | [
"python"
] | stackoverflow_0007823878_python.txt |
Q:
pyramid_formalchemy assumptions about requests
I'm using pyramid_formalchemy 0.4.1...well I'm trying to use it.
When requests come in to my app I keep seeing pyramid_formalchemy making strange assumptions about what will be in the request object. My requests fail because in pyramid_formalchemy.views (starting at ... | pyramid_formalchemy assumptions about requests | I'm using pyramid_formalchemy 0.4.1...well I'm trying to use it.
When requests come in to my app I keep seeing pyramid_formalchemy making strange assumptions about what will be in the request object. My requests fail because in pyramid_formalchemy.views (starting at line: 58) the ModelView class has a constructor with... | [
"This stuff is configurable.\nSee the source\nNot sure it's really documented..\n"
] | [
1
] | [] | [] | [
"pyramid",
"python"
] | stackoverflow_0007823941_pyramid_python.txt |
Q:
Numpy: Permanent changes to using numpy.ndarray.view?
If I wanted to change the data type of a numpy array permanently, is reassignment the best way?
Here's an example to illustrate the syntax:
import numpy as np
x = np.array([1],dtype='float')
x = x.view(dtype=('x','float"))
However, I'd prefer to change change... | Numpy: Permanent changes to using numpy.ndarray.view? | If I wanted to change the data type of a numpy array permanently, is reassignment the best way?
Here's an example to illustrate the syntax:
import numpy as np
x = np.array([1],dtype='float')
x = x.view(dtype=('x','float"))
However, I'd prefer to change change the data type "in place".
Is there any way to change the... | [
"There is no \"permanent\" dtype, really.\nNumpy arrays are basically just a way of viewing a memory buffer. \nViews, in the numpy sense, are just a different way of slicing and dicing the same memory buffer without making a copy.\nKeep in mind, though, that this is giving you low-level control over the way that t... | [
5
] | [] | [] | [
"numpy",
"python"
] | stackoverflow_0007824188_numpy_python.txt |
Q:
Improve performance when importing data to MySQL?
I'm using Django to build a website with a MySQL (MyISAM) backend.
The database data is imported from a number of XML files that an external script process and output as a JSON-file. Whenever a new JSON file differ from the old one, I need to wipe the old MySQL-db... | Improve performance when importing data to MySQL? | I'm using Django to build a website with a MySQL (MyISAM) backend.
The database data is imported from a number of XML files that an external script process and output as a JSON-file. Whenever a new JSON file differ from the old one, I need to wipe the old MySQL-db and recreate it using manage.py loaddata, (at least th... | [
"There are a couple of solutions, same decent than others, but here is a workaround to keep your system's \"downtime\" minimal, without needing to write a db synchronize mechanism (which would probably be a better solution in most times).:\n\nCreate a custom settings_build.py file, with from settings import * that ... | [
0,
0
] | [] | [] | [
"django",
"json",
"mysql",
"python",
"xml"
] | stackoverflow_0007771790_django_json_mysql_python_xml.txt |
Q:
Importing the django.test does not work
As it is failing to import django.test module, unit test does not work.
>>> import django.test
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\django\test\__init__.py", line 5, in <mod
le>
from django.test.cl... | Importing the django.test does not work | As it is failing to import django.test module, unit test does not work.
>>> import django.test
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\django\test\__init__.py", line 5, in <mod
le>
from django.test.client import Client, RequestFactory
File "C:... | [
"The solution explained here:\nImportError: cannot import name signals\nworked for me. \nThey added these lines to the test:\nfrom django.core import management;\nimport myapp.settings as settings;\nmanagement.setup_environ(settings)\n\n"
] | [
0
] | [] | [] | [
"django",
"django_unittest",
"python"
] | stackoverflow_0006854662_django_django_unittest_python.txt |
Q:
Connecting Excel with Python
Using code below, I can get the data to print.
How would switch code to xlrd?
How would modify this code to use a xls file that is already open and visible.
So, file is open first manually, then script runs.
And, gets updated.
and then get pushed into Mysql
import os
from win32co... | Connecting Excel with Python | Using code below, I can get the data to print.
How would switch code to xlrd?
How would modify this code to use a xls file that is already open and visible.
So, file is open first manually, then script runs.
And, gets updated.
and then get pushed into Mysql
import os
from win32com.client import constants, Dispatc... | [
"If you mean that you want to modify the current file, I'm 99% sure that is not possible and 100% sure that it is a bad idea. In order to alter a file, you need to have write permissions. Excel creates a file lock to prevent asynchronous and simultaneous editing. If a file is open in Excel, then the only thing whic... | [
1,
0
] | [] | [] | [
"excel",
"python",
"xlrd"
] | stackoverflow_0006948482_excel_python_xlrd.txt |
Q:
What would be the best way to use python's functions from excel?
Somebody really needs to fix this "subjective questions evaluator"
I usually compile my functions in a DLL and call them from excel. That works fine (well, let's just say it works)
Unfortunatelly, python cannot be compiled. I know of py2exe but I don... | What would be the best way to use python's functions from excel? | Somebody really needs to fix this "subjective questions evaluator"
I usually compile my functions in a DLL and call them from excel. That works fine (well, let's just say it works)
Unfortunatelly, python cannot be compiled. I know of py2exe but I don't know that it can make a DLL.
So, ..., is there any other way ? I ap... | [
"One way is to write a COM server in Python, and call that from Excel. There are tutorials describing Win32 COM servers, and screencasts on calling such servers from Excel.\n",
"This is probably not a possible solution for you, but there is the Resolver One spreadsheet application (which is like Excel combined wi... | [
7,
4,
4,
0,
0,
0
] | [] | [] | [
"excel",
"python"
] | stackoverflow_0001322787_excel_python.txt |
Q:
Error while sending a filename as a parameter to a function module in python. How to solve?
#This code does the checking of the function input.
import re
import sys
def pyexam(file_name):
fp = open(file_name)
testCaseInput = open('input.txt','r')
testCaseOutput = open('output.txt','r')
eval(com... | Error while sending a filename as a parameter to a function module in python. How to solve? | #This code does the checking of the function input.
import re
import sys
def pyexam(file_name):
fp = open(file_name)
testCaseInput = open('input.txt','r')
testCaseOutput = open('output.txt','r')
eval(compile(fp.read(),'prob.txt','exec'))
if add(int(testCaseInput.read())) == int(testCaseOutput.r... | [
"Use exec instead of eval. \nThe eval() function is for evaluating expressions and returning (not assigning) a result:\n>>> x = eval('3+5')\n>>> x\n>>> 8\n\nThe exec statement executes statements including assignments:\n>>> exec 'y = 3 + 5'\n>>> y\n>>> 8\n\nSee http://docs.python.org/reference/simple_stmts.html#th... | [
2
] | [] | [] | [
"python"
] | stackoverflow_0007824592_python.txt |
Q:
Is there a good reference list for the names of the genericsetup import steps
Is there a comprehensive reference list of the generic setup import step names?
The names of generic setup import steps don't always match the names of their corresponding xml files for example 'types.xml' has an import step called 'type... | Is there a good reference list for the names of the genericsetup import steps | Is there a comprehensive reference list of the generic setup import step names?
The names of generic setup import steps don't always match the names of their corresponding xml files for example 'types.xml' has an import step called 'typeinfo'.
In the absence of a list, I would be satisfied with a simple approach to fin... | [
"You should try this:\nstepregistry = portal.portal_setup.getImportStepRegistry()\nstepregistry.listSteps()\n\nedit:\nactually this will give you the complete list (I've tested it this time):\n>>> portal.portal_setup.getSortedImportSteps()\n(u'PloneSurvey_various', u'rolemap', u'sharing', u'plone-difftool',...\n\n.... | [
8,
2
] | [] | [] | [
"genericsetup",
"plone",
"python"
] | stackoverflow_0007821498_genericsetup_plone_python.txt |
Q:
Accessing returned dict's key, while resolved to value as expected, triggers KeyError?
I have a function that generates and returns a _GET dictionary containing the query key/value pairs of an URI's query field. Assuming the URI is http://127.0.0.1/path/to/query?foo=bar&bar=foo, the function is used like this insi... | Accessing returned dict's key, while resolved to value as expected, triggers KeyError? | I have a function that generates and returns a _GET dictionary containing the query key/value pairs of an URI's query field. Assuming the URI is http://127.0.0.1/path/to/query?foo=bar&bar=foo, the function is used like this inside a derived BaseHTTPServer.BaseHTTPRequestHandler with noted KeyError:
class HTTPHandler(Ba... | [
"I don't know what your query_parse function do but there is already a function that do that which is urlparse.parse_qs:\n>>> query = urlparse.urlparse('http://127.0.0.1/path/to/query?foo=bar&bar=foo').query\n>>> urlparse.parse_qs(query)\n{'bar': ['foo'], 'foo': ['bar']}\n\nOr if you don't like the value of the dic... | [
1,
0
] | [] | [] | [
"basehttprequesthandler",
"python"
] | stackoverflow_0007824702_basehttprequesthandler_python.txt |
Q:
Generating Python soaplib stubs from WSDL
I'd like to generate a stub SOAP web service class using the Python soaplib module, based on an existing WSDL. The idea is to generate a mock for a third party web service.
Does any such code generator exist, or must we write our own?
Martin
A:
Okay, I had a go at hackin... | Generating Python soaplib stubs from WSDL | I'd like to generate a stub SOAP web service class using the Python soaplib module, based on an existing WSDL. The idea is to generate a mock for a third party web service.
Does any such code generator exist, or must we write our own?
Martin
| [
"Okay, I had a go at hacking my wsdl2interface (http://pypi.python.org/pypi/wsdl2interface) script to output soaplib code. I think I have something that works, though it's not pretty or especially well tested.\nI'll paste it here for the record. I could be persuaded to release it if someone needs it, though it's no... | [
9,
1
] | [] | [] | [
"python",
"soap"
] | stackoverflow_0003083186_python_soap.txt |
Q:
python 2.6 bisect_right returning index instead of index to the right (index+1)
I am using bisect_right() to search in a txt file.
Each line in the text file contains the following string "word1 word2 (tab) number" . That is, two words separeted by a blank (word1 and word2), a tab and a number.
I read the file as... | python 2.6 bisect_right returning index instead of index to the right (index+1) | I am using bisect_right() to search in a txt file.
Each line in the text file contains the following string "word1 word2 (tab) number" . That is, two words separeted by a blank (word1 and word2), a tab and a number.
I read the file as a list with readlines().
I am using the bisect_right with the parameter "word1 word2... | [
"Searches using bisect module return an \"insertion point\", not an index. An insertion point is the location between two values. It is intended to be used like this s.insert(i, 'new value').\nInstead of insertion points, you want to search for the index of values in the sequence. The examples in the docs to sho... | [
1
] | [] | [] | [
"python",
"python_2.6"
] | stackoverflow_0007824231_python_python_2.6.txt |
Q:
Can I create a panel-like thing on Windows with Python?
Sorry for the vague title, couldn't come up with anything more informative %)
What I want is a 5px horizontal panel on the top of the screen that I can draw on (and, possible, handle clicks on too).
One of the following features would be awesome (although I u... | Can I create a panel-like thing on Windows with Python? | Sorry for the vague title, couldn't come up with anything more informative %)
What I want is a 5px horizontal panel on the top of the screen that I can draw on (and, possible, handle clicks on too).
One of the following features would be awesome (although I understand it's probably not really possible to combine both o... | [
"Yes, it's possible. The \"how\" part depends on the GUI library you choose for which there are many options, but most people will recommend the following two: wxPython or PySide which is Qt for Python.\nPySide has good documentation and tutorials.\nWhat you will want to do is create a QMainWindow instance and set ... | [
0
] | [] | [] | [
"python",
"pywin32",
"winapi",
"windows"
] | stackoverflow_0007825395_python_pywin32_winapi_windows.txt |
Q:
How do I get a list of every possible combination of product prices to reach a target cost?
Suppose I have a list of three products (A, B C). Each Product has a price. Given a total cost, I want to find all the possible product combinations to equal exactly that cost.
So far I've tried stuff like:
for price in pro... | How do I get a list of every possible combination of product prices to reach a target cost? | Suppose I have a list of three products (A, B C). Each Product has a price. Given a total cost, I want to find all the possible product combinations to equal exactly that cost.
So far I've tried stuff like:
for price in product:
ret = []
for i in range(int(totalCost / price), -1, -1):
ret.append(i)
... | [
"def possibilities(available_products, target_price):\n if target_price == 0 or not available_products:\n return []\n this_price = available_products[0]\n remaining_products = available_products[1:]\n results = []\n for qty in range(1 + target_price / this_price):\n remaining_price = ta... | [
6,
3
] | [] | [] | [
"algorithm",
"iteration",
"python",
"recursion"
] | stackoverflow_0007825323_algorithm_iteration_python_recursion.txt |
Q:
Parsing XML file etree module
I'm reading XML file using Etree module. Im using following code to print the value of <page> and <title> tags. My code working fine. But I want little change. If the <page id='...'> attribute id is exists then print the value of tag. Is it possible? thanks
import xml.etree.cElement... | Parsing XML file etree module | I'm reading XML file using Etree module. Im using following code to print the value of <page> and <title> tags. My code working fine. But I want little change. If the <page id='...'> attribute id is exists then print the value of tag. Is it possible? thanks
import xml.etree.cElementTree as etree
from pprint import pp... | [
"for el in tree.getiterator(tag='page'):\n page_id = el.get('id', None) # returns second arg if id not exists\n if page_id:\n print page_id, el.find('title').text\n else:\n pprint(el.attrib)\n\nEdit: Updated for commment: \"Thanks can i print page_id and title at same time? Means 31239628 - ... | [
1,
1
] | [] | [] | [
"python",
"xml"
] | stackoverflow_0007825361_python_xml.txt |
Q:
Python Django raw sql iteration leads to TypeError
I am having some problems with processing my form in python django when using raw sql querying. I used https://docs.djangoproject.com/en/dev/topics/db/sql/ for reference. I am getting errors when trying to iterate over the RawQuerySet that is returned from the raw... | Python Django raw sql iteration leads to TypeError | I am having some problems with processing my form in python django when using raw sql querying. I used https://docs.djangoproject.com/en/dev/topics/db/sql/ for reference. I am getting errors when trying to iterate over the RawQuerySet that is returned from the raw sql query. Any help would be appreciated. Here is part ... | [
"Never, ever, ever, ever, ever build up SQL parameters like that. In fact, that's so important, I'm going to say it again: never, ever, ever, ever, ever, ever, build up SQL parameters like that. You've left yourself wide open to an SQL injection attack: what happens if someone submits \"foo'; DELETE FROM pr;\" into... | [
2,
0
] | [] | [] | [
"django",
"django_models",
"django_views",
"python",
"sql"
] | stackoverflow_0007825581_django_django_models_django_views_python_sql.txt |
Q:
Python logging.info() not logging the message
parser_logger = logging.getLogger("CSHEL_parserlogger");
#logging.basicConfig()
parser_logger.addHandler(RotatingFileHandler(
"logfile", mode='a', maxBytes=7340032, backupCount=4,
encoding=None, delay=False))
#d ... | Python logging.info() not logging the message | parser_logger = logging.getLogger("CSHEL_parserlogger");
#logging.basicConfig()
parser_logger.addHandler(RotatingFileHandler(
"logfile", mode='a', maxBytes=7340032, backupCount=4,
encoding=None, delay=False))
#d = { 'clientip' : '192.168.0.1', 'user' : 'fbloggs' ... | [
"You need to set the threshold level of the logger:\nparser_logger.setLevel(logging.INFO)\n\nWhen a logger is created, the level is set to NOTSET, and the root logger is created with level WARNING. See the documentation.\n"
] | [
24
] | [] | [] | [
"logging",
"python"
] | stackoverflow_0007825905_logging_python.txt |
Q:
How do I 'down grade' to python2.7
Being quite cavalier I went for the latest version of Python (3.2.2)
Unfortunately it lacks the matplotlib that I desperately need.
I have downloaded python 2.7.
My simple question is weather I have to uninstall python3.2 or can I leave it on my windows 64 system?
A:
you ca... | How do I 'down grade' to python2.7 | Being quite cavalier I went for the latest version of Python (3.2.2)
Unfortunately it lacks the matplotlib that I desperately need.
I have downloaded python 2.7.
My simple question is weather I have to uninstall python3.2 or can I leave it on my windows 64 system?
| [
"you can keep the python 3.2 installation, but you will have to be carefull about which version you launch (by making the call explicit). you can always check the python version in a script by doing:\nimport sys\nprint sys.version\n\nIf you have no particular use of python 3.2, I recommend uninstalling it.\n",
"I... | [
3,
0
] | [] | [] | [
"matplotlib",
"python",
"windows"
] | stackoverflow_0007824386_matplotlib_python_windows.txt |
Q:
Python global threading.condition() and use in multiple modules
EDIT: the problem I was experiencing was not related to the structure of my program. It was FAPWS3's routing picking a similar, closely named function.
I have a large program spread across multiple files. I need to use the threading.condition() lock... | Python global threading.condition() and use in multiple modules | EDIT: the problem I was experiencing was not related to the structure of my program. It was FAPWS3's routing picking a similar, closely named function.
I have a large program spread across multiple files. I need to use the threading.condition() locking functionality across these files. Here's an example of what I'm ... | [
"If I remember correct, when you import an module Python runs it. So I think you get a different mylock in each file.\nYou could try printing it and look at the ids.\nJeffs link posted below clears that:\n\nBecause there is only one instance of each module, any changes made to the module object get reflected everyw... | [
0
] | [] | [] | [
"module",
"multithreading",
"python"
] | stackoverflow_0007825500_module_multithreading_python.txt |
Q:
check type of object given by a string in python
I would like to ask how one determines the type of an object in python. I know how to do that "normally", e.g.,
import types
def f(x):
return x
isinstance(f, types.FunctionType)
returns true. But what, if I have only a string containing 'f', say a = 'f'. Wha... | check type of object given by a string in python | I would like to ask how one determines the type of an object in python. I know how to do that "normally", e.g.,
import types
def f(x):
return x
isinstance(f, types.FunctionType)
returns true. But what, if I have only a string containing 'f', say a = 'f'. What should I do with a? How do I figure out, whether the... | [
"You can look up the name in globals() (the global symbol table and locals() (the local symbol table):\nPython 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) \n[GCC 4.2.1 (Apple Inc. build 5646)] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> def f(x):\n... return x\n.... | [
0,
0,
0
] | [] | [] | [
"object",
"python",
"types"
] | stackoverflow_0007826169_object_python_types.txt |
Q:
Qt Widget with Transparent Background
(I'm using PySide, but I think the answer would be the same/similar for any language bindings).
I'm trying to take the shaped clock example, located here, and cause the face of the clock (circle) to be transparent so that all I see are the clock hands and minute ticks. As i... | Qt Widget with Transparent Background | (I'm using PySide, but I think the answer would be the same/similar for any language bindings).
I'm trying to take the shaped clock example, located here, and cause the face of the clock (circle) to be transparent so that all I see are the clock hands and minute ticks. As is, when the example runs, it looks like thi... | [
"Got it!\nThis is from the original example code (constructor):\n ...\n self.setWindowFlags(self.windowFlags() | QtCore.Qt.FramelessWindowHint)\n ...\n\nHere is the modified (and working per my question) version:\n ...\n self.setWindowFlags(QtCore.Qt.FramelessWindowHint)\n self.setAttribute(QtCore... | [
12,
7,
1
] | [] | [] | [
"pyside",
"python",
"qt",
"transparency"
] | stackoverflow_0007667552_pyside_python_qt_transparency.txt |
Q:
Why Java and Python garbage collection methods are different?
Python uses the reference count method to handle object life time. So an object that has no more use will be immediately destroyed.
But, in Java, the GC(garbage collector) destroys objects which are no longer used at a specific time.
Why does Java choos... | Why Java and Python garbage collection methods are different? | Python uses the reference count method to handle object life time. So an object that has no more use will be immediately destroyed.
But, in Java, the GC(garbage collector) destroys objects which are no longer used at a specific time.
Why does Java choose this strategy and what is the benefit from this?
Is this better t... | [
"There are drawbacks of using reference counting. One of the most mentioned is circular references: Suppose A references B, B references C and C references B. If A were to drop its reference to B, both B and C will still have a reference count of 1 and won't be deleted with traditional reference counting. CPython (... | [
54,
35,
17,
8,
7,
6,
4,
3,
0
] | [] | [] | [
"garbage_collection",
"java",
"python"
] | stackoverflow_0000021934_garbage_collection_java_python.txt |
Q:
How to write a batch file showing path to executable and version of Python handling Python scripts on Windows?
It should display path to executable and version of Python for scripts run with direct invocation of Python (python myscript.py) as well as for scripts run directly (myscript.py). Script should not make t... | How to write a batch file showing path to executable and version of Python handling Python scripts on Windows? | It should display path to executable and version of Python for scripts run with direct invocation of Python (python myscript.py) as well as for scripts run directly (myscript.py). Script should not make too many assumptions on the configuration of the system. For instance it should handle situation where there might be... | [
"Here's my first solution:\nSOLUTION 1\n@echo off\nset test_script=.pyexe.py\nrem Let's create temporary Python script which prints info we need\necho from __future__ import print_function; import sys; print(sys.executable); print(sys.version) > %test_script%\necho Python accessible through system PATH:\npython %te... | [
2,
2
] | [] | [] | [
"batch_file",
"command_line",
"python",
"windows"
] | stackoverflow_0007825780_batch_file_command_line_python_windows.txt |
Q:
HEAD request vs. GET request
I always had the idea that doing a HEAD request instead of a GET request was faster (no matter the size of the resource) and therefore had it advantages in certain solutions.
However, while making a HEAD request in Python (to a 5+ MB dynamic generated resource) I realized that it took ... | HEAD request vs. GET request | I always had the idea that doing a HEAD request instead of a GET request was faster (no matter the size of the resource) and therefore had it advantages in certain solutions.
However, while making a HEAD request in Python (to a 5+ MB dynamic generated resource) I realized that it took the same time as making a GET requ... | [
"The server is taking the bulk of the time, not your requester or the network. If it's a dynamic resource, it's likely that the server doesn't know all the header information - in particular, Content-Length - until it's built it. So it has to build the whole thing whether you're doing HEAD or GET.\n",
"The respon... | [
7,
1,
1
] | [] | [] | [
"head",
"http",
"pycurl",
"python",
"urllib2"
] | stackoverflow_0007826349_head_http_pycurl_python_urllib2.txt |
Q:
Best way to extract information from file
For example my file is:
Game #51236595 Tourney #123698521 Hand #9865653215
player luisgustavo call
player otherplayer fold
player otherother check
I want to get the information in best way possible.
Remember that all files are in this format. What changes are the number... | Best way to extract information from file | For example my file is:
Game #51236595 Tourney #123698521 Hand #9865653215
player luisgustavo call
player otherplayer fold
player otherother check
I want to get the information in best way possible.
Remember that all files are in this format. What changes are the numbers and players
EDIT: Ok but this is not a homewo... | [
"Try something like\nwith open('.myfile', 'r') as myfile:\n header = myfile.readline().split()\n game_number, tourney_number, hand_number = header[1], header[3], header[5]\n for line in myfile:\n player_name, player_action = line.split()[1:]\n\nThis uses split()[docs] and is much more pythonic.\n",
... | [
2,
1,
0
] | [] | [] | [
"extract",
"file",
"python"
] | stackoverflow_0007823505_extract_file_python.txt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.