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:
GAE Soft Memory Limit
is there a way to catch the soft memory limit warning in google ? I am not referring to the Memory Exceeded Error of 300 MB but the warning message which appears when you cross 180 MB memory limit.
01-06 07:11PM 08.597
Exceeded soft memory limit with 247.434 MB after servicing 1 requests tota... | GAE Soft Memory Limit | is there a way to catch the soft memory limit warning in google ? I am not referring to the Memory Exceeded Error of 300 MB but the warning message which appears when you cross 180 MB memory limit.
01-06 07:11PM 08.597
Exceeded soft memory limit with 247.434 MB after servicing 1 requests total
I want to catch this war... | [
"No exception is thrown in your code when this happens - it's logged by the runtime after your request finishes executing, so there's no way to 'catch' it.\n"
] | [
2
] | [] | [] | [
"google_app_engine",
"memory_management",
"python"
] | stackoverflow_0004622407_google_app_engine_memory_management_python.txt |
Q:
Python os module path functions
From the documentation:
os.path.realpath(path)
Return the canonical path of the specified filename, eliminating any
symbolic links encountered in the path (if they are supported by the
operating system).
When I invoke this with an extant file's name, I get the path to it: /home/m... | Python os module path functions | From the documentation:
os.path.realpath(path)
Return the canonical path of the specified filename, eliminating any
symbolic links encountered in the path (if they are supported by the
operating system).
When I invoke this with an extant file's name, I get the path to it: /home/myhome/myproject.
When I invoke this w... | [
"os.path isn't interested in whether or not the files exist. It is merely concerned with constructing paths.\nrealpath eliminates known symlinks from the equation, but directories that do not exist are assumed to be valid elements of a path regardless.\n",
"Rather than guess, just read the code! It's there in yo... | [
2,
2,
0
] | [] | [] | [
"python"
] | stackoverflow_0004622766_python.txt |
Q:
catching errors and exiting
In python, is there a way to exit a class after testing a condition, without exiting out of python?
Say I have the class
class test():
def __init__(self):
self.a = 2
def create_b(self):
self.b = 3
def does_b_exist(self):
if <self.b doesnt exis... | catching errors and exiting | In python, is there a way to exit a class after testing a condition, without exiting out of python?
Say I have the class
class test():
def __init__(self):
self.a = 2
def create_b(self):
self.b = 3
def does_b_exist(self):
if <self.b doesnt exist>:
#terminate
... | [
"You might want to run \"python -i\", which takes you to an interactive console after program execution, to run sys.exit(), which terminates the program, or you (probably) want to customize sys.excepthook. Describe the behavior you want in a little more detail and we can give you some code to try.\n",
"quit() is ... | [
2,
0
] | [] | [] | [
"error_handling",
"python",
"terminate",
"terminate_handler"
] | stackoverflow_0004622823_error_handling_python_terminate_terminate_handler.txt |
Q:
ECG/EKG software language advice
Simply, I'm developing a wireless ECG (electrocardiogram, or EKG from the German Elektrokardiogramm) and I need to choose the best language for a desktop application that allows the following:
wireless transmission of data over WiFi
real-time graphing of ECG data signal
a good DSP... | ECG/EKG software language advice | Simply, I'm developing a wireless ECG (electrocardiogram, or EKG from the German Elektrokardiogramm) and I need to choose the best language for a desktop application that allows the following:
wireless transmission of data over WiFi
real-time graphing of ECG data signal
a good DSP library
Thanks.
| [
"From the viewpoint of a normal program (i.e., not a device driver) a Wi-Fi connection is just a network connection -- not noticeably different from (for example) a wired Ethernet connection.\nReal-time graphing and digital signal processing libraries are probably a little less common, but not much. \"Real time\" i... | [
1
] | [] | [] | [
"c",
"c#",
"c++",
"java",
"python"
] | stackoverflow_0004623047_c_c#_c++_java_python.txt |
Q:
What's the best way to make a private, self-contained python environment?
I want to create a private, self-contained Python environment that doesn't link back to system libraries (the way virtualenv does) and also includes its own versions of standard C/C++ libraries for Python packages that are simply wrappers fo... | What's the best way to make a private, self-contained python environment? | I want to create a private, self-contained Python environment that doesn't link back to system libraries (the way virtualenv does) and also includes its own versions of standard C/C++ libraries for Python packages that are simply wrappers for these libraries (PIL and libjpeg, for example).
I've seen commercial apps tha... | [
"It sound like what your really after is a way to bundle up a particular python installation and script into a distributable package. You can do the following:\n\nDownload, compile and install python into a project directory (ie. python-toolchain)\nCreate a prefix script (toolchain) that will take a relative path ... | [
6,
1,
1
] | [] | [] | [
"python",
"virtualenv"
] | stackoverflow_0004623008_python_virtualenv.txt |
Q:
Returning value from a process creator function in python in multiprocessing
I have picked a snippet from http://docs.python.org/library/multiprocessing.html#multiprocessing-examples
import multiprocessing
def queue_func(queue):
for i in range(30):
time.sleep(0.5 * random.random())
queue.put(i*... | Returning value from a process creator function in python in multiprocessing | I have picked a snippet from http://docs.python.org/library/multiprocessing.html#multiprocessing-examples
import multiprocessing
def queue_func(queue):
for i in range(30):
time.sleep(0.5 * random.random())
queue.put(i*i)
queue.put('STOP')
def test_queue():
q = multiprocessing.Queue()
p... | [
"Yes, of course you can. You just add a return whatever after the while loop.\nTo get a more useful answer, it's generally a good idea to explain what you want to achieve, what you have tried to achieve that and in what way it didn't work.\n"
] | [
0
] | [] | [] | [
"multiprocessing",
"python"
] | stackoverflow_0004623238_multiprocessing_python.txt |
Q:
An issue filtering related models inside the model definition
I'm trying to write some custom methods for my models but I'm getting the following error:
Attribute Error: 'ForeignRelatedObjectsDescriptor' object has no attribute all|filter
This happens when I run this code:
chore = Chore(name='Laundry')
chore.sche... | An issue filtering related models inside the model definition | I'm trying to write some custom methods for my models but I'm getting the following error:
Attribute Error: 'ForeignRelatedObjectsDescriptor' object has no attribute all|filter
This happens when I run this code:
chore = Chore(name='Laundry')
chore.schedule_set.create(week_day='monday', time_due='17:30:00')
chore.sched... | [
"change: \nschedule_count = Chore.schedule_set.all().count()\n\nto:\nschedule_count = self.schedule_set.all().count()\n\nin all the occurrences..\n"
] | [
14
] | [] | [] | [
"django_models",
"python"
] | stackoverflow_0004611340_django_models_python.txt |
Q:
MacPorts on Snow Leopard: Python install seems to succeed but doesn't install a non-system Python
I've installed Python via MacPorts. According to this question, the files in /opt/local/bin should run the "correct" Python version. However, all those files are symlinks to:
/opt/local/Library/Frameworks/Python.frame... | MacPorts on Snow Leopard: Python install seems to succeed but doesn't install a non-system Python | I've installed Python via MacPorts. According to this question, the files in /opt/local/bin should run the "correct" Python version. However, all those files are symlinks to:
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/
Running them directly from that folder (using no symlinks) runs an Apple build... | [
"There are no \"Apple builds\" except the system Python (which is 2.6.1 on Snow Leopard, afai can deduce). The ports install seems to have worked as expected in this case. The reference to Apple is a reference to which GCC that was used.\n",
"I think it is running the build you want.\nmacports install every thing... | [
3,
2
] | [] | [] | [
"macos",
"macports",
"osx_snow_leopard",
"python"
] | stackoverflow_0004623538_macos_macports_osx_snow_leopard_python.txt |
Q:
How can I call a function and form a return object for use within my settings file?
I have some middleware which takes a tuple (of usernames... it only allows usernames in the tuple to pass through certain areas of the site).
I have a UserProfile model which contains information about each user, and I want to filt... | How can I call a function and form a return object for use within my settings file? | I have some middleware which takes a tuple (of usernames... it only allows usernames in the tuple to pass through certain areas of the site).
I have a UserProfile model which contains information about each user, and I want to filter it so that it returns a tuple of usernames for use with this middleware -- in otherwor... | [
"You can also use the @user_passes_test decorator to restrict views to particular subsets of users. Or create your own decorator:\nfrom django.utils.functional import wraps\n\ndef beta(view):\n @wraps(view)\n def inner(request, *args, **kwargs):\n if request.user.user_profile.beta:\n return... | [
2,
0,
0,
0
] | [] | [] | [
"django",
"django_middleware",
"django_models",
"python"
] | stackoverflow_0004622827_django_django_middleware_django_models_python.txt |
Q:
Django installed apps location for classes on system path
I'm using the Django Registration class, it's great, but the last version shipped with an issue and it's no longer updated
I've installed it on my path (downloaded it then python setup.py install) then added it to my projects installed apps
I'm on debian, a... | Django installed apps location for classes on system path | I'm using the Django Registration class, it's great, but the last version shipped with an issue and it's no longer updated
I've installed it on my path (downloaded it then python setup.py install) then added it to my projects installed apps
I'm on debian, and It's copied itself to /usr/lib/python2.5/site-packages/regis... | [
"You could try the oldest trick ever to figure out where it's coming from:\nimport registration\nprint registration.__file__\n\n",
"\nI'm guessing when you include a class in the django installed apps it's copied somewhere, but where?\n\nThat's completely a wrong guess.\nA better guess is that your download direc... | [
3,
1,
1
] | [] | [] | [
"django",
"path",
"python"
] | stackoverflow_0004621726_django_path_python.txt |
Q:
Django namespace pollution?
I have a question about Django's namespace. Firstly, I implemented my own authentication system so I can have features like inline site editing for authenticated users. Bluntly put, I just didn't like the default admin setup.
Consequently, I have consciously not included any of the auth... | Django namespace pollution? | I have a question about Django's namespace. Firstly, I implemented my own authentication system so I can have features like inline site editing for authenticated users. Bluntly put, I just didn't like the default admin setup.
Consequently, I have consciously not included any of the authentication middleware or admin fe... | [
"You could edit the django source, and drop into a pdb session when django.contrib.auth.models is imported, and follow the traceback up until you find the culprit. Pop the following at the top of that file.\nimport pdb; pdb.set_trace()\n\nThen, at the prompt that appears, type tb. (Or bt, I can never remember whic... | [
2,
1,
0
] | [] | [] | [
"django",
"django_models",
"fedora",
"python"
] | stackoverflow_0004620009_django_django_models_fedora_python.txt |
Q:
algorithm to find the nearby friends?
I have a python program sitting in server side managing user location informations, each friend has a pair of (longtitude, latitude), given a (longtitude, latitude) point, how I can find the nearby(say within 5KM) friends efficiently?
I have 10K users online...
Thanks.
Bin
A:... | algorithm to find the nearby friends? | I have a python program sitting in server side managing user location informations, each friend has a pair of (longtitude, latitude), given a (longtitude, latitude) point, how I can find the nearby(say within 5KM) friends efficiently?
I have 10K users online...
Thanks.
Bin
| [
"New Answer:\nI would store lat and long in separate columns. Place indexes on them. Then when you want to find the nearby friends of a particular user, just do something like\nselect field1, field1, ..., fieldn from users \nwhere \n user_lat > this_lat - phi and user_lat < this_lat + phi\n and\n user_lon ... | [
7,
2,
2,
1
] | [] | [] | [
"algorithm",
"python"
] | stackoverflow_0004622988_algorithm_python.txt |
Q:
QTreeWidget expanded columns
If I double-click between two headers the tree expands (or fits I don't know) columns.
How can I do that programmatically? I searched PyQt docs but I didn't find a method or a slot that can do that.
Thanks,
rubik
A:
Since QTreeWidget inherits from QTreeView you can use;
void QTreeVie... | QTreeWidget expanded columns | If I double-click between two headers the tree expands (or fits I don't know) columns.
How can I do that programmatically? I searched PyQt docs but I didn't find a method or a slot that can do that.
Thanks,
rubik
| [
"Since QTreeWidget inherits from QTreeView you can use;\nvoid QTreeView::expandAll ()\n\nwhich also happens to be a slot.\n"
] | [
0
] | [] | [] | [
"pyqt",
"pyqt4",
"python",
"qtreewidget"
] | stackoverflow_0004623934_pyqt_pyqt4_python_qtreewidget.txt |
Q:
Trying and expand the contrib.auth.user model and add a "relationships" manage
I have the following model setup.
from django.db import models
from django.contrib.auth.models import User
class SomeManager(models.Manager):
def friends(self):
# return friends bla bla bla
class Relationship(models.Model)... | Trying and expand the contrib.auth.user model and add a "relationships" manage | I have the following model setup.
from django.db import models
from django.contrib.auth.models import User
class SomeManager(models.Manager):
def friends(self):
# return friends bla bla bla
class Relationship(models.Model):
"""(Relationship description)"""
from_user = models.ForeignKey(User, rela... | [
"I would do this instead.\nf= Relationships.objects.filter( from_user=some_user, is_friend=True )\n\nThat saves trying to mess around with User.\n",
"Maybe you're missing the \".objects\" in the call:\nUser.relationships.objects.friends()\n\n",
"You need to tell Django to use your manager for related lookups - ... | [
1,
0,
0
] | [] | [] | [
"authentication",
"django",
"model",
"python"
] | stackoverflow_0004620830_authentication_django_model_python.txt |
Q:
Pulling python module up into package namespace
If I have a directory structure like this:
package/
__init__.py
functions.py #contains do()
classes.py #contains class A()
And I want to be able to call
import package as p
How do I make the contents of functions, classes, accessible as:
p.d... | Pulling python module up into package namespace | If I have a directory structure like this:
package/
__init__.py
functions.py #contains do()
classes.py #contains class A()
And I want to be able to call
import package as p
How do I make the contents of functions, classes, accessible as:
p.do()
p.A()
in stead of:
p.functions.do()
p.classes.A(... | [
"You could do this in __init__.py (because that's what you import when you import package):\nfrom package.functions import *\nfrom package.classes import *\n\nHowever, import * is nearly always a bad idea and this isn't one of the exceptions. Instead, many packages explicitly import a limited set of commonly-used n... | [
15
] | [] | [] | [
"namespaces",
"python"
] | stackoverflow_0004624754_namespaces_python.txt |
Q:
basic openGL, vertex buffers and pyglet
Edit: rotoglup found the problems in my code, adding the shaders I had removed completed the solution. See my answer below for the correct code (with shaders).
Hi all !
I'm trying to learn some basics of modern OpenGL from this tutorial.
I'd like to do it with python/pyglet... | basic openGL, vertex buffers and pyglet | Edit: rotoglup found the problems in my code, adding the shaders I had removed completed the solution. See my answer below for the correct code (with shaders).
Hi all !
I'm trying to learn some basics of modern OpenGL from this tutorial.
I'd like to do it with python/pyglet instead of C++ though. I know pyglet can abs... | [
"glDrawArrays(GL_POINTS, 0, 1)\n\ninstructs to draw 1 point, in your tutorial, 1 is 3 :\nglDrawArrays(GL_POINTS, 0, 3)\n\nNotice also that the 4th (w) component of your vertices should be 1, not 0 :\n vertexPositions = [0.0, 0.0, 0.0, 1.0,\n 0.25, 0.0, 0.0, 1.0,\n 1.75, 1.75... | [
5,
5
] | [] | [] | [
"opengl",
"pyglet",
"python"
] | stackoverflow_0004618892_opengl_pyglet_python.txt |
Q:
creating a dictionary that maps ascii characters using map and range
I am having some problems with mapping characters to a dictionary. What I am going for is
counter = { '!': 0, '"': 0, '#': 0, '$': 0 } ...
For all the ascii chars in the decimal ranges
range(33,64) range(91,96) and range(123,126)
After some ti... | creating a dictionary that maps ascii characters using map and range | I am having some problems with mapping characters to a dictionary. What I am going for is
counter = { '!': 0, '"': 0, '#': 0, '$': 0 } ...
For all the ascii chars in the decimal ranges
range(33,64) range(91,96) and range(123,126)
After some time I discovered that map could possibly be used passing chr as the functio... | [
"I would do something like\n>>> codes = range(33,64) + range (91,96) + range(123,126)\n>>> counter = dict((chr(c), 0) for c in codes)\n>>> counter\n{'!': 0, '#': 0, '\"': 0, '%': 0, '$': 0, \"'\": 0, '&': 0, ')': 0, '(': 0, '+': 0, '*': 0,\n '-': 0, ',': 0, '/': 0, '.': 0, '1': 0, '0': 0, '3': 0, '2': 0, '5': 0, '4... | [
3,
3,
0
] | [] | [] | [
"python"
] | stackoverflow_0004623195_python.txt |
Q:
Video website on google application engine
I am going to work on a video website where users/admin will be able to upload the videos and play them using some opensource javascript player. However, I want to know if it is a good idea to start this kind of project on google app engine considering its limitations to ... | Video website on google application engine | I am going to work on a video website where users/admin will be able to upload the videos and play them using some opensource javascript player. However, I want to know if it is a good idea to start this kind of project on google app engine considering its limitations to server and store the data.
What are the issues ... | [
"Yes, this is practical. You'll probably want to check out the blobstore for uploading and serving your videos. Conversion will be a little trickier, since you can't do it directly on App Engine - you'll need to use an external service, and either set things up so your users upload directly to that, or have the ser... | [
4,
3,
0
] | [] | [] | [
"google_app_engine",
"google_cloud_datastore",
"python"
] | stackoverflow_0004616934_google_app_engine_google_cloud_datastore_python.txt |
Q:
What's the fastest way to filter a table of integers in Python?
I have a dataset that consists of 7 columns and ~900k rows. All columns are non-unique, and all values are integers.
Two important conditions for the filtering:
I strictly want to see which values there are in one column when I apply conditions on th... | What's the fastest way to filter a table of integers in Python? | I have a dataset that consists of 7 columns and ~900k rows. All columns are non-unique, and all values are integers.
Two important conditions for the filtering:
I strictly want to see which values there are in one column when I apply conditions on the rest.
For the output I am only interested in distinct values.
As a... | [
"Following on what you've said about 20 or so distinct values per column except one with 400. If memory and load time isn't a worry, then I'd suggest creating sets per value per column.\nHere's something to generate a sample dataset.\n#!/usr/bin/python\nfrom random import sample, choice\nfrom cPickle import dump\n\... | [
2,
0,
0
] | [] | [] | [
"list",
"numpy",
"performance",
"python",
"sql"
] | stackoverflow_0004624129_list_numpy_performance_python_sql.txt |
Q:
Internationalize the attributes of an object
My object has an attribute called status. Status can have two states: opened and closed. The value of this attribute should be translated. I've tried to do this in two ways:
<td> {% trans object.status %} </td>
and
<td>
{% blocktrans with object.status as status %... | Internationalize the attributes of an object | My object has an attribute called status. Status can have two states: opened and closed. The value of this attribute should be translated. I've tried to do this in two ways:
<td> {% trans object.status %} </td>
and
<td>
{% blocktrans with object.status as status %} {{ status }} {% endblocktrans %}
</td>
but wit... | [
"If status can only have two states, you should use the choices attribute in the model definition. The values for choices can then be marked for translation:\nSTATUS_CHOICES = (\n ('open', _('open')),\n ('closed', _('closed'))\n)\n\nclass MyModel(models.Model):\n status = models.CharField(max_length=10, ch... | [
1,
0
] | [] | [] | [
"django",
"django_templates",
"internationalization",
"python",
"templates"
] | stackoverflow_0004625699_django_django_templates_internationalization_python_templates.txt |
Q:
Using tkinter.Canvas stateless-ly
Is there a way to draw to ttkinter.Canvas like javascript or .NET canvas?
I.E drawline() without storing an object for that line which can be manipulated later.
A:
As far as I know, no. HTML5 canvas is just a bitmap canvas that you can "paint" on. Tkinter canvas is vector graphi... | Using tkinter.Canvas stateless-ly | Is there a way to draw to ttkinter.Canvas like javascript or .NET canvas?
I.E drawline() without storing an object for that line which can be manipulated later.
| [
"As far as I know, no. HTML5 canvas is just a bitmap canvas that you can \"paint\" on. Tkinter canvas is vector graphics like SVG, so it keeps a record of each object.\nYou might want to investigate PIL's ImageDraw, aggdraw, or perhaps pygame.\n",
"I'm not sure what you mean by \"storing an object\". The canvas g... | [
2,
1
] | [] | [] | [
"python",
"python_3.x",
"tkinter"
] | stackoverflow_0004625108_python_python_3.x_tkinter.txt |
Q:
how to call python function using jquery?
i am learning python with GAE and for interface use jquery so i want to know calling python function using jquery.
A:
jQuery runs in the browser, operates on the DOM tree and gets data from servers mostly through asynchronous HTTP requests. Python runs on the backend - i... | how to call python function using jquery? | i am learning python with GAE and for interface use jquery so i want to know calling python function using jquery.
| [
"jQuery runs in the browser, operates on the DOM tree and gets data from servers mostly through asynchronous HTTP requests. Python runs on the backend - in case of GAE on Google's infrastructure. So the way to call functions on the server from the client is by making requests. \n$.get('ajax/test.html', function(dat... | [
7,
1
] | [
"I believe you need to create a route for the app engine, and call that route with jQuery.\n--EDIT-- The below turns out to be really really untrue, so don't mind it!!! I'm not going to remove it 'cause that would be lame. I have done some work with the Python SDK and tiny bit with the Java SDK, and doing so I felt... | [
-3
] | [
"google_app_engine",
"jquery",
"python"
] | stackoverflow_0004625844_google_app_engine_jquery_python.txt |
Q:
pyspeech (python) - Transcribe mp3 files?
I'd like to transcribe mp3 (speech-to-text) using the pyspeech API. I don't know if this is possible, though.
Is it? How?
A:
pyspeech seems to be merely a python interface to the regular Windows speech APIs. Most likely you'd create some method of treating mp3 playback a... | pyspeech (python) - Transcribe mp3 files? | I'd like to transcribe mp3 (speech-to-text) using the pyspeech API. I don't know if this is possible, though.
Is it? How?
| [
"pyspeech seems to be merely a python interface to the regular Windows speech APIs. Most likely you'd create some method of treating mp3 playback as an audio source for that speech API to listen to.\n",
"I don't know about pyspeech, but if it is a Python wrapper around the Microsoft speech APIs, then some other p... | [
2,
2
] | [] | [] | [
"python",
"speech",
"speech_recognition",
"speech_to_text"
] | stackoverflow_0004611373_python_speech_speech_recognition_speech_to_text.txt |
Q:
how to find path of python file in GAE?
$.ajax({ url: "test.py"
For example in above code for Python file which path I have to use.
I am testing locally in google app engine.
A:
In an AJAX call, you don't want to provide a path to the location of the .py file on your machine (or on the server), but rather the U... | how to find path of python file in GAE? | $.ajax({ url: "test.py"
For example in above code for Python file which path I have to use.
I am testing locally in google app engine.
| [
"In an AJAX call, you don't want to provide a path to the location of the .py file on your machine (or on the server), but rather the URL to call. Unless you've set up a handler for test.py in app.yaml, you're probably not going to be calling a URL containing \"test.py\" in App Engine. You want to provide a URL (... | [
2,
1
] | [] | [] | [
"google_app_engine",
"jquery",
"python"
] | stackoverflow_0004626091_google_app_engine_jquery_python.txt |
Q:
pyglet sprite/texture issue: stretched from bottom left
I have a problem with pyglet on one of my notebooks. I'm working on a relatively complex 2D-Game but it occurs even with the most minimalistic pyglet application you can imagine:
import pyglet
if __name__ == '__main__':
window = pyglet.window.Window(widt... | pyglet sprite/texture issue: stretched from bottom left | I have a problem with pyglet on one of my notebooks. I'm working on a relatively complex 2D-Game but it occurs even with the most minimalistic pyglet application you can imagine:
import pyglet
if __name__ == '__main__':
window = pyglet.window.Window(width=100, height=100)
window.clear()
ball_img = pyglet.... | [
"On my laptop (Ubuntu 10.10 with Intel GMA 4500) everything works fine with your code. I just modified the image name and I used a png that I already had on the computer.\n"
] | [
0
] | [] | [] | [
"linux",
"opengl",
"pyglet",
"python"
] | stackoverflow_0004368028_linux_opengl_pyglet_python.txt |
Q:
Fixed strptime exception with thread lock, but slows down the program
I have the following code, which when is running inside of a thread (the full code is here - https://github.com/eWizardII/homobabel/blob/master/lovebird.py)
for null in range(0,1):
while True:
try:
... | Fixed strptime exception with thread lock, but slows down the program | I have the following code, which when is running inside of a thread (the full code is here - https://github.com/eWizardII/homobabel/blob/master/lovebird.py)
for null in range(0,1):
while True:
try:
with open('C:/Twitter/tweets/user_0_' + str(self.id) + '.json', mode='w')... | [
"According to a previous Answer on StackOverflow, time.strptime is not thread-safe. Unfortunately, the error referenced in that question is different than the error you're experiencing.\nTheir solution was to call time.strptime prior to initializing any threads, and then subsequent calls to time.strptime in variou... | [
6,
2
] | [] | [] | [
"initialization",
"locale",
"multithreading",
"python",
"strptime"
] | stackoverflow_0004625149_initialization_locale_multithreading_python_strptime.txt |
Q:
python multiprocessing each with own subprocess (Kubuntu,Mac)
I've created a script that by default creates one multiprocessing Process; then it works fine. When starting multiple processes, it starts to hang, and not always in the same place. The program's about 700 lines of code, so I'll try to summarise what's ... | python multiprocessing each with own subprocess (Kubuntu,Mac) | I've created a script that by default creates one multiprocessing Process; then it works fine. When starting multiple processes, it starts to hang, and not always in the same place. The program's about 700 lines of code, so I'll try to summarise what's going on. I want to make the most of my multi-cores, by parallelisi... | [
"That's not quite how pipelining works... but to put your mind to ease, here's an excerpt from the subprocess documentation:\n\nstdin, stdout and stderr specify the\n executed programs’ standard input,\n standard output and standard error\n file handles, respectively. Valid\n values are PIPE, an existing file\n... | [
2,
1,
0
] | [] | [] | [
"biopython",
"multiprocessing",
"python",
"subprocess"
] | stackoverflow_0004620041_biopython_multiprocessing_python_subprocess.txt |
Q:
argparse: How to call a method instead of a function?
I am using argparse in my python program and I want to call a method when I run my software like this :
$ python __init__.py foo
It is easy if I want to call a function instead of a method :
def foo(args):
pass
def main():
foo_parser.set_defaults(func... | argparse: How to call a method instead of a function? | I am using argparse in my python program and I want to call a method when I run my software like this :
$ python __init__.py foo
It is easy if I want to call a function instead of a method :
def foo(args):
pass
def main():
foo_parser.set_defaults(func=foo)
if __name__ == "__main__":
main()
How can I rep... | [
"You just refer to the method instead of the function. Yup. It's that easy. Instead of \n func = foo\n\nYou do\n func = theobject.foo\n\nDone!\n",
"You gave the correct answer yourself. Just put:\nfunc = Your_Class.your_method\n\ninstead of:\nfunc = foo\n\n",
"Are you looking for something like this :\nimport a... | [
5,
1,
1,
0
] | [] | [] | [
"argparse",
"python"
] | stackoverflow_0004626239_argparse_python.txt |
Q:
number approximation in python
I have a list of floating points numbers which represent x and y coordinates of points.
(-379.99418604651157, 47.517234218543351, 0.0) #representing point x
an edge contains two such numbers.
I'd like to use a graph traversal algorithm, such as dijkstra, but using floating point n... | number approximation in python | I have a list of floating points numbers which represent x and y coordinates of points.
(-379.99418604651157, 47.517234218543351, 0.0) #representing point x
an edge contains two such numbers.
I'd like to use a graph traversal algorithm, such as dijkstra, but using floating point numbers such as the ones above don't ... | [
"\"...using floating point numbers such as the ones above don't help...\" - why not? I don't recall integers as a requirement for Dijkstra. Aren't you concerned with the length of the edge? That's more likely to be a floating point number, even if the endpoints are expressed in integer values.\nI'm quoting from ... | [
2,
1,
1,
0,
0
] | [] | [] | [
"graph_theory",
"numbers",
"python"
] | stackoverflow_0004626370_graph_theory_numbers_python.txt |
Q:
Python: How do I get the IP address from a FQDN
If I have an FQDN e.g., www.google.com, how do I get the corresponding IP address?
A:
The easiest way to do this is socket.gethostbyname().
A:
You can use socket.getaddrinfo. That will give you the differents IP address associated with the name, and can also give... | Python: How do I get the IP address from a FQDN | If I have an FQDN e.g., www.google.com, how do I get the corresponding IP address?
| [
"The easiest way to do this is socket.gethostbyname().\n",
"You can use socket.getaddrinfo. That will give you the differents IP address associated with the name, and can also give you the IPv6 address.\nFrom the documentation:\n>>> import socket\n>>> help(socket.getaddrinfo)\nHelp on built-in function getaddrinf... | [
7,
6,
0
] | [] | [] | [
"ip_address",
"network_programming",
"python"
] | stackoverflow_0004626954_ip_address_network_programming_python.txt |
Q:
How simply display a QColor using PyQt?
I have a QColor that I get from a QColorDialog.getColor().
I would like to display it to the user within a form.
How can I do that ?
I tried using a QGraphicView and setting the backgroundBrush like this :
self.displayColor = QtGui.QGraphicView(self)
self.color = Qt... | How simply display a QColor using PyQt? | I have a QColor that I get from a QColorDialog.getColor().
I would like to display it to the user within a form.
How can I do that ?
I tried using a QGraphicView and setting the backgroundBrush like this :
self.displayColor = QtGui.QGraphicView(self)
self.color = QtGui.QColor(category.color)
self.displayCo... | [
"s=QGraphicsScene()\ns.setBackgroundBrush(QColor(0,255,0))\ng=QGraphicsView(s)\ng.render(QPainter())\n\n",
"Finally, I choose to create a widget like this : \n# -*- coding: utf-8 -*-\nfrom PyQt4 import QtGui, QtCore\n\nclass ColorDisplay(QtGui.QWidget):\n def __init__(self, parent):\n super(ColorDisplay... | [
4,
4
] | [] | [] | [
"pyqt",
"python",
"qt"
] | stackoverflow_0004624985_pyqt_python_qt.txt |
Q:
PyQt: translating standard buttons
How can I easily translate standard buttons (Yes, No) from QMessageBox? I can't use self.tr on those arguments, so I would like to achieve it in some other simple way. Do I have to use whole translation system?
A:
Here is how I did :
First you need to copy the qt_LOCALE.qm file... | PyQt: translating standard buttons | How can I easily translate standard buttons (Yes, No) from QMessageBox? I can't use self.tr on those arguments, so I would like to achieve it in some other simple way. Do I have to use whole translation system?
| [
"Here is how I did :\nFirst you need to copy the qt_LOCALE.qm file to your application directory. Mine was :\ncp /usr/share/qt4/translations/qt_fr.qm .\n\nSecondly, you need to load a translator for your application.\napplication = QApplication(argv)\n\nlocale = QLocale.system().name()\nqtTranslator = QTranslator()... | [
10,
3,
3,
0
] | [] | [] | [
"button",
"pyqt",
"python",
"qt",
"translation"
] | stackoverflow_0001709528_button_pyqt_python_qt_translation.txt |
Q:
Is there support for sparse matrices in Python?
Is there support for sparse matrices in python?
Possibly in numpy or in scipy?
A:
Yes.
SciPi provides scipy.sparse, a "2-D sparse matrix package for numeric data".
There are seven available sparse matrix types:
csc_matrix: Compressed Sparse Column format
csr_matr... | Is there support for sparse matrices in Python? | Is there support for sparse matrices in python?
Possibly in numpy or in scipy?
| [
"Yes.\nSciPi provides scipy.sparse, a \"2-D sparse matrix package for numeric data\".\n\nThere are seven available sparse matrix types:\n\ncsc_matrix: Compressed Sparse Column format\ncsr_matrix: Compressed Sparse Row format\nbsr_matrix: Block Sparse Row format\nlil_matrix: List of Lists format\ndok_matrix: Diction... | [
41,
5
] | [] | [] | [
"numpy",
"python",
"scipy",
"sparse_matrix"
] | stackoverflow_0004623800_numpy_python_scipy_sparse_matrix.txt |
Q:
Plot multidimensional data
I have records of members in a club and their interests, as in the following:
Member A: Football, Swimming
Member B: Swimming, Jooga, Jogging
Member C: Cycling, Football
Member D: Football, Tennis, Cycling
Is it possible to plot these in Python so that one can see the different interest... | Plot multidimensional data | I have records of members in a club and their interests, as in the following:
Member A: Football, Swimming
Member B: Swimming, Jooga, Jogging
Member C: Cycling, Football
Member D: Football, Tennis, Cycling
Is it possible to plot these in Python so that one can see the different interests members share? Thanks in advan... | [
"A simple table seems to make more sense than a Venn diagram:\nimport scipy, pylab\nnames = ['Alice', 'Bob', 'Carol', 'David']\ninterests = [['Football', 'Swimming'], ['Swimming', 'Jooga', 'Jogging'], \n ['Cycling', 'Football'], ['Football', 'Tennis', 'Cycling']]\nallinterests = list(set(reduce(lambda x... | [
6,
3
] | [] | [] | [
"matplotlib",
"python"
] | stackoverflow_0004625673_matplotlib_python.txt |
Q:
py2app and xml.etree.ElementTree
I'm trying to build an app that uses some xml data using Python's built-in xml.etree.ElementTree class. It works properly when I run from the command line, but when I build it, I get an error "ImportError: No module etree.ElementTree." I'm guessing this is because I'm not importing... | py2app and xml.etree.ElementTree | I'm trying to build an app that uses some xml data using Python's built-in xml.etree.ElementTree class. It works properly when I run from the command line, but when I build it, I get an error "ImportError: No module etree.ElementTree." I'm guessing this is because I'm not importing that module correctly, but I haven't ... | [
"After reinstalling and updating macholib, modulegraph, py2app, and setuptools to no avail, I did a little more digging and found the following error in the modulegraph module:\ngraphmodule.find_modules.find_modules(includes=['xml.etree'])\nTraceback (most recent call last):\n File \"<stdin>\", line 1 in <module... | [
1,
1,
0
] | [] | [] | [
"py2app",
"python",
"xml"
] | stackoverflow_0002179159_py2app_python_xml.txt |
Q:
py2app: how to include modules that will be loaded by __import__?
I have a Python application that loads python modules dynamically at run time (using __import__). The modules to load are in a package called 'plugins' (i.e. subfolder called plugins with __init__.py etc). All works fine running from the python inte... | py2app: how to include modules that will be loaded by __import__? | I have a Python application that loads python modules dynamically at run time (using __import__). The modules to load are in a package called 'plugins' (i.e. subfolder called plugins with __init__.py etc). All works fine running from the python interpreter, and even when compiled to a windows binary using py2exe.
I tri... | [
"Koo uses the following code. You'll probably need to do something similar to detect that you're in py2app, and adjust your import accordingly.\nhttp://bazaar.launchpad.net/~openobject-client-kde/openobject-client-kde/5.0/annotate/head%3A/Koo/Common/Plugins.py\ndef scan( module, directory ):\n pluginImports... | [
0
] | [] | [] | [
"macos",
"py2app",
"python"
] | stackoverflow_0003525944_macos_py2app_python.txt |
Q:
Handling unicode characters of http User-agents in python
I am completely new to python but I found a package that I need to use and am testing it. The python package in question is pywurfl.
I have created a simple code based on the example given by reading the User-agent (UA) strings from a column in a simple tex... | Handling unicode characters of http User-agents in python | I am completely new to python but I found a package that I need to use and am testing it. The python package in question is pywurfl.
I have created a simple code based on the example given by reading the User-agent (UA) strings from a column in a simple text file. There are a very large number of UAs (some might have f... | [
"Looks like you have 2 separate problems.\nThe first is that you're assuming the input file is utf-8, when it's not. Changing the input coding to latin-1 addresses that issue.\nThe second issue is that your stdout seems to be set up for ascii output, so the write fails. For that, this question may help.\n"
] | [
2
] | [] | [] | [
"error_handling",
"python",
"unicode",
"user_agent"
] | stackoverflow_0004628306_error_handling_python_unicode_user_agent.txt |
Q:
Configure tkinter/ttk widgets with transparent backgrounds, ttk frame background colors?
Is it possible to configure tkinter or ttk widgets (Label, Entry, Text) with a transparent background so that they can be placed in containers with custom background colors or on top of canvas graphics or images?
I'm also look... | Configure tkinter/ttk widgets with transparent backgrounds, ttk frame background colors? | Is it possible to configure tkinter or ttk widgets (Label, Entry, Text) with a transparent background so that they can be placed in containers with custom background colors or on top of canvas graphics or images?
I'm also looking for a way to change the background color of a ttk Frame widget?
Do I need to use the new t... | [
"Except on OSX, what you want can't be done because all those widgets are drawn on real windows which are rectangular (unless you use some low-level tricks to chop holes out of the window concerned; not an approach I recommend even though I've got code – for Tcl/Tk, not Python/Tkinter admittedly – which does it). O... | [
3
] | [] | [] | [
"python",
"tkinter",
"ttk",
"windows"
] | stackoverflow_0004011406_python_tkinter_ttk_windows.txt |
Q:
Replace first occurrence of string in Python
I have some sample string. How can I replace first occurrence of this string in a longer string with empty string?
regex = re.compile('text')
match = regex.match(url)
if match:
url = url.replace(regex, '')
A:
string replace() function perfectly solves this problem... | Replace first occurrence of string in Python | I have some sample string. How can I replace first occurrence of this string in a longer string with empty string?
regex = re.compile('text')
match = regex.match(url)
if match:
url = url.replace(regex, '')
| [
"string replace() function perfectly solves this problem:\n\nstring.replace(s, old, new[, maxreplace])\nReturn a copy of string s with all occurrences of substring old replaced by new. If the optional argument maxreplace is given, the first maxreplace occurrences are replaced.\n\n>>> u'longlongTESTstringTEST'.repla... | [
343,
22
] | [] | [] | [
"python",
"regex"
] | stackoverflow_0004628618_python_regex.txt |
Q:
How can I created a PIL Image from an in-memory file?
More specifically, I want to change the filetype of an image uploaded through a Django ImageField.
My current thinking is to created a custom ImageField and overwrite the save method to manipulate the file.
I've having trouble getting an in memory file to beca... | How can I created a PIL Image from an in-memory file? | More specifically, I want to change the filetype of an image uploaded through a Django ImageField.
My current thinking is to created a custom ImageField and overwrite the save method to manipulate the file.
I've having trouble getting an in memory file to because a PIL Image instance.
Thanks for the help.
| [
"Have you tried StringIO ?\nsee the docs http://effbot.org/imagingbook/introduction.htm#more-on-reading-images\n#Reading from a string \nimport StringIO\n\nim = Image.open(StringIO.StringIO(buffer))\n\n",
"Note that Django's ImageField inherits the open method from FieldFile. This returns a stream object that can... | [
19,
16
] | [] | [] | [
"django",
"django_models",
"python",
"python_imaging_library"
] | stackoverflow_0004628529_django_django_models_python_python_imaging_library.txt |
Q:
How to print a string with a little delay between the chars?
I want a text to be displayed as if it is just being typed. So I need a little delay after every letter.
I tried to do it this way:
import time
text = "Hello, this is a test text to see if all works fine."
for char in text:
print char,time.sleep(0.2)... | How to print a string with a little delay between the chars? | I want a text to be displayed as if it is just being typed. So I need a little delay after every letter.
I tried to do it this way:
import time
text = "Hello, this is a test text to see if all works fine."
for char in text:
print char,time.sleep(0.2),
It works fine, except for one problem. I get a "None" after eve... | [
">>> import time\n>>> import sys\n>>> blah = \"This is written slowly\\n\"\n>>> for l in blah:\n... sys.stdout.write(l)\n... sys.stdout.flush()\n... time.sleep(0.2)\n...\nThis is written slowly\n\n",
"You are printing the result of time.sleep(0.2), which is None. Move it to the next line.\ntext = \"Hello, ... | [
19,
3,
1,
1,
1,
1,
1
] | [] | [] | [
"python"
] | stackoverflow_0004627033_python.txt |
Q:
Best way to parse xml in Appengine with Python
I am connecting to isbndb.com for book information and their response looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<ISBNdb server_time="2005-02-25T23:03:41">
<BookList total_results="1" page_size="10" page_number="1" shown_results="1">
<BookData book_id=... | Best way to parse xml in Appengine with Python | I am connecting to isbndb.com for book information and their response looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<ISBNdb server_time="2005-02-25T23:03:41">
<BookList total_results="1" page_size="10" page_number="1" shown_results="1">
<BookData book_id="somebook" isbn="0123456789">
<Title>Interesting ... | [
"use etree:)\n>>> xml = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n... <ISBNdb server_time=\"2005-02-25T23:03:41\">\n... <BookList total_results=\"1\" page_size=\"10\" page_number=\"1\" shown_results=\"1\">\n... <BookData book_id=\"somebook\" isbn=\"0123456789\">\n... <Title>Interesting Book</Title>\n.... | [
7,
0
] | [] | [] | [
"google_app_engine",
"python",
"xml_deserialization"
] | stackoverflow_0004628771_google_app_engine_python_xml_deserialization.txt |
Q:
Python timer similar to javascript timer
I want to create a dynamic timer on webpage in python like this code which is in Javascript:
<script language="JavaScript" type="text/javascript">
var seconds = 40;
var minutes = 01;
function timer() {seconds--;
if (seconds == -01) {
seconds = 59;
minutes = mi... | Python timer similar to javascript timer | I want to create a dynamic timer on webpage in python like this code which is in Javascript:
<script language="JavaScript" type="text/javascript">
var seconds = 40;
var minutes = 01;
function timer() {seconds--;
if (seconds == -01) {
seconds = 59;
minutes = minutes - 1; }
else {
minutes = minutes; }
... | [
"This isn't quite possible in python, as python is server side, and you are displaying user side data. You won't get around javascript in any way, either you will need the timer itself on the js side or you'd need ajax.\n",
"I am still unsure about what you are trying to achieve. \nYou may use cookies to store t... | [
1,
0
] | [] | [] | [
"django",
"google_app_engine",
"python"
] | stackoverflow_0004629152_django_google_app_engine_python.txt |
Q:
Python & Pygame: Ball collision with interior of circle
I'm making a game in which balls bounce around the inside of a much larger circle. The larger circle doesn't move.
Here's the code that I'm currently using for these collisions:
def collideCircle(circle, ball):
"""Check for collision between a ball and a ... | Python & Pygame: Ball collision with interior of circle | I'm making a game in which balls bounce around the inside of a much larger circle. The larger circle doesn't move.
Here's the code that I'm currently using for these collisions:
def collideCircle(circle, ball):
"""Check for collision between a ball and a circle"""
dx = circle.x - ball.x
dy = circle.y - ball... | [
"Without answering your question, I'd like to comment on your implementation strategy and recommend a new approach. You represent the velocity of the ball in polar coordinate form, as ball.angle and ball.speed.\nI think that this is going to be generally inconvenient for you. For example, in your collision code you... | [
14,
12,
2
] | [] | [] | [
"collision_detection",
"physics",
"pygame",
"python"
] | stackoverflow_0004613345_collision_detection_physics_pygame_python.txt |
Q:
tracing Linux socket calls?
I've got a Python library I am trying to debug (pyzeroconf). The following code returns '34' as if the data was sent down the socket but I can't see those packets on 2 different wireshark equipped PCs.
bytes_sent = self.socket.sendto(out.packet(), 0, (addr, port))
I am at the point wher... | tracing Linux socket calls? | I've got a Python library I am trying to debug (pyzeroconf). The following code returns '34' as if the data was sent down the socket but I can't see those packets on 2 different wireshark equipped PCs.
bytes_sent = self.socket.sendto(out.packet(), 0, (addr, port))
I am at the point where I need to understand what's goi... | [
"you can use strace, e.g.\n$ strace -o logfile -e trace=network cmdline\n\n",
"I'm quite sure this not what you expect, but can help:\nstrace -f -F python myscript.py\nstrace dump the system calls of a generic program.\n",
"Why would the INADDR_ANY IP address fail? It shouldn't. From my point of view, something... | [
4,
1,
0
] | [] | [] | [
"linux",
"network_traffic",
"python",
"sockets"
] | stackoverflow_0004626726_linux_network_traffic_python_sockets.txt |
Q:
My first Python GUI program generating error
I tried following link to write my first Python GUI app:
Setting up IDE and creating a cross platform Qt Python GUI application
I configured the settings exactly as shown in the screenshots, and just pasted that example given over there, but it is giving error. It is no... | My first Python GUI program generating error | I tried following link to write my first Python GUI app:
Setting up IDE and creating a cross platform Qt Python GUI application
I configured the settings exactly as shown in the screenshots, and just pasted that example given over there, but it is giving error. It is not able to find QtGui in PyQt4 folder. The only dif... | [
"When I installed PyQt4 with the latest windows installer it missed adding the path to the dll files, too.\nInstead of adding another item to my already bloated path line I copied the contents of the C:\\Python27\\Lib\\site-packages\\PyQt4\\bin folder up to the main PyQt folder (C:\\Python27\\Lib\\site-packages\\Py... | [
4
] | [] | [] | [
"pyqt4",
"python"
] | stackoverflow_0004629855_pyqt4_python.txt |
Q:
how to make sortable datatype in Python?
I have a class representing something with a few fields. When a list of instances of this class is sorted, I want them to be sorted in a particular order (get a particular key from each one). I can just do list.sort(key=Classname.sortKey) and define a sortKey method, but I'... | how to make sortable datatype in Python? | I have a class representing something with a few fields. When a list of instances of this class is sorted, I want them to be sorted in a particular order (get a particular key from each one). I can just do list.sort(key=Classname.sortKey) and define a sortKey method, but I'd rather just do list.sort() and have it work ... | [
"Check out http://wiki.python.org/moin/HowTo/Sorting/\nYou want to override __lt__ in your class for the built in sort function to work the way you described.\n"
] | [
13
] | [] | [] | [
"data_structures",
"python",
"sorting"
] | stackoverflow_0004630341_data_structures_python_sorting.txt |
Q:
Is there a way to tell when a python file is loaded using PYTHONSTARTUP vs. being run as a script?
All,
I recently discovered the PYTHONSTARTUP environment variable, and am looking forward to setting up several of my utility functions to automatically load into my interpreter. However, one thing I'd like to be ... | Is there a way to tell when a python file is loaded using PYTHONSTARTUP vs. being run as a script? | All,
I recently discovered the PYTHONSTARTUP environment variable, and am looking forward to setting up several of my utility functions to automatically load into my interpreter. However, one thing I'd like to be able to do is use the same script to setup the environment variable itself.
My issue is determining wh... | [
"You could check if the PYTHONSTARTUP environment variable is set to the current filename (via __file__).\n import os\n if os.environ.get('PYTHONSTARTUP') == __file__:\n print \"Used as startup!\"\n\nWorked fine for me.\n",
"Found a better solution:\nif sys.argv[0] == __file__:\n print \"It works!\"\n\nBas... | [
3,
1
] | [] | [] | [
"python"
] | stackoverflow_0004588889_python.txt |
Q:
Accessing database objects in Django form cleaner
Is there a way to access the database object from the django form cleaner? Or at least the URL to which the form data was posted? If I can get the URL, I can query for the database object.
My use case is that, I have a form that should raise an error if the databas... | Accessing database objects in Django form cleaner | Is there a way to access the database object from the django form cleaner? Or at least the URL to which the form data was posted? If I can get the URL, I can query for the database object.
My use case is that, I have a form that should raise an error if the database object from which the form was generated is in some p... | [
"Yes - take a look at self.instance from inside your form's clean method.\n"
] | [
2
] | [] | [] | [
"django",
"django_forms",
"python"
] | stackoverflow_0004630564_django_django_forms_python.txt |
Q:
Defining lists as global variables in Python
I am using a list on which some functions works in my program. This is a shared list actually and all of my functions can edit it. Is it really necessary to define it as "global" in all the functions?
I mean putting the global keyword behind it in each function that use... | Defining lists as global variables in Python | I am using a list on which some functions works in my program. This is a shared list actually and all of my functions can edit it. Is it really necessary to define it as "global" in all the functions?
I mean putting the global keyword behind it in each function that uses it, or defining it outside of all the functions ... | [
"When you assign a variable (x = ...), you are creating a variable in the current scope (e.g. local to the current function). If it happens to shadow a variable fron an outer (e.g. global) scope, well too bad - Python doesn't care (and that's a good thing). So you can't do this:\nx = 0\ndef f():\n x = 1\nf()\npr... | [
36,
12,
2
] | [] | [] | [
"global_variables",
"list",
"python"
] | stackoverflow_0004630543_global_variables_list_python.txt |
Q:
Python GTK windows browser
I am building an application in python and gtk, and I would like to have an embedded browser inside to navigate to intranet sites. I can't seem to find windows binaries for pywebkitgtk and webkitgtk. I am not sure on how to build them from source so that's why I was looking for binaries.... | Python GTK windows browser | I am building an application in python and gtk, and I would like to have an embedded browser inside to navigate to intranet sites. I can't seem to find windows binaries for pywebkitgtk and webkitgtk. I am not sure on how to build them from source so that's why I was looking for binaries. If anyone knows where I could f... | [
"See What's a good embedded browser for a pygtk application?\n"
] | [
0
] | [] | [] | [
"gtk",
"python",
"webkit",
"windows"
] | stackoverflow_0004616001_gtk_python_webkit_windows.txt |
Q:
Proper way to import when using timeit?
I was testing the following code from one of my previous questions (turning a list into a dictionary):
single = ['key1', 'value1', 'key2', 'value2', 'key3', 'value3']
if __name__ == '__main__':
from timeit import Timer
print Timer("dict(zip(single[::2], single[1::2]... | Proper way to import when using timeit? | I was testing the following code from one of my previous questions (turning a list into a dictionary):
single = ['key1', 'value1', 'key2', 'value2', 'key3', 'value3']
if __name__ == '__main__':
from timeit import Timer
print Timer("dict(zip(single[::2], single[1::2]))",
"from __main__ import single").t... | [
"Do it in setup. After all, you wouldn't be re-importing the module every time you create a dict - only once for the entire program. You don't care about the timing on importing the module.\n"
] | [
5
] | [] | [] | [
"import",
"python",
"timeit"
] | stackoverflow_0004630663_import_python_timeit.txt |
Q:
Saving data in a inherited django model
I'm building an app to save data and some calculations made with that data, the idea is keep the data in one model and the calculations in other. So, the models are like this:
class FreshData(models.Model):
name = models.CharField(max_length=20)
one = models.IntegerF... | Saving data in a inherited django model | I'm building an app to save data and some calculations made with that data, the idea is keep the data in one model and the calculations in other. So, the models are like this:
class FreshData(models.Model):
name = models.CharField(max_length=20)
one = models.IntegerField()
two = models.IntegerField()
d... | [
"You have just instantiated a class but not stored calculations() in a variable, plus give your class names capital letters. Also your super call is incorrect, it needs to reference your model and not Blog.\nThe reason self.one probably doesn't have a value is because you are doing the work before the call to the s... | [
2
] | [] | [] | [
"django",
"django_models",
"python"
] | stackoverflow_0004630768_django_django_models_python.txt |
Q:
Why am I getting this Error in Django notification?
I'm using this one: https://github.com/pinax/django-notification/blob/master/docs/usage.txt
So, I followed all the steps.
from notification import models as notification
#first, create the notification type.
notification.create_notice_type("comment_received", ("... | Why am I getting this Error in Django notification? | I'm using this one: https://github.com/pinax/django-notification/blob/master/docs/usage.txt
So, I followed all the steps.
from notification import models as notification
#first, create the notification type.
notification.create_notice_type("comment_received", ("Comment Received"), ("You have received a comment."))
#t... | [
"Did you include the proper URL configurations? Looks like Django can't find notification_notices in any of your urlconfs...\nhttps://github.com/pinax/django-notification/blob/master/notification/urls.py\nYou should reference these in your site's urls.py, e.g.:\nurlpatterns = patterns('',\n (r'^notification/', i... | [
5,
1
] | [] | [] | [
"django",
"python",
"templates",
"url"
] | stackoverflow_0004631096_django_python_templates_url.txt |
Q:
Possible to read the return value in a command proceeding a python script
Given a bash command line:
./getRawStream.jar | ./processRaw.py > product.csv 2> product.stderr
Is it possible for ./processRaw.py to find the return value of ./getRawStream.jar and abort the rest of the chain? I am trying to avoid using p... | Possible to read the return value in a command proceeding a python script | Given a bash command line:
./getRawStream.jar | ./processRaw.py > product.csv 2> product.stderr
Is it possible for ./processRaw.py to find the return value of ./getRawStream.jar and abort the rest of the chain? I am trying to avoid using python's subprocess module at all costs because the final output of ./getRawStre... | [
"That's not how pipes work. Pipes deal with input and output, not with the programs generating them.\nThat said, subprocess can use pipes too - if you pass stdout=subprocess.PIPE you'll get a stdout stream for the process that you can read incrementally. Of course, if you care about return codes, you have to wait f... | [
4,
0
] | [] | [] | [
"bash",
"linux",
"pipe",
"python"
] | stackoverflow_0004631055_bash_linux_pipe_python.txt |
Q:
Django ViewDoesNotExist error on deployment only
I'm working on a Django app that I thought was nearly ready to deploy. Everything works on the development server, but when hosted on a test Apache/mod_wsgi server, I get an error for every last one of my views.
If I put in a invalid URL, it serves me the list of va... | Django ViewDoesNotExist error on deployment only | I'm working on a Django app that I thought was nearly ready to deploy. Everything works on the development server, but when hosted on a test Apache/mod_wsgi server, I get an error for every last one of my views.
If I put in a invalid URL, it serves me the list of valid URL's as expected, but nothing else seems to work ... | [
"There is an error in your results.views file, that breaks everything!\nApparently the Error was: 'module' object has no attribute 'cbook'. So search through your results.views python file for \"cbook\" you may be trying to import cbook or using it somewhere. Either way the problem will be \"cbook\" related.\n"
] | [
1
] | [] | [] | [
"django",
"python"
] | stackoverflow_0004631230_django_python.txt |
Q:
Using Python for quasi randomization
Here's the problem: I try to randomize n times a choice between two elements (let's say [0,1] -> 0 or 1), and my final list will have n/2 [0] + n/2 [1]. I tend to have this kind of result: [0 1 0 0 0 1 0 1 1 1 1 1 1 0 0, until n]: the problem is that I don't want to have serial... | Using Python for quasi randomization | Here's the problem: I try to randomize n times a choice between two elements (let's say [0,1] -> 0 or 1), and my final list will have n/2 [0] + n/2 [1]. I tend to have this kind of result: [0 1 0 0 0 1 0 1 1 1 1 1 1 0 0, until n]: the problem is that I don't want to have serially 4 or 5 times the same number so often. ... | [
"To guarantee that there will be the same number of zeros and ones you can generate a list containing n/2 zeros and n/2 ones and shuffle it with random.shuffle.\nFor small n, if you aren't happy that the result passes your acceptance criteria (e.g. not too many consecutive equal numbers), shuffle again. Be aware th... | [
4,
2,
1,
1,
0
] | [] | [] | [
"python",
"random"
] | stackoverflow_0004630723_python_random.txt |
Q:
argparse concatenate cli options
Just starting to learn python and playing around with passing command line options to a python script. I'm trying to concatenate two or more arguments and pass it on to a string variable,
e.g.,
myscript.py http://www.domain.com 1234
put it in to a string variable called url, which... | argparse concatenate cli options | Just starting to learn python and playing around with passing command line options to a python script. I'm trying to concatenate two or more arguments and pass it on to a string variable,
e.g.,
myscript.py http://www.domain.com 1234
put it in to a string variable called url, which then should have the value of "http:/... | [
"import argparse\n\nparser = argparse.ArgumentParser()\nparser.add_argument('server') # first positional argument\nparser.add_argument('port') # second positional argument\nargs = parser.parse_args()\n\nurl = '%s:%s' % (args.server, args.port)\nprint url\n\n",
"argparse is one way to solve it, but may be overkill... | [
7,
2,
1,
0,
0,
0
] | [] | [] | [
"argparse",
"python"
] | stackoverflow_0004630765_argparse_python.txt |
Q:
Objects from Tkinter controls: how to go beyond StringVar, IntVar, DoubleVar, BooleanVar?
I'm trying to write a GUI in Tkinter to select one among several complex Python objects. They represent records from a database; if needed, I could recover objects from a map given their integer unique id.
In an ideal world, ... | Objects from Tkinter controls: how to go beyond StringVar, IntVar, DoubleVar, BooleanVar? | I'm trying to write a GUI in Tkinter to select one among several complex Python objects. They represent records from a database; if needed, I could recover objects from a map given their integer unique id.
In an ideal world, the Listbox and OptionMenu widgets would accept a sequence of arbitrary objects and a function ... | [
"What I did to solve this problem, at least for my ListBox was to have an array which represented all the data in the list. Say that complexobjects is your list of objects,\nfor obj in complexobjects:\n listbox.insert(END, str(complexobjects))\n\nreplace str(complexobjects) with whatever you want your string\nr... | [
0
] | [] | [] | [
"python",
"tkinter"
] | stackoverflow_0004629286_python_tkinter.txt |
Q:
Organize heavy python imports
About 25% of my code depends on the modules: Traits, tvtk, ... which are quite heavy to import. It typically takes a good 2 seconds on my machine (and more on other).
My modules are organized as the following
mainmodule
|--submodule1
|--submodule2
|--subsubmodule1
|--subsubmodul... | Organize heavy python imports | About 25% of my code depends on the modules: Traits, tvtk, ... which are quite heavy to import. It typically takes a good 2 seconds on my machine (and more on other).
My modules are organized as the following
mainmodule
|--submodule1
|--submodule2
|--subsubmodule1
|--subsubmodule2
|--submodule3
|--submodule4
|... | [
"You can put some code like this within a function / module:-\ndef heavy():\n global x\n global y\n import x, y\n\ndef mainmodule():\n if heavy not in globals():\n import heavy\n\nActually, this wouldn't work within the same program, as a function cannot be imported. Also, you'd want to check for... | [
3,
3
] | [] | [] | [
"import",
"project_organization",
"python"
] | stackoverflow_0004631205_import_project_organization_python.txt |
Q:
Python, UnicodeDecodeError
I get this error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 4: ordinal not in range(128)
I tried setting many different codecs (in the header, like # -*- coding: utf8 -*-), or even using u"string", but it still appears.
How do I fix this?
Edit: I don't know th... | Python, UnicodeDecodeError | I get this error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 4: ordinal not in range(128)
I tried setting many different codecs (in the header, like # -*- coding: utf8 -*-), or even using u"string", but it still appears.
How do I fix this?
Edit: I don't know the actual character that's causin... | [
"We can't guess what you are trying to do, nor what's in your code, not what \"setting many different codecs\" means, nor what u\"string\" is supposed to do for you.\nPlease change your code to its initial state so that it reflects as best you can what you are trying to do, run it again, and then edit your question... | [
15,
6,
2,
1,
1,
1,
0
] | [
"instead of doing:\nprint \"Error reading file %s\"%u\"%s/%s\"%(folder, f)\n\nTry this:\nprint \"Error reading file %s\"%u\"%s/%s\"%(folder.encode('ascii','ignore'), f.encode('ascii','ignore'))\n\nSince the console can't print unicode chars, you can's see the correct name. 'ignore' tells the codec to skip those cha... | [
-1
] | [
"python",
"unicode"
] | stackoverflow_0001766669_python_unicode.txt |
Q:
How come I can't get Django to talk to this library?
I want to use Redis. So I followed this tutorial: https://github.com/sebleier/django-redis-cache
First, I install redis-py: https://github.com/andymccurdy/redis-py/
Then, I put this in my settings: CACHE_BACKEND = 'redis_cache.cache://localhost:6379'
Then I do t... | How come I can't get Django to talk to this library? | I want to use Redis. So I followed this tutorial: https://github.com/sebleier/django-redis-cache
First, I install redis-py: https://github.com/andymccurdy/redis-py/
Then, I put this in my settings: CACHE_BACKEND = 'redis_cache.cache://localhost:6379'
Then I do this in my views.py:
from redis_cache import cache #this im... | [
"You want to import Django's cache module (the abstraction layer that calls Redis eventually) instead of directly using Redis:\nfrom django.core.cache import cache\n\n"
] | [
2
] | [] | [] | [
"caching",
"database",
"django",
"python",
"redis"
] | stackoverflow_0004631719_caching_database_django_python_redis.txt |
Q:
How to convert an .ICO to .PNG with Python?
I'm trying to convert a batch of .ICO images over to .PNG images in Python. I have quite a few images to go through so I'd like to find a programmatic solution. I've tried using PIL but I can't seem to get the images and transparency to come out correctly.
I'd prefer to ... | How to convert an .ICO to .PNG with Python? | I'm trying to convert a batch of .ICO images over to .PNG images in Python. I have quite a few images to go through so I'd like to find a programmatic solution. I've tried using PIL but I can't seem to get the images and transparency to come out correctly.
I'd prefer to use Python but if it can't be done another langua... | [
"See http://code.google.com/p/casadebender/wiki/Win32IconImagePlugin\nIt's a PIL plugin that makes it handle Windows icons properly.\n",
"If it's just a batch job, why not just use imagemagick?\n"
] | [
5,
2
] | [] | [] | [
"ico",
"image",
"image_processing",
"png",
"python"
] | stackoverflow_0004631683_ico_image_image_processing_png_python.txt |
Q:
How come I'm getting this Django error?
I installed an app called Django-notification, which uses Django-pagination. However, it can't find the Django_pagination template tags!
Exception Type: TemplateSyntaxError at /notifications
Exception Value: 'pagination_tags' is not a valid tag library: Template library pagi... | How come I'm getting this Django error? | I installed an app called Django-notification, which uses Django-pagination. However, it can't find the Django_pagination template tags!
Exception Type: TemplateSyntaxError at /notifications
Exception Value: 'pagination_tags' is not a valid tag library: Template library pagination_tags not found, tried django.templatet... | [
"Just to make sure, have you called {% load pagination_tags %} in your template? \nFrom django's documentation:\n\nThe app that contains the custom tags must be in INSTALLED_APPS in\n order for the {% load %} tag to work.\n This is a security feature: It allows\n you to host Python code for many\n template libr... | [
1
] | [] | [] | [
"django",
"pagination",
"python",
"templates"
] | stackoverflow_0004631820_django_pagination_python_templates.txt |
Q:
How come I can't include other URLs.py into my Django?
I have a urls.py. One of them says this line:
(r'^notification/?$',include("notification.urls")),
I'm supposed to do that because I installed "django_notification" (and added "notification") to INSTALLED_APPs.
Great! going to /notification/ works! This is the... | How come I can't include other URLs.py into my Django? | I have a urls.py. One of them says this line:
(r'^notification/?$',include("notification.urls")),
I'm supposed to do that because I installed "django_notification" (and added "notification") to INSTALLED_APPs.
Great! going to /notification/ works! This is the urls.py in the notification module:
from django.conf.urls.d... | [
"If you read the documentation, you'll see that the include will remove the part that matches, so you'd have to go to /notification/settings, and /notification/feed\n",
"Solved.\nI removed the ?$ at the end of the url match.\n"
] | [
1,
1
] | [] | [] | [
"django",
"notifications",
"python",
"templates",
"url"
] | stackoverflow_0004631925_django_notifications_python_templates_url.txt |
Q:
If I have a Python virtual environment called "abc" and I rename it, will it still work?
Of course I'll change the paths of Apache configs.
A:
virtualenv hardcodes many paths so, without some tweaking, you cannot just rename its top-level directory. You can try using the virtualenv --relocatable option to do th... | If I have a Python virtual environment called "abc" and I rename it, will it still work? | Of course I'll change the paths of Apache configs.
| [
"virtualenv hardcodes many paths so, without some tweaking, you cannot just rename its top-level directory. You can try using the virtualenv --relocatable option to do the tweaking as described in its documentation (but note it is marked as somewhat experimental).\n"
] | [
4
] | [] | [] | [
"python",
"virtualenv"
] | stackoverflow_0004632189_python_virtualenv.txt |
Q:
How to properly check a List for a match when no match is expected?
New to Python idioms and syntax. I have a Datastore StringListProperty that holds user keys. For most entities this property will have 0-10 keys, sometimes many more. I need to check the property for a key, most often there will be no match.
if... | How to properly check a List for a match when no match is expected? | New to Python idioms and syntax. I have a Datastore StringListProperty that holds user keys. For most entities this property will have 0-10 keys, sometimes many more. I need to check the property for a key, most often there will be no match.
if entity.string_list.index(user_key) is not None:
# ....
This is throwi... | [
"First off, if you're going to do a lot of searching you should use a set or a dictionary instead of a list unless you need to maintain order. Lookup on lists is O(n) and I know that tuples/dictionaries are much better. I believe constant time lookup.\nSecond, you're right about try/catch, you should use that if ... | [
5,
2,
0
] | [] | [] | [
"exception",
"exception_handling",
"google_app_engine",
"list",
"python"
] | stackoverflow_0004632334_exception_exception_handling_google_app_engine_list_python.txt |
Q:
Random List of millions of elements in Python Efficiently
I have read this answer potentially as the best way to randomize a list of strings in Python. I'm just wondering then if that's the most efficient way to do it because I have a list of about 30 million elements via the following code:
import json
from sets ... | Random List of millions of elements in Python Efficiently | I have read this answer potentially as the best way to randomize a list of strings in Python. I'm just wondering then if that's the most efficient way to do it because I have a list of about 30 million elements via the following code:
import json
from sets import Set
from random import shuffle
a = []
for i in range(0... | [
"A couple of possible suggestions:\nimport json\nfrom random import shuffle\n\na = set()\nfor i in range(193):\n with open(\"C:/Twitter/user/user_{0}.json\".format(i)) as json_data:\n data = json.load(json_data)\n a.update(d['su'] for d in data)\n\nprint(\"Cleaned length is {0}\".format(len(a)))\n\... | [
4,
2,
0
] | [] | [] | [
"list",
"performance",
"python",
"random",
"shuffle"
] | stackoverflow_0004632040_list_performance_python_random_shuffle.txt |
Q:
Worried about threading in python on apache server
I don't need the threads to be aware of each other. They just need to preform a task that shouldn't take more than two or three seconds tops. What can I do to guarantee that the tread will not be killed before the task is completed. Also, I need to use the occasio... | Worried about threading in python on apache server | I don't need the threads to be aware of each other. They just need to preform a task that shouldn't take more than two or three seconds tops. What can I do to guarantee that the tread will not be killed before the task is completed. Also, I need to use the occasionally timer thread. The timer is only for a minute but I... | [
"Why don't start these threads in the background? Why do they need to be part of the webserver? I would suggest that you write some scripts that either sit idle in the background all the time, or are called periodically by a cron job. The python scripts could lookup info in the database or even use a file to ind... | [
1
] | [] | [] | [
"apache",
"multithreading",
"python"
] | stackoverflow_0004628424_apache_multithreading_python.txt |
Q:
Send tweets from appengine + python
I'm looking to send tweets from a small app I'm building for the appengine, but can't quite understand how the whole oAuth and all that works.
I have seen from some very basic examples in here (which didn't work for me) to more elaborated examples using tweepy. I've also been to... | Send tweets from appengine + python | I'm looking to send tweets from a small app I'm building for the appengine, but can't quite understand how the whole oAuth and all that works.
I have seen from some very basic examples in here (which didn't work for me) to more elaborated examples using tweepy. I've also been to tweepy samples, and found some useful st... | [
"Perhaps see if any of the other Python Twitter libraries are easier to wrap your mind around?\nFor instance, python-twitter has a very simple interface:\n>>> api = twitter.Api(consumer_key='consumer_key',\n consumer_secret='consumer_secret', access_token_key='access_token',\n access_token_secret='access_toke... | [
3,
1,
1
] | [] | [] | [
"google_app_engine",
"oauth",
"python",
"twitter"
] | stackoverflow_0004631054_google_app_engine_oauth_python_twitter.txt |
Q:
Why doesn't append() work correctly with a dictionary created via zip() with empty lists as values?
Dictionary d works fine, as expected,
In [335]: d={1:[], 2:[]}
In [336]: d[1].append('word')
In [337]: d
Out[337]: {1: ['word'], 2: []}
But dz, which looks identical to d, doesn't work correctly.
In [339]: dz=di... | Why doesn't append() work correctly with a dictionary created via zip() with empty lists as values? | Dictionary d works fine, as expected,
In [335]: d={1:[], 2:[]}
In [336]: d[1].append('word')
In [337]: d
Out[337]: {1: ['word'], 2: []}
But dz, which looks identical to d, doesn't work correctly.
In [339]: dz=dict(zip([1,2],[[]]*2))
In [340]: dz
Out[340]: {1: [], 2: []}
In [341]: dz[1].append('word')
In [342]: ... | [
"This is a common Python gotcha: [[]]*2 creates two references to the same empty list. You want ([], []) or [ [] for _ in xrange(2)] (suitable for long sequences of empty lists).\nSimpler example that represents your zip code:\nIn [1]: dupl = [[]] * 2\n\nIn [2]: dupl[0].append(1)\n\nIn [3]: dupl\nOut[3]: [[1], [1]]... | [
3,
2,
0,
0,
0,
0
] | [] | [] | [
"python"
] | stackoverflow_0004632706_python.txt |
Q:
Start a wsgi app from within virtualenv as a Linux system service
I'm currently developing a bottle app within virtualenv. I intend to serve it using bjoern WSGI server (but that probably doesn't matter too much). I also intend to serve the app with a lighty or nginx reverse proxy. Anyhow, can the app be run from ... | Start a wsgi app from within virtualenv as a Linux system service | I'm currently developing a bottle app within virtualenv. I intend to serve it using bjoern WSGI server (but that probably doesn't matter too much). I also intend to serve the app with a lighty or nginx reverse proxy. Anyhow, can the app be run from within its own virtualenv as a system service? And if so, how would one... | [
"According to my experience, I suggest that you can use Supervisord to run your web server as daemon service. Although you can write some Linux service scripts in /etc/init.d, but they are really difficult to do it correctly. Here is an example init.d script for nginx to run it as a service in Ubuntu. You don't ... | [
4
] | [] | [] | [
"bottle",
"linux",
"python",
"wsgi"
] | stackoverflow_0004572943_bottle_linux_python_wsgi.txt |
Q:
how to monitor python wsgi server,when it crashed restart it
i have a wsgi server which use paste,for some unkonw reason,it will often crash,so i want to has a application or just some package can help me to slove this,when it crashed automaticly kill the process and restart it.Any advice is welcome.
A:
I'd use ... | how to monitor python wsgi server,when it crashed restart it | i have a wsgi server which use paste,for some unkonw reason,it will often crash,so i want to has a application or just some package can help me to slove this,when it crashed automaticly kill the process and restart it.Any advice is welcome.
| [
"I'd use your operational system's service integration to do that. For example, on debian linux, there's start-stop-daemon. On windows, there's the service management.\nIt's the proven, well integrated way, provided by the operational system itself, to keep an application running.\nJust make your installation progr... | [
1,
0
] | [] | [] | [
"crash",
"python",
"restart",
"wsgi"
] | stackoverflow_0003920842_crash_python_restart_wsgi.txt |
Q:
Why will this for loop not return one field from list rather than the list?
import csv
"""sample row = 10/6/2010,73.42,74.43,72.9,74.15,2993500"""
filename_in = 'c:/python27/scripts/fiverows.csv'
reader = csv.reader(open(filename_in, "rb"), dialect="excel", delimiter="\t", quoting =csv.QUOTE_MINIMAL)
for row in... | Why will this for loop not return one field from list rather than the list? | import csv
"""sample row = 10/6/2010,73.42,74.43,72.9,74.15,2993500"""
filename_in = 'c:/python27/scripts/fiverows.csv'
reader = csv.reader(open(filename_in, "rb"), dialect="excel", delimiter="\t", quoting =csv.QUOTE_MINIMAL)
for row in reader:
for item in row:
print 'row = ',row
print 'ite... | [
"You should change delimiter from '\\t' to ','.\n"
] | [
2
] | [] | [] | [
"csv",
"for_loop",
"list",
"python"
] | stackoverflow_0004633157_csv_for_loop_list_python.txt |
Q:
python script to simulate a GET Request + receive the results
how can i make a script to simulate a GET Request + receive the results
so to send this request but to be able to receive the answer also
in python bash or php, etc
GET / HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gec... | python script to simulate a GET Request + receive the results | how can i make a script to simulate a GET Request + receive the results
so to send this request but to be able to receive the answer also
in python bash or php, etc
GET / HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/2004 1107 Firefox/1.0
Accept: text/xml,application/xml,applicati... | [
"you can use curl in bash\ncurl -H \"Accept-Language: en-us,en;q=0.5\" -H \"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\" ... [url]\n\nusefull options:\n\n--keepalive-time \n\n"
] | [
0
] | [] | [] | [
"bash",
"get",
"python",
"request"
] | stackoverflow_0004633229_bash_get_python_request.txt |
Q:
How do I set up the python/c library correctly?
I have been trying to get the python/c library to like my mingW compiler. The python online doncumentation; http://docs.python.org/c-api/intro.html#include-files only mentions that I need to import the python.h file. I grabbed it from the installation directory (as i... | How do I set up the python/c library correctly? | I have been trying to get the python/c library to like my mingW compiler. The python online doncumentation; http://docs.python.org/c-api/intro.html#include-files only mentions that I need to import the python.h file. I grabbed it from the installation directory (as is required on the windows platform), and tested it by... | [
"I've done some crafty Googling, and if you are getting errors at the linker stage (the error messages might have hex strings or references to ld), you may need to make sure the Python library that ships with the Windows version has been converted to a format that GCC (MinGW) can read; see here, among other sites. ... | [
2,
1
] | [] | [] | [
"c",
"python"
] | stackoverflow_0004619640_c_python.txt |
Q:
Convert UTF16LE file to UTF8 in Python?
I have big file with utf16le (BOM) encoding.
Is it possible to convert it to usual UTF8 by python?
Something like
file_old = open('old.txt', mode='r', encoding='utf-16-le')
file_new = open('new.txt', mode='w', encoding='utf-8')
text = file_old.read()
file_new.write(text.en... | Convert UTF16LE file to UTF8 in Python? | I have big file with utf16le (BOM) encoding.
Is it possible to convert it to usual UTF8 by python?
Something like
file_old = open('old.txt', mode='r', encoding='utf-16-le')
file_new = open('new.txt', mode='w', encoding='utf-8')
text = file_old.read()
file_new.write(text.encode('utf-8'))
http://docs.python.org/releas... | [
"You should not be encoding it. Let the stdlib do its job.\nfile_new.write(text)\n\n"
] | [
2
] | [] | [] | [
"encoding",
"python"
] | stackoverflow_0004633444_encoding_python.txt |
Q:
Create chart/statistics for selected mysql table through python
I'd like to start by asking for your opinion on how I should tackle this task, instead of simply how to structure my code.
Here is what I'm trying to do: I have a lot of data loaded into a mysql table for a large number of unique names + dates (i.e.,... | Create chart/statistics for selected mysql table through python | I'd like to start by asking for your opinion on how I should tackle this task, instead of simply how to structure my code.
Here is what I'm trying to do: I have a lot of data loaded into a mysql table for a large number of unique names + dates (i.e., where the date is a separate field). My goal is to be able to select... | [
"Analyze of such data (name,date) could be seen as issuing ad-hoc SQL queries to get timeseries information.\nYou will 'sample' your information by a date/time frame (day/week/month/year or more detailled by hour/minute) depending of how large is your dataset.\nI often use such query where the date field is truncat... | [
2,
0
] | [] | [] | [
"excel_2007",
"mysql",
"mysql_python",
"python"
] | stackoverflow_0002260072_excel_2007_mysql_mysql_python_python.txt |
Q:
Starting gnome-terminal with arguments
Using Python , I would like to start a process in a new terminal window, because so as to show the user what is happening and since there are more than one processes involved.
I tried doing:
>>> import subprocess
>>> subprocess.Popen(['gnome-terminal'])
<subprocess.Popen obje... | Starting gnome-terminal with arguments | Using Python , I would like to start a process in a new terminal window, because so as to show the user what is happening and since there are more than one processes involved.
I tried doing:
>>> import subprocess
>>> subprocess.Popen(['gnome-terminal'])
<subprocess.Popen object at 0xb76a49ac>
and this works as I want,... | [
"$ gnome-terminal --help-all\n\n ...\n\n -e, --command Execute the argument to this option inside the terminal\n\n ...\n\nIf you want the window to stay open then you'll need to run a shell or command that keeps it open afterwards.\n",
"In [5]: import subprocess\n\nIn [6]: import shlex\n\nIn [7... | [
6,
5,
0
] | [] | [] | [
"python",
"subprocess",
"terminal"
] | stackoverflow_0004633738_python_subprocess_terminal.txt |
Q:
Change the view prefix in pyramid traversal from "@@" to "+"
I am looking at moving a web app from pylons to pyramid (formally repoze.bfg) because traversal will fit my app much better than url dispatch.
Currently, when I have a obj with a number of views, I have the view names prefixed with a '+' in the url. e.g.... | Change the view prefix in pyramid traversal from "@@" to "+" | I am looking at moving a web app from pylons to pyramid (formally repoze.bfg) because traversal will fit my app much better than url dispatch.
Currently, when I have a obj with a number of views, I have the view names prefixed with a '+' in the url. e.g.:
/path/to/obj/ (default view)
/path/to/obj/+custom_view1
/path/... | [
"Yes and no, you can change view prefix from \"@@\" but the new prefix should also be 2-symbold length, see sources for traverser.\nSubclassing ResourceTreeTraverser and then registering it instead of the default one should do the trick:\nfrom pyramid.traversal import ResourceTreeTraverser as BaseResourceTreeTraver... | [
3
] | [] | [] | [
"pyramid",
"python",
"repoze.bfg"
] | stackoverflow_0004427617_pyramid_python_repoze.bfg.txt |
Q:
Newbie question about file formatting in Python
I'm writing a simple program in Python 2.7 using pycURL library to submit file contents to pastebin.
Here's the code of the program:
#!/usr/bin/env python2
import pycurl, os
def send(file):
print "Sending file to pastebin...."
curl = pycurl.Curl()
curl.... | Newbie question about file formatting in Python | I'm writing a simple program in Python 2.7 using pycURL library to submit file contents to pastebin.
Here's the code of the program:
#!/usr/bin/env python2
import pycurl, os
def send(file):
print "Sending file to pastebin...."
curl = pycurl.Curl()
curl.setopt(pycurl.URL, "http://pastebin.com/api_public.ph... | [
"First, use .read() as virhilo said.\nThe other step is to use urllib.urlencode() to get a string:\ncurl.setopt(pycurl.POSTFIELDS, urllib.urlencode({\"paste_code\": file}))\n\nThis will also allow you to post more fields:\ncurl.setopt(pycurl.POSTFIELDS, urllib.urlencode({\"paste_code\": file, \"paste_name\": name})... | [
3,
1,
0,
0
] | [] | [] | [
"curl",
"file",
"pastebin",
"python"
] | stackoverflow_0004634079_curl_file_pastebin_python.txt |
Q:
Django admin panel doesn't work after modify default user model
I was trying to extend user profile. I founded a few solutions, but the most recommended was to create new user class containing foreign key to original django.contrib.auth.models.User class. I did it with this so i have in models.py:
class UserProfil... | Django admin panel doesn't work after modify default user model | I was trying to extend user profile. I founded a few solutions, but the most recommended was to create new user class containing foreign key to original django.contrib.auth.models.User class. I did it with this so i have in models.py:
class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True)
... | [
"After some effort I found working solution:\n\nthe AUTH_PROFILE_MODULE = 'content.UserProfile' is required\nplease drop your database (auth_user, yourapp_userprofile tables should be enough)\nfinally python manage.py syncdb\n\n"
] | [
2
] | [] | [] | [
"django",
"django_admin",
"python"
] | stackoverflow_0004634146_django_django_admin_python.txt |
Q:
SGML Parser in Python
I am completely new to Python. I have the following code:
class ExtractTitle(sgmllib.SGMLParser):
def __init__(self, verbose=0):
sgmllib.SGMLParser.__init__(self, verbose)
self.title = self.data = None
def handle_data(self, data):
if self.data is not None:
self.data.append(da... | SGML Parser in Python | I am completely new to Python. I have the following code:
class ExtractTitle(sgmllib.SGMLParser):
def __init__(self, verbose=0):
sgmllib.SGMLParser.__init__(self, verbose)
self.title = self.data = None
def handle_data(self, data):
if self.data is not None:
self.data.append(data)
def start_title(self, ... | [
"Beautiful Soup is one way you could parse it nicely (and it's the way I'd always do it, unless there was some extremely good reason not to do it that way, myself). It's a lot simpler and more readable than using SGMLParser.\n>>> from BeautifulSoup import BeautifulSoup\n>>> soup = BeautifulSoup('''<post id='100'> <... | [
4,
2,
1
] | [] | [] | [
"parsing",
"python",
"sgml"
] | stackoverflow_0004633162_parsing_python_sgml.txt |
Q:
dateTime complaining about whiteSpace in XSD validation (lxml)
I'm trying to validate a document using XSD, and lxml is complaining about whiteSpace in a dateTime value (though it should be collapsing it). I'm not sure if this is a broken behavior, or if I'm just specifying something wrong within the XSD. Spent an... | dateTime complaining about whiteSpace in XSD validation (lxml) | I'm trying to validate a document using XSD, and lxml is complaining about whiteSpace in a dateTime value (though it should be collapsing it). I'm not sure if this is a broken behavior, or if I'm just specifying something wrong within the XSD. Spent an hour trying to debug this, so hoping someone else has experienced s... | [
"It looks like the whitespace is causing the problems. Can you removed the leading and trailing whitespace from createdAt so it becomes\n<createdAt>2008-06-10T01:32:08</createdAt>\n\nand see what happens? If that solves it and you created the XML then change the XML generation so it doesn't have the whitespace. Oth... | [
1
] | [] | [] | [
"python",
"xml"
] | stackoverflow_0004631897_python_xml.txt |
Q:
Why can't I use __getattr__ with Django models?
I've seen examples online of people using __getattr__ with Django models, but whenever I try I get errors. (Django 1.2.3)
I don't have any problems when I am using __getattr__ on normal objects. For example:
class Post(object):
def __getattr__(self, name):
... | Why can't I use __getattr__ with Django models? | I've seen examples online of people using __getattr__ with Django models, but whenever I try I get errors. (Django 1.2.3)
I don't have any problems when I am using __getattr__ on normal objects. For example:
class Post(object):
def __getattr__(self, name):
return 42
Works just fine...
>>> from blog.mo... | [
"One must be careful using __getattr__ . Only intercept what you know, and let the base class handle what you do not.\nThe first step is, can you use a property instead? If you want a \"random\" attribute which return 42 then this is much safer:\nclass Post(...):\n @property\n def random(self):\n return 42\n\n... | [
7,
0
] | [] | [] | [
"django",
"django_models",
"getattr",
"python"
] | stackoverflow_0004630340_django_django_models_getattr_python.txt |
Q:
Python: Convert JSON (returned by URL) into List
I am requesting youtube search terms for use with jquery autocomplete, but am having a hard time converting the URL response into a proper format.
In my (Django/Python) view I do:
data2 = urllib2.urlopen('http://suggestqueries.google.com/complete/search?hl=en&ds=yt&... | Python: Convert JSON (returned by URL) into List | I am requesting youtube search terms for use with jquery autocomplete, but am having a hard time converting the URL response into a proper format.
In my (Django/Python) view I do:
data2 = urllib2.urlopen('http://suggestqueries.google.com/complete/search?hl=en&ds=yt&client=youtube&hjson=t&jsonp=window.yt.www.suggest.han... | [
"remove the &jsonp=window.yt.www.suggest.handleResponse part\nimport json\nimport urllib2\n\ndata = urllib2.urlopen('http://suggestqueries.google.com/complete/search?hl=en&ds=yt&client=youtube&hjson=t&q=jum&cp=3')\n\nj = json.load(data)\nk = [i for i, j, k in j[1]]\nl = json.dumps(k)\n\n",
"You are doing a JSON-P... | [
14,
3,
0,
0
] | [] | [] | [
"json",
"python"
] | stackoverflow_0004634209_json_python.txt |
Q:
Shall I bother with storing DateTime data as julianday in SQLite?
SQLite docs specifies that the preferred format for storing datetime values in the DB is to use Julian Day (using built-in functions).
However, all frameworks I saw in python (pysqlite, SQLAlchemy) store the datetime.datetime values as ISO formatted... | Shall I bother with storing DateTime data as julianday in SQLite? | SQLite docs specifies that the preferred format for storing datetime values in the DB is to use Julian Day (using built-in functions).
However, all frameworks I saw in python (pysqlite, SQLAlchemy) store the datetime.datetime values as ISO formatted strings. Why are they doing so?
I'm usually trying to adapt the framew... | [
"Julian Day is handy for all sorts of date calculations, but it can's store the time part decently (with precise hours, minutes, and seconds). In the past I've used both Julian Day fields (for dates), and seconds-from-the-Epoch (for datetime instances), but only when I had specific needs for computation (of dates a... | [
6,
5,
1,
0
] | [] | [] | [
"datetime",
"pysqlite",
"python",
"sqlalchemy",
"sqlite"
] | stackoverflow_0001386093_datetime_pysqlite_python_sqlalchemy_sqlite.txt |
Q:
Google App Engine Apptrace Error
I am trying to profile my GAE application using Apptrace
When I try to do so, I get the following error
Traceback (most recent call last):
File "/Users/praveensekar/FYP/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appeng... | Google App Engine Apptrace Error | I am trying to profile my GAE application using Apptrace
When I try to do so, I get the following error
Traceback (most recent call last):
File "/Users/praveensekar/FYP/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserv... | [
"It was an issue with old class type. The bug is fixed in Apptrace Version 0.2.2\n"
] | [
2
] | [] | [] | [
"google_app_engine",
"memory_profiling",
"python"
] | stackoverflow_0004627748_google_app_engine_memory_profiling_python.txt |
Q:
How can I print a QString containing a special character with python using PyQt?
I do not managed to simply print a QString variable containing a special character.
I always get a UnicodeEncodeError:
'ascii' codec can't encode characters in position ....
Here is the code I tried without success :
var1 = "éé" ... | How can I print a QString containing a special character with python using PyQt? |
I do not managed to simply print a QString variable containing a special character.
I always get a UnicodeEncodeError:
'ascii' codec can't encode characters in position ....
Here is the code I tried without success :
var1 = "éé" #idem with u"éé"
var2 = QString (var1)
print var2
--->>> UnicodeEncodeError ... | [
"It works for me using toUtf8():\n>>> s = u'éé'\n>>> qs = QString(s)\n>>> qs\nPyQt4.QtCore.QString(u'\\xe9\\xe9')\n>>> print qs\nTraceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\nUnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)\n>>> prin... | [
5,
1
] | [] | [] | [
"pyqt",
"python",
"qstring"
] | stackoverflow_0004626150_pyqt_python_qstring.txt |
Q:
Best way to build an application based on R?
I'm looking for suggestions on how to go about building an application that uses R for analytics, table generation, and plotting. What I have in mind is an application that:
displays various data tables in different tabs, somewhat like in Excel, and the columns should ... | Best way to build an application based on R? | I'm looking for suggestions on how to go about building an application that uses R for analytics, table generation, and plotting. What I have in mind is an application that:
displays various data tables in different tabs, somewhat like in Excel, and the columns should be sortable by clicking.
takes user input paramet... | [
"There are lots of ways to do this, including the python approach you mention. If you want to do it solely within R and if your aims are modest enough, the gWidgets package can be used. This exposes some of the features of either RGtk2, tcltk or qtbase (see the qtinterfaces project on r-forge) in a manner that is a... | [
10,
7,
4,
1
] | [] | [] | [
"python",
"r",
"user_interface"
] | stackoverflow_0004629198_python_r_user_interface.txt |
Q:
auto-populating modelform choice field on the basis of selection of other choice field
I am using django on google app engine on my project.This is my first project so everyday i am finding new problems to face.My modelform is having two fields both having choices.For example, suppose the choice for first form fie... | auto-populating modelform choice field on the basis of selection of other choice field | I am using django on google app engine on my project.This is my first project so everyday i am finding new problems to face.My modelform is having two fields both having choices.For example, suppose the choice for first form field(lets say field1) in models.py is,
TITLE_TYPE = (
('A',A),
('B',B),
)
There are t... | [
"The problem you describe will need some help on the client side, namely javascript. In general: Attach an event listener to field A and set the selected item in B accordingly.\n"
] | [
-1
] | [] | [] | [
"django",
"google_app_engine",
"javascript",
"python"
] | stackoverflow_0004634577_django_google_app_engine_javascript_python.txt |
Q:
Why is a good practice to inherit any class we make from the class 'object'?
In python, why is recommended to inherit any class we make from the class object , why not directly make it as the base class??
An important thing I noticed is that the declaration __slots__ does not work if I make my class as a base clas... | Why is a good practice to inherit any class we make from the class 'object'? | In python, why is recommended to inherit any class we make from the class object , why not directly make it as the base class??
An important thing I noticed is that the declaration __slots__ does not work if I make my class as a base class (instead as a subclass of the class object).
What other advantages/disadvantages... | [
"In Python2, you must inherit from object in order to create a \"new-style\" class. Things like descriptors, super and __slots__ do not work correctly with \"old-style\" classes, but old-style classes remained for backwards compatibility.\nIn Python3, all classes are new-style classes, so inheriting from object is ... | [
7,
0
] | [] | [] | [
"class",
"python"
] | stackoverflow_0004634676_class_python.txt |
Q:
`from x import y` vs. `from x.y import *`
What is the difference between these two lines?
from PyQt4 import QtGui
from PyQt4.QtGui import *
The first line is "import QtGui class from module PyQt4".
But what does second line means? "Import everything from QtGui of module PyQt4".
Is not it the same?
A:
First stat... | `from x import y` vs. `from x.y import *` | What is the difference between these two lines?
from PyQt4 import QtGui
from PyQt4.QtGui import *
The first line is "import QtGui class from module PyQt4".
But what does second line means? "Import everything from QtGui of module PyQt4".
Is not it the same?
| [
"First statement imports the specified module into the current namespace.\nSecond statement imports everything from the specified module into the current namespace. \nSo 1) means you still need to explicitly reference any classes/functions etc through the module namespace\n2) Means you don't \nHere's a compare an... | [
11,
0
] | [] | [] | [
"python"
] | stackoverflow_0004635017_python.txt |
Q:
In Python, why is a module implemented in C faster than a pure Python module, and how do I write one?
The python documentation states, that the reason cPickle is faster than Pickle is, that the former is implemented in C. What does that mean exactly?
I am making a module for advanced mathematics in Python, and som... | In Python, why is a module implemented in C faster than a pure Python module, and how do I write one? | The python documentation states, that the reason cPickle is faster than Pickle is, that the former is implemented in C. What does that mean exactly?
I am making a module for advanced mathematics in Python, and some calculations take a significant amount of time. Does that mean that if my program is implemented in C it ... | [
"You can write fast C code and then use it in your python scripts, so your program will run faster.[1]\nhttp://docs.python.org/extending/index.html#extending-index\nAn example is Numpy, written in C ( https://numpy.org/ )\nTypical use is to implement the bottleneck in C (or to use a library written in C, of course ... | [
17,
10,
9,
7
] | [] | [] | [
"c",
"python",
"python_c_api"
] | stackoverflow_0004616129_c_python_python_c_api.txt |
Q:
How do I delete useless connections in my python script?
I'd better use the following sample codes to explain my problem:
while True:
NewThread = threading.Thread(target = CheckSite, args = ("http://example.com", "http://demo.com"))
NewThread.start()
time.sleep(300)
def CheckSite(Url1, Url2):
tr... | How do I delete useless connections in my python script? | I'd better use the following sample codes to explain my problem:
while True:
NewThread = threading.Thread(target = CheckSite, args = ("http://example.com", "http://demo.com"))
NewThread.start()
time.sleep(300)
def CheckSite(Url1, Url2):
try:
Response1 = urllib2.urlopen(Url1)
Response2... | [
"What exactly do you expect \"delete\" to mean in this context, anyway, and what are you hoping to accomplish?\nPython has automatic garbage collection. These objects are defined, further, in such a way that the connection will be closed whenever the garbage collector gets around to collecting the corresponding obj... | [
3,
1,
0,
0
] | [] | [] | [
"garbage_collection",
"python",
"urllib2"
] | stackoverflow_0004634703_garbage_collection_python_urllib2.txt |
Q:
Get Username from a Cookie
I use the backend solution from django. I just want to get a username from the cookie or the session_key to get to know the user. How I can do it?
from django.contrib.auth.models import User
from django.contrib.sessions.models import Session
def start(request, template_name="registratio... | Get Username from a Cookie | I use the backend solution from django. I just want to get a username from the cookie or the session_key to get to know the user. How I can do it?
from django.contrib.auth.models import User
from django.contrib.sessions.models import Session
def start(request, template_name="registration/my_account.html"):
user_id... | [
"You can check if a user is authenticated by calling the, apptly named, is_authenticated method. Your code would then look somewhat like this:\ndef start(request, template_name=\"registration/my_account.html\"):\n if request.user.is_authenticated():\n name = request.user.username\n return render_to... | [
4,
2,
0
] | [] | [] | [
"django",
"django_views",
"python",
"web"
] | stackoverflow_0004635346_django_django_views_python_web.txt |
Q:
Sending a MIME email prepared beforehand (in PHP or Python)
Is it possible to send a MIME message as it is, without adding any headers? For example, if I have a correct MIME message with all headers and content saved to a text file, is it possible to use the contents of this file without modification and send it v... | Sending a MIME email prepared beforehand (in PHP or Python) | Is it possible to send a MIME message as it is, without adding any headers? For example, if I have a correct MIME message with all headers and content saved to a text file, is it possible to use the contents of this file without modification and send it via SMTP?
Apparently both python's SMTP.sendmail and PHP smtp::mai... | [
"You could read up to the first blank line, use those as additional headers, then send the rest in the body.\n",
"It appears from the documentation that python's SMTP.sendmail should take a sender, a set of recipients, and a verbatim MIME message like the one you have. (The split here between the sender/recipien... | [
0,
0
] | [] | [] | [
"email",
"php",
"python"
] | stackoverflow_0004634171_email_php_python.txt |
Q:
How to optimize this script
I have written the following script. It opens a file, reads each line from it splitting by new line character and deleting first character in line. If line exists it's being added to array. Next each element of array is splitted by whitespace, sorted alphabetically and joined again. Eve... | How to optimize this script | I have written the following script. It opens a file, reads each line from it splitting by new line character and deleting first character in line. If line exists it's being added to array. Next each element of array is splitted by whitespace, sorted alphabetically and joined again. Every line is printed because script... | [
"def main():\n file = open(sys.argv[1])\n\n for line in file:\n if line.rstrip():\n print ''.join(sorted(line[1:-1].split(), key=str.lower()))\n\n",
"Why create the list arr? The file is already a sequence. Why are you creating arr and not doing anything with it except iterating again. ... | [
2,
1,
0,
0,
0
] | [] | [] | [
"optimization",
"python"
] | stackoverflow_0004633905_optimization_python.txt |
Q:
How do I easily manipulate a timestamp key in a Python dictionary?
I just started using Python as hobby, so forgive me if this is a dumb question.
I recently installed a power meter on my computer, and I'm using it to track its power consumption. It gives me real-time minute readings exported to a csv file.
I ha... | How do I easily manipulate a timestamp key in a Python dictionary? | I just started using Python as hobby, so forgive me if this is a dumb question.
I recently installed a power meter on my computer, and I'm using it to track its power consumption. It gives me real-time minute readings exported to a csv file.
I have parsed and read the file, and now I have a dictionary where the key i... | [
"If my understanding to your question is right, this should do the job:\nfrom collections import defaultdict\noutput = defaultdict(int)\nfor key, value in readings.iteritems():\n output[key.tm_hour] += value\n\nThe advantage of using defaultdict is that it will handle the case of missing hours by returning 0 as ... | [
9,
4,
0
] | [] | [] | [
"dictionary",
"python",
"time"
] | stackoverflow_0004635611_dictionary_python_time.txt |
Q:
select package in Java
I am trying to re-write a Python library in Java. I was wondering if any java package was available which is analogous to the select module available in Python.
http://docs.python.org/library/select.html
I have been referred to the nio package but I was wondering if there was a slighly more ... | select package in Java | I am trying to re-write a Python library in Java. I was wondering if any java package was available which is analogous to the select module available in Python.
http://docs.python.org/library/select.html
I have been referred to the nio package but I was wondering if there was a slighly more similar Java implementation.... | [
"Not unless you are willing to write a JNI wrapper for select(2) yourself, or can find one on the 'net. (I looked briefly, and I didn't find one.) That's likely to be a fun little challenge, too, if you want to support Java's notion of an open file (e.g., to map a Java InputStream into a Unix file descriptor).\nThe... | [
6,
1
] | [] | [] | [
"java",
"python",
"select"
] | stackoverflow_0004635929_java_python_select.txt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.