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: distributing independent python app to other machines I created independent python app using cxfreeze under linux and can run it other machines without python and other dependencies. But while doing it for mac OS X, in other machines the app searches for the following python installed location which actually pres...
distributing independent python app to other machines
I created independent python app using cxfreeze under linux and can run it other machines without python and other dependencies. But while doing it for mac OS X, in other machines the app searches for the following python installed location which actually present in the machine where it is frozen. "/Library/Frameworks...
[ "Try py2app for Mac OS X. (And py2exe for Windows.)\n" ]
[ 1 ]
[]
[]
[ "cx_freeze", "distribution", "python" ]
stackoverflow_0003201642_cx_freeze_distribution_python.txt
Q: What is the easiest way to access a a computers microphone in Python? I need to get some numbers so I can generate random numbers using ambient sound. I want something on this level pseudo code: import microphone p = pitch.get() print p Edit: This is in Windows 7, BTW A: Depends on the platform. On Windows, ...
What is the easiest way to access a a computers microphone in Python?
I need to get some numbers so I can generate random numbers using ambient sound. I want something on this level pseudo code: import microphone p = pitch.get() print p Edit: This is in Windows 7, BTW
[ "Depends on the platform. On Windows, this SO question has some answers; for Linux, try this one instead.\n", "I don't know if it is as easy as you would like but I know that it is possible to access the microphone with tksnack. I think it is available on main platforms.\nmicrophone access should be possible wit...
[ 1, 0 ]
[]
[]
[ "audio", "microphone", "python" ]
stackoverflow_0003217885_audio_microphone_python.txt
Q: Scripting Languages I am looking for a good scripting language to link to my program. I am looking for 2 important attributes: Scripting language should be hard linked into the executable (not requiring 3rd party installations). This is important to me to simplify distribution. Scripting should allow some run-ti...
Scripting Languages
I am looking for a good scripting language to link to my program. I am looking for 2 important attributes: Scripting language should be hard linked into the executable (not requiring 3rd party installations). This is important to me to simplify distribution. Scripting should allow some run-time debugging option (When...
[ "Both Lua and Python can provide the features you mention, so choosing one of them will depend on other criteria.\nLua is a lighter weight solution, it will have a much smaller disk footprint and likely a smaller memory overhead than Python too. For some uses it may be faster. Python has a much richer standard libr...
[ 13, 9, 7, 2, 1, 1, 0 ]
[]
[]
[ "dynamic_languages", "lua", "programming_languages", "python", "scripting" ]
stackoverflow_0003193012_dynamic_languages_lua_programming_languages_python_scripting.txt
Q: Virtuozzo and automating commands with Python's subprocesses I'm dealing with a Virtuozzo server and want to automate logging into each container and issuing a few commands in Python by creating a subprocess for 'vzctl enter '. Here is the snippet that I'm working on right now - #!/usr/bin/python import subproces...
Virtuozzo and automating commands with Python's subprocesses
I'm dealing with a Virtuozzo server and want to automate logging into each container and issuing a few commands in Python by creating a subprocess for 'vzctl enter '. Here is the snippet that I'm working on right now - #!/usr/bin/python import subprocess print 'Start' proc = subprocess.Popen(['vzctl enter 123'], ...
[ "Looks like vzctl expects stdin/stdout to be a terminal. You can find out which by experimenting (in bash):\n$ echo whoami | vzctl enter 123 # stdin is not a tty\n\n$ vzctl enter 123 | cat # stdout is not a tty\nwhoami\n<ctrl-d>\n\nYou can use the pty module from the standard library to create pseudottys...
[ 2 ]
[]
[]
[ "python", "subprocess", "virtuozzo" ]
stackoverflow_0003198617_python_subprocess_virtuozzo.txt
Q: A neat way of extending a class attribute in subclasses Let's say I have the following class class Parent(object): Options = { 'option1': 'value1', 'option2': 'value2' } And a subclass called Child class Child(Parent): Options = Parent.Options.copy() Options.update({ 'option2...
A neat way of extending a class attribute in subclasses
Let's say I have the following class class Parent(object): Options = { 'option1': 'value1', 'option2': 'value2' } And a subclass called Child class Child(Parent): Options = Parent.Options.copy() Options.update({ 'option2': 'value2', 'option3': 'value3' }) I want to be ...
[ "Semantically equivalent to your code but arguably neater:\nclass Child(Parent):\n Options = dict(Parent.Options,\n option2='value2',\n option3='value3')\n\nRemember, \"life is better without braces\", and by calling dict explicitly you can often avoid braces (and extra quotes around keys that are const...
[ 21, 8, 6, 4, 2, 2 ]
[]
[]
[ "python" ]
stackoverflow_0000907324_python.txt
Q: how to use session without having to pass it [SqlAlchemy] I want to check diferent values in the DB and create a new value, so i need to query and i don't know if i have to create a session in my SQLAlchemy class or how do i have to do it? using session like a global?, i didn't find in documentation. Somethin like...
how to use session without having to pass it [SqlAlchemy]
I want to check diferent values in the DB and create a new value, so i need to query and i don't know if i have to create a session in my SQLAlchemy class or how do i have to do it? using session like a global?, i didn't find in documentation. Somethin like this: class MyClass(Base): __tablename__ = 'my_class' ...
[ "I found here that we can do Session.object_session(self):\ndef new_value(self):\n #not really DRY\n #the object has to be binded with some session first.\n session = Session.object_session(self) # << this is the important stuff\n\n #check if exist key and key2\n values = session.query(MyClass.valu...
[ 1, 1 ]
[]
[]
[ "python", "sqlalchemy" ]
stackoverflow_0003179108_python_sqlalchemy.txt
Q: sending raw bits to the terminal in python As I understand it, files like /dev/urandom provide just a constant stream of bits. The terminal emulator then tries to interpret them as strings, which results in a mess of unrecognised characters. How would I go about doing the same thing in python, send a string of on...
sending raw bits to the terminal in python
As I understand it, files like /dev/urandom provide just a constant stream of bits. The terminal emulator then tries to interpret them as strings, which results in a mess of unrecognised characters. How would I go about doing the same thing in python, send a string of ones and zeros to the terminal as "raw bits"? edit...
[ "Stephano: the key is the incomplete answer by \"@you\" above - the chr function :\nimport random, sys\n\nfor i in xrange(500):\n sys.stdout.write(chr(random.randrange(256)))\n\n", "Use the chr function. I takes an input between 0 and 255 and returns a string containing the character corresponding to that valu...
[ 3, 1, 0, 0 ]
[]
[]
[ "linux", "python" ]
stackoverflow_0003219598_linux_python.txt
Q: Can i take package of cpython? I used cpython api to load py from C/C++. But, if i want not setup cpython in client, can I take package dll of cpython in my program? How to do that? A: You don't need to setup Python to embed it in applications. The core of the Python interpreter is available as a shared library ...
Can i take package of cpython?
I used cpython api to load py from C/C++. But, if i want not setup cpython in client, can I take package dll of cpython in my program? How to do that?
[ "You don't need to setup Python to embed it in applications. The core of the Python interpreter is available as a shared library which you can dynamically load in your application and distribute with it. \nRead on embedding Python in the official docs. Also, this article seems nice and comprehensive for Linux. For...
[ 1, 1, 0 ]
[]
[]
[ "c", "dll", "installation", "python" ]
stackoverflow_0003219699_c_dll_installation_python.txt
Q: Perceptual Hash Algorithms in Python or PHP? I've been exposed via StackOverflow to pHash, a C++ perceptual hash library for audio, video, images, and text fingerprinting - recently with preliminary bindings for PHP, C# and Java. I'm interested in studying these algorithms and I'm wondering if there are any open-s...
Perceptual Hash Algorithms in Python or PHP?
I've been exposed via StackOverflow to pHash, a C++ perceptual hash library for audio, video, images, and text fingerprinting - recently with preliminary bindings for PHP, C# and Java. I'm interested in studying these algorithms and I'm wondering if there are any open-source pure Python or PHP implementations of the sa...
[ "I have been searching on Google, but not much has come up. Since it seems you want the code for academic purposes, I would suggest:\n\nHit Wikipedia - look up each algorithm and get a feel for how it works\nCheck the pHash site's mailing list - I doubt you are the first person to be curious.\nEmail the authors an...
[ 1 ]
[]
[]
[ "algorithm", "hash", "perception", "php", "python" ]
stackoverflow_0003216901_algorithm_hash_perception_php_python.txt
Q: How can I pass map into py with API? C/C++ can use python API to load py. But, only simple type is supported. How can I pass map into py to be a dict with API? Or, which methods are better? A: Use SWIG, which has some ready-made templates for various STL types. See this, for example. A: The Python C API suppor...
How can I pass map into py with API?
C/C++ can use python API to load py. But, only simple type is supported. How can I pass map into py to be a dict with API? Or, which methods are better?
[ "Use SWIG, which has some ready-made templates for various STL types. See this, for example.\n", "The Python C API supports C-level functionality (not C++ level one) -- basically, you can easily expose to Python things you could put in an extern C block (which doesn't include std::map &c) -- for other stuff, you ...
[ 1, 0 ]
[]
[]
[ "api", "c", "c++", "cpython", "python" ]
stackoverflow_0003219611_api_c_c++_cpython_python.txt
Q: Scale legend box border, dashed and dotted lines when the figure size is changed with matplotlib I'm trying to use matplotlib to prepare some figures for publication. In order to make the font sizes match the text of the manuscript I'm trying to create the figure in the final size to begin with, so that I avoid sc...
Scale legend box border, dashed and dotted lines when the figure size is changed with matplotlib
I'm trying to use matplotlib to prepare some figures for publication. In order to make the font sizes match the text of the manuscript I'm trying to create the figure in the final size to begin with, so that I avoid scaling the figure when inserting it into the manuscript. The problem I'm having is that as the figure i...
[ "To adjust the dashes, use\na.plot(x, y, '--', label='foo bar', dashes=(2,2))\n\nand the legend box line width,\nlg = a.legend()\nfr = lg.get_frame()\nfr.set_lw(0.2)\n\n" ]
[ 9 ]
[]
[]
[ "matplotlib", "plot", "python" ]
stackoverflow_0003190798_matplotlib_plot_python.txt
Q: Updating my program, using a diff-based patch approach Currently my program updates itself by downloading the latest .tar.gz file containing the source code, and extracting it over the current directory where the program lives. There are 2 "modes" of update - one for users running the Python source, and one if the...
Updating my program, using a diff-based patch approach
Currently my program updates itself by downloading the latest .tar.gz file containing the source code, and extracting it over the current directory where the program lives. There are 2 "modes" of update - one for users running the Python source, and one if the user is running the program as a Windows exe. Over time my...
[ "I suggest that rather than reinventing your own update management system, you take a look at open source options, such as google updater (which was open sourced over a year ago as Omaha) -- I imagine the Windows focus is OK since you do specifically refer to Windows, but if you also need Mac support a similar func...
[ 3, 1 ]
[]
[]
[ "diff", "patch", "python" ]
stackoverflow_0003219772_diff_patch_python.txt
Q: Converting videos for iPhone - ffmpeg I'm using the following command in order to convert .avi video files ffmpeg -i -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 320×240 -vcodec libx264 -b 96k -flags +loop -cmp +chroma -partitions +parti4×4+partp8×8+partb8×8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 ...
Converting videos for iPhone - ffmpeg
I'm using the following command in order to convert .avi video files ffmpeg -i -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 320×240 -vcodec libx264 -b 96k -flags +loop -cmp +chroma -partitions +parti4×4+partp8×8+partb8×8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor ...
[ "As far as I know, you need to use AAC for the audio format and MP4 for the container.\nVBITRATE=700\nABITRATE=96\nffmpeg -i inputfile.avi -vcodec mpeg4 -b $VBITRATE -qmin 3 -qmax 5 \\\n -bufsize 4096 -g 300 -acodec aac -ab $ABITRATE \\\n -f mp4 -size 320x240 -r 25 outputfile.mp4\n\nI think it would support...
[ 2 ]
[]
[]
[ "ffmpeg", "iphone", "python", "ubuntu", "video_encoding" ]
stackoverflow_0003219757_ffmpeg_iphone_python_ubuntu_video_encoding.txt
Q: Check if python int is too large to convert to float Is there any way to check if a long integer is too large to convert to a float in python? A: >>> import sys >>> sys.float_info.max 1.7976931348623157e+308 Actually, if you try to convert an integer too big to a float, an exception will be raised. >>> float(2 ...
Check if python int is too large to convert to float
Is there any way to check if a long integer is too large to convert to a float in python?
[ ">>> import sys\n>>> sys.float_info.max\n1.7976931348623157e+308\n\nActually, if you try to convert an integer too big to a float, an exception will be raised.\n>>> float(2 * 10**308)\nTraceback (most recent call last):\n File \"<stdin>\", line 1, in <module>\nOverflowError: Python int too large to convert to C do...
[ 13 ]
[]
[]
[ "floating_point", "integer", "python" ]
stackoverflow_0003220074_floating_point_integer_python.txt
Q: Attaching additional information to form fields I'm trying to pass on additional information to fields of a Django form to be displayed in a template. I tried to override the constructor and add another property to the field like this: self.fields['field_name'].foo = 'bar' but in the template this: {{ form.field_...
Attaching additional information to form fields
I'm trying to pass on additional information to fields of a Django form to be displayed in a template. I tried to override the constructor and add another property to the field like this: self.fields['field_name'].foo = 'bar' but in the template this: {{ form.field_name.foo }} didn't print anything. Does anyone know ...
[ "According to django.forms.forms, the __getitem__() method of a Form creates something called a BoundField out of the Field before returning it, thus stripping it of whatever changes you made. If you really want to insert more functionality into that, override that method to do stuff to the bound field before retur...
[ 7 ]
[]
[]
[ "django", "django_forms", "python" ]
stackoverflow_0003219576_django_django_forms_python.txt
Q: Using ExecuteBatch from Python on Google Calendars API I'm trying to figure out how to add a series of events to a non-default calendar (and remove some) as a batch, but there's no hint of how to do it in Google's frankly awful documentation. Has anyone cracked this nut or does anyone know where there is actually ...
Using ExecuteBatch from Python on Google Calendars API
I'm trying to figure out how to add a series of events to a non-default calendar (and remove some) as a batch, but there's no hint of how to do it in Google's frankly awful documentation. Has anyone cracked this nut or does anyone know where there is actually useful documentation on using the Google Calendar API?
[ "Figured it out in the end. The key is using the right batch URL in ExecuteBatch:\nuri = self.calendar.GetAlternateLink().href\nbatch_uri = uri + u'/batch'\ncalendar_service.ExecuteBatch(request_feed, batch_uri)\n\n" ]
[ 0 ]
[]
[]
[ "batch_file", "google_calendar_api", "python" ]
stackoverflow_0003207883_batch_file_google_calendar_api_python.txt
Q: Drawing a polygon in pygame i am jaison i like to build an application for land survey process. for that i need to plot points in a canvas for a given gsi file. for example the points be a. .b c. .d .e these are the 5 points and i need to develop a tool to connect th...
Drawing a polygon in pygame
i am jaison i like to build an application for land survey process. for that i need to plot points in a canvas for a given gsi file. for example the points be a. .b c. .d .e these are the 5 points and i need to develop a tool to connect these points by line. while closin...
[ "Pygame is absolutely a good tool for this.\nLook into using a pygame.surface object, and the pygame.draw module.\nhttp://www.pygame.org/docs/ref/\nIf you need anything more complicated than dots, pygame.sprite is a relatively well developed module as well.\n", "http://www.pygame.org/docs/ref/draw.html#pygame.dra...
[ 0, 0 ]
[]
[]
[ "gis", "pygame", "python" ]
stackoverflow_0003115467_gis_pygame_python.txt
Q: How to optimize a recursive algorithm to not repeat itself? After finding the difflib.SequenceMatcher class in Python's standard library to be unsuitable for my needs, a generic "diff"-ing module was written to solve a problem space. After having several months to think more about what it is doing, the recursive a...
How to optimize a recursive algorithm to not repeat itself?
After finding the difflib.SequenceMatcher class in Python's standard library to be unsuitable for my needs, a generic "diff"-ing module was written to solve a problem space. After having several months to think more about what it is doing, the recursive algorithm appears to be searching more than in needs to by re-sear...
[ "The technique you are looking for is called memoization.\n", "If you have any expensive method that you are likely to call multiple times with the same parameters then you can just cache the result of the method, using the parameters as a key. \n" ]
[ 6, 0 ]
[]
[]
[ "diff", "optimization", "python", "recursion" ]
stackoverflow_0003220433_diff_optimization_python_recursion.txt
Q: Using Python to scrape DataSet and Query data from RDL I set out today with the intent to parse an SSRS RDL file (XML) using Python in order to gather the DataSet and Query data. A recent project has me back tracking on a variety of reports and data sources with the intention of consolidating and cleaning up what...
Using Python to scrape DataSet and Query data from RDL
I set out today with the intent to parse an SSRS RDL file (XML) using Python in order to gather the DataSet and Query data. A recent project has me back tracking on a variety of reports and data sources with the intention of consolidating and cleaning up what we have published. I was able to use this script to create ...
[ "I know you asked for Python; but I figured Powershell's built in xml handling capabilities would make this fairly simple. While I'm sure it is not guru level, I think it came out pretty nicely (the lines starting with # are comments):\n# The directory to search \n$searchpath = \"C:\\\"\n\n# List all rdl files f...
[ 0 ]
[]
[]
[ "minidom", "python", "rdl", "reporting_services", "xml" ]
stackoverflow_0003206993_minidom_python_rdl_reporting_services_xml.txt
Q: Django iterating - calculating a sum I'm trying to iterate through some values, and calculate a rank. I have a calculate_rank function where I calculate a sum of values. The problem is at the second function. I want that a user's rank to be the sum of all the user that in a follow relation with him. I am doing an...
Django iterating - calculating a sum
I'm trying to iterate through some values, and calculate a rank. I have a calculate_rank function where I calculate a sum of values. The problem is at the second function. I want that a user's rank to be the sum of all the user that in a follow relation with him. I am doing an iteration in the second function here whe...
[ "You're passing follower - ie the full list of followers - into the calculate_rank function. I think you either want a (the current follower in the iteration) or user (the original user being followed) here.\nThese things would be easier to spot if you gave your variables more accurate names. If you'd called the li...
[ 4 ]
[]
[]
[ "django", "function", "loops", "python" ]
stackoverflow_0003221025_django_function_loops_python.txt
Q: python form handle How can I handle html form input (array) like the one below in Python: <input type='hidden' name='a[]' value='some_value'> The following doesn't work: a_value = form["a"].value Please help. Many thanks in advance. A: take a look at http://formencode.org/Validator.html#http-html-form-input in...
python form handle
How can I handle html form input (array) like the one below in Python: <input type='hidden' name='a[]' value='some_value'> The following doesn't work: a_value = form["a"].value Please help. Many thanks in advance.
[ "take a look at http://formencode.org/Validator.html#http-html-form-input\ninput name / value\nnames-1.fname John\nnames-1.lname Doe\nnames-2.fname Jane\nnames-2.lname Brown\n\nwill be parsed into\n{'names': [\n {'fname': \"John\", 'lname': \"Doe\"},\n {'fname': \"Jane\", 'lname': 'Brown'},\n\nU...
[ 4 ]
[]
[]
[ "python" ]
stackoverflow_0003221211_python.txt
Q: Issue with installing mod_wsgi Trying, to figure out why make fails while installing mod_wsgi and getting following errors. Can anyone help me out with to figure out what is wrong ? mod_wsgi.c:13910: warning: parameter names (without types) in function declarati on mod_wsgi.c:13910: warning: data definition has n...
Issue with installing mod_wsgi
Trying, to figure out why make fails while installing mod_wsgi and getting following errors. Can anyone help me out with to figure out what is wrong ? mod_wsgi.c:13910: warning: parameter names (without types) in function declarati on mod_wsgi.c:13910: warning: data definition has no type or storage class mod_wsgi.c:1...
[ "You likely haven't go either python-dev or httpd-dev package installed and so compilation cant find their header files. Read requirements for what needs to be installed in the README of the mod_wsgi source code.\n" ]
[ 1 ]
[]
[]
[ "django", "python" ]
stackoverflow_0003218865_django_python.txt
Q: Python UTF8 string confusion Been banging my head on this for a while and I've read a bunch of articles and the issue isn't any clearer. I have a bunch of strings stored in my database, imagine the following: x = '\xd0\xa4' y = '\x92' At the Python shell I get the following: print x Ф print y ? Which is exactly ...
Python UTF8 string confusion
Been banging my head on this for a while and I've read a bunch of articles and the issue isn't any clearer. I have a bunch of strings stored in my database, imagine the following: x = '\xd0\xa4' y = '\x92' At the Python shell I get the following: print x Ф print y ? Which is exactly what I want to see. However then t...
[ "Looks like you have a typo; should be x = '\\xd0\\xa4'. It helps very much if you use copy paste of what you actually ran and what appeared on the output.\n\"\\x92\" is not a valid UTF-8 string. This explains the exception that you got.\nMore of a puzzle is why print y produced ?. What are you calling \"the Python...
[ 7, 5, 4, 2, 1 ]
[]
[]
[ "django", "python", "unicode" ]
stackoverflow_0003220957_django_python_unicode.txt
Q: Python Textwrap - forcing 'hard' breaks I am trying to use textwrap to format an import file that is quite particular in how it is formatted. Basically, it is as follows (line length shortened for simplicity): abcdef <- Ok line abcdef ghijk <- Note leading space to indicate wrapped line lm Now, I have got code...
Python Textwrap - forcing 'hard' breaks
I am trying to use textwrap to format an import file that is quite particular in how it is formatted. Basically, it is as follows (line length shortened for simplicity): abcdef <- Ok line abcdef ghijk <- Note leading space to indicate wrapped line lm Now, I have got code to work as follows: wrapper = TextWrapper(wi...
[ "It sounds like you are disabling most of the functionality of TextWrapper, and then trying to add a little of your own. I think you'd be better off writing your own function or class. If I understand you right, you're simply looking for lines longer than 80 chars, and breaking them at the 80-char mark, and inden...
[ 1, 1 ]
[]
[]
[ "python", "python_2.4", "python_2.x", "word_wrap" ]
stackoverflow_0002865250_python_python_2.4_python_2.x_word_wrap.txt
Q: Transforming deeply nested dictionary to 1D dictionary with Python I have some deeply randomly nested dictionary as follows. {'CompilationStatistics': {'CodeGeneration': {'EndTime': '2010-04-21T14:03:11', 'StartTime': '2010-04-21T14:03:11', ...
Transforming deeply nested dictionary to 1D dictionary with Python
I have some deeply randomly nested dictionary as follows. {'CompilationStatistics': {'CodeGeneration': {'EndTime': '2010-04-21T14:03:11', 'StartTime': '2010-04-21T14:03:11', 'StepList': {'EliminatingDuplicates': {'EndTime': '2...
[ "Simplest is to do it recursively:\nimport collections\n\ndef flattendict(d, prefix=()):\n r = {}\n for k, v in d.iteritems():\n pk = prefix + (k,)\n if isinstance(v, collections.Mapping):\n r.update(flattendict(v, pk))\n else:\n r['_'.join(pk)] = v\n return r\n\nHere's an example use:\nd = {'...
[ 3, 1, 1 ]
[]
[]
[ "dictionary", "python" ]
stackoverflow_0003221396_dictionary_python.txt
Q: How to copy last X bits? Let's say I have two integers with the following binary representations: 01101010 00110101 And now I want to copy the last 3 bits from the first integer over the second one so that it becomes 00110010 What's the easiest way to do that? (Actually, my goal is to shift the all the X+1 bits ...
How to copy last X bits?
Let's say I have two integers with the following binary representations: 01101010 00110101 And now I want to copy the last 3 bits from the first integer over the second one so that it becomes 00110010 What's the easiest way to do that? (Actually, my goal is to shift the all the X+1 bits to the right one, essentially ...
[ "Depending on your version of python, the way you express binary literals changes, see this question for the details.\nI'm using 2.5.2, so I used this:\n>>> a = int('01101010', 2)\n>>> b = int('00110101', 2)\n>>> mask = 07 # Mask out the last 3 bits.\n>>> (b & ~mask) | (a & mask)\n50\n>>> int('00110010', 2)\n50\n\...
[ 8, 2 ]
[]
[]
[ "binary", "bit_manipulation", "python" ]
stackoverflow_0003221387_binary_bit_manipulation_python.txt
Q: reverse mapping of dictionary with Python Possible Duplicate: Inverse dictionary lookup - Python If I have a dictionary named ref as follows ref = {} ref["abc"] = "def" I can get "def" from "abc" def mapper(from): return ref[from] But, how can I get from "def" to "abc"? def revmapper(to): ?????? A: ...
reverse mapping of dictionary with Python
Possible Duplicate: Inverse dictionary lookup - Python If I have a dictionary named ref as follows ref = {} ref["abc"] = "def" I can get "def" from "abc" def mapper(from): return ref[from] But, how can I get from "def" to "abc"? def revmapper(to): ??????
[ "If you do this often, you'll want to build a reverse dictionary:\n>>> rev_ref = dict((v,k) for k,v in ref.iteritems())\n>>> rev_ref\n{'def': 'abc'}\n\n>>> def revmapper(to):\n... return rev_ref[to]\n\nIf it's rare, and you don't care if it's inefficient, do this:\n>>> def revmapper(to):\n... for k,v in ref.i...
[ 22, 6, 2 ]
[]
[]
[ "dictionary", "python" ]
stackoverflow_0003221475_dictionary_python.txt
Q: Writing a socket-based server in Python, recommended strategies? I was recently reading this document which lists a number of strategies that could be employed to implement a socket server. Namely, they are: Serve many clients with each thread, and use nonblocking I/O and level-triggered readiness notification Se...
Writing a socket-based server in Python, recommended strategies?
I was recently reading this document which lists a number of strategies that could be employed to implement a socket server. Namely, they are: Serve many clients with each thread, and use nonblocking I/O and level-triggered readiness notification Serve many clients with each thread, and use nonblocking I/O and readine...
[ "asyncore is basically \"1\" - It uses select internally, and you just have one thread handling all requests. According to the docs it can also use poll. (EDIT: Removed Twisted reference, I thought it used asyncore, but I was wrong).\n\"2\" might be implemented with python-epoll (Just googled it - never seen it bef...
[ 7, 3, 3, 2, 1, 1 ]
[]
[]
[ "asynchronous", "c10k", "network_programming", "python", "sockets" ]
stackoverflow_0000634107_asynchronous_c10k_network_programming_python_sockets.txt
Q: Difference between LoopingCall and callInThread in Python's Twisted I'm trying to figure out the differences between a task.LoopingCall and a reactor.callInThread in Twisted. All my self.sendLine's in the LoopingCall are performed immediately. The ones in the callInThread are not. They're only sent after the one i...
Difference between LoopingCall and callInThread in Python's Twisted
I'm trying to figure out the differences between a task.LoopingCall and a reactor.callInThread in Twisted. All my self.sendLine's in the LoopingCall are performed immediately. The ones in the callInThread are not. They're only sent after the one in the LoopingCall has finished. Even though I'm sending the right delimit...
[ "\nWhy is that? What's the difference? Aren't they both threads?\n\nNo. LoopingCall uses callLater; it runs the calls in the reactor.\n\nAll my self.sendLine's in the LoopingCall are performed immediately.\n\nYep, as they should be.\n\nThe ones in the callInThread are not.\n\nIt's not so much that they're not perf...
[ 4, 1 ]
[]
[]
[ "multithreading", "python", "sockets", "twisted" ]
stackoverflow_0003220991_multithreading_python_sockets_twisted.txt
Q: How big can variable be, in python? I get an response in Python program from SQL server. How big can this response be? What is the maximum? Coult it be as much as about 100 mb? A: See sys.maxsize: http://docs.python.org/library/sys.html The largest positive integer supported by the platform’s Py_ssize_t type, ...
How big can variable be, in python?
I get an response in Python program from SQL server. How big can this response be? What is the maximum? Coult it be as much as about 100 mb?
[ "See sys.maxsize: http://docs.python.org/library/sys.html\n\nThe largest positive integer supported by the platform’s Py_ssize_t type, and thus the maximum size lists, strings, dicts, and many other containers can have.\n\nOn my MacBook Pro with a 64-bit build of CPython, it's quite sensibly 263-1 bytes:\n>>> impor...
[ 7, 5 ]
[]
[]
[ "python", "variables" ]
stackoverflow_0003221739_python_variables.txt
Q: How to debug a Jquery Dialog I have a fairly basic dialog maker for jquery that works in 2 out of 3 places. In the 3rd instance where I try to use it, the fields in the form are disabled once the dialog is displayed. The general concept behind the code is that the form is on a different page of the website, and f...
How to debug a Jquery Dialog
I have a fairly basic dialog maker for jquery that works in 2 out of 3 places. In the 3rd instance where I try to use it, the fields in the form are disabled once the dialog is displayed. The general concept behind the code is that the form is on a different page of the website, and for convenience, when javascript is...
[ "The Firebug extension for Firefox is great for debugging javascript.\n", "Just to make sure, are you using Firebug?\nhttps://addons.mozilla.org/en-US/firefox/addon/1843/\nIts a boon for debugging javascript especially if you're using firefox, they have 'lite' versions for other browsers as well. Its the de-fact...
[ 1, 1 ]
[]
[]
[ "django", "jquery", "jquery_ui", "python" ]
stackoverflow_0003221792_django_jquery_jquery_ui_python.txt
Q: Why are session methods unbound in sqlalchemy using sqlite? Code replicating the error: from sqlalchemy import create_engine, Table, Column, Integer from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker Base = declarative_base() class Message(Base): __tablename__ = '...
Why are session methods unbound in sqlalchemy using sqlite?
Code replicating the error: from sqlalchemy import create_engine, Table, Column, Integer from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker Base = declarative_base() class Message(Base): __tablename__ = 'messages' id = Column(Integer, primary_key=True) message...
[ "The return value from sessionmaker() is a class. You need to instantiate it before using methods on the instance.\n" ]
[ 11 ]
[]
[]
[ "python", "sqlalchemy", "sqlite" ]
stackoverflow_0003221814_python_sqlalchemy_sqlite.txt
Q: What's the best way to dump a MYSQL table to CSV? Possible Duplicate: Dump a mysql database to a plaintext (CSV) backup from the command line. I prefer python, but if mysqldump works...then how can I do that? A: SELECT ... INTO OUTFILE ...
What's the best way to dump a MYSQL table to CSV?
Possible Duplicate: Dump a mysql database to a plaintext (CSV) backup from the command line. I prefer python, but if mysqldump works...then how can I do that?
[ "SELECT ... INTO OUTFILE ...\n" ]
[ 3 ]
[]
[]
[ "csv", "database", "mysql", "python" ]
stackoverflow_0003222060_csv_database_mysql_python.txt
Q: PIL with Python 2.6.5 on Snow Leopard Install Issues I am at wit's end. I have a working install of python 2.6.5 with numpy and scipy. I want to use it to do some simple PCA which requires importing images. Well, I figured PIL was the way to go for this. So, following a guide, I downloaded and installed libjpeg6-b...
PIL with Python 2.6.5 on Snow Leopard Install Issues
I am at wit's end. I have a working install of python 2.6.5 with numpy and scipy. I want to use it to do some simple PCA which requires importing images. Well, I figured PIL was the way to go for this. So, following a guide, I downloaded and installed libjpeg6-b. I then used the following commands tar zxvf jpegsrc.v6b....
[ "Do you know Macports (or Fink)? The easiest way to install software and packages is via Macports. Alternatively you could have a look at the Portfiles of Macports and see how they are compiling those libs.\n", "You can also use pip to install imaging\nuser easy_install to install pip\n\neasy_install pip\n pip i...
[ 1, 0 ]
[]
[]
[ "python", "python_imaging_library" ]
stackoverflow_0003106893_python_python_imaging_library.txt
Q: Tkinter grid() Manager I am having a bit of trouble with the Tkinter grid() manager. It is spacing the rows too far apart. I have two entry widgets to place, and I need one almost directly under the other. When I place them both on the same row and column, but change the pady option, it places them directly on top...
Tkinter grid() Manager
I am having a bit of trouble with the Tkinter grid() manager. It is spacing the rows too far apart. I have two entry widgets to place, and I need one almost directly under the other. When I place them both on the same row and column, but change the pady option, it places them directly on top of each other. I know there...
[ "Are these the only 2 widgets? Or is there another widget,in another column, that ismore than one row in height? If so, it should add to it the \"rowspan\" attribute.\nIf that is not the case, I suggesttaht for this cell alone (aply to it \"row3span 2), you add a Tkinter.Frame widget, and within this Frame, you si...
[ 2, 2 ]
[]
[]
[ "grid", "python", "tkinter", "tkinter_entry" ]
stackoverflow_0003219765_grid_python_tkinter_tkinter_entry.txt
Q: How do I extract the names from a simple function? I've got this piece of code: import inspect import ast def func(foo): return foo.bar - foo.baz s = inspect.getsource(func) xx = ast.parse(s) class VisitCalls(ast.NodeVisitor): def visit_Name(self, what): if what.id == 'foo': print as...
How do I extract the names from a simple function?
I've got this piece of code: import inspect import ast def func(foo): return foo.bar - foo.baz s = inspect.getsource(func) xx = ast.parse(s) class VisitCalls(ast.NodeVisitor): def visit_Name(self, what): if what.id == 'foo': print ast.dump(what.ctx) VisitCalls().visit(xx) From function ...
[ "import ast, inspect\nimport codegen # by Armin Ronacher\n\ndef func(foo):\n return foo.bar - foo.baz\n\nnames = []\n\nclass CollectAttributes(ast.NodeVisitor):\n def visit_Attribute(self, node):\n names.append(codegen.to_source(node))\n\nsource = inspect.getsource(func)\n\ntree = ast.parse(source)\ngu...
[ 6, 1, 0 ]
[]
[]
[ "abstract_syntax_tree", "codegen", "python" ]
stackoverflow_0003212851_abstract_syntax_tree_codegen_python.txt
Q: How to Connect Python to MySQL DataBase ...? A question about connecting Python To MySQL DB: How Can I Do That ?! Link, If You Have References or ... A: Here's a simple example: import MySQLdb conn = MySQLdb.connect(host="localhost", user="myusername", passwd="mypa...
How to Connect Python to MySQL DataBase ...?
A question about connecting Python To MySQL DB: How Can I Do That ?! Link, If You Have References or ...
[ "Here's a simple example:\nimport MySQLdb\nconn = MySQLdb.connect(host=\"localhost\",\n user=\"myusername\",\n passwd=\"mypassword\",\n db=\"mydb\")\nc = conn.cursor()\nc.execute(\"SELECT mycolumn FROM mytable WHERE id = %s;\", (1,))\nc.fetchone()\nc...
[ 1, 0, 0 ]
[]
[]
[ "database", "mysql", "python" ]
stackoverflow_0003222693_database_mysql_python.txt
Q: General guidelines for developing a web application As a programmer used to developing native applications, I'm expanding my horizons and developing my first web app. I'm intermediate to expert with Linux and C, intermediate with Python and HTML and beginner to intermediate with MySQL and Java. I'm developing a we...
General guidelines for developing a web application
As a programmer used to developing native applications, I'm expanding my horizons and developing my first web app. I'm intermediate to expert with Linux and C, intermediate with Python and HTML and beginner to intermediate with MySQL and Java. I'm developing a web app that is more or less a resource allocator for a fri...
[ "\n\nIs there anything missing to my general approach for developing a web app? (Server-side scripting interacts with database to produce dynamic HTML which is then manipulated client-side via. the DOM/client-side scripting).\n\n\nNo - that's the usual setup. Actually, client-side scripting is quite often missing, ...
[ 3, 2, 1 ]
[]
[]
[ "database", "dom", "python" ]
stackoverflow_0003222654_database_dom_python.txt
Q: Why is Python 3.1 slower than 2.6 for this code? Consider the following code (from here, with the number of tests increased): from timeit import Timer def find_invpow(x,n): """Finds the integer component of the n'th root of x, an integer such that y ** n <= x < (y + 1) ** n. """ high = 1 while...
Why is Python 3.1 slower than 2.6 for this code?
Consider the following code (from here, with the number of tests increased): from timeit import Timer def find_invpow(x,n): """Finds the integer component of the n'th root of x, an integer such that y ** n <= x < (y + 1) ** n. """ high = 1 while high ** n < x: high *= 2 low = high/2 ...
[ "I got steadily decreasing times from 2.5, 2.6, 2.7 and 3.1 (Windows XP SP2) ... with the \"/\" version. With the //, the 3.1 times were dramatically smaller than the 2.X times e.g. \"Norm\" dropped from 6.35 (py2.7) to 3.62 (py3.1).\nNote that in 2.x, there are ints (machine word, 32 or 64 bits) and longs (variabl...
[ 3, 2 ]
[]
[]
[ "performance", "python", "python_3.x" ]
stackoverflow_0003222554_performance_python_python_3.x.txt
Q: csv file column reading and extracting using python i have the following code... reader=csv.DictReader(open("test1.csv","r")) allrows = list(reader) keepcols = [c for c in allrows[0] if all(r[c] != '0' for r in allrows)] print keepcols writer=csv.DictWriter(open("output1.csv","w"),fieldnames='keepcols',extrasact...
csv file column reading and extracting using python
i have the following code... reader=csv.DictReader(open("test1.csv","r")) allrows = list(reader) keepcols = [c for c in allrows[0] if all(r[c] != '0' for r in allrows)] print keepcols writer=csv.DictWriter(open("output1.csv","w"),fieldnames='keepcols',extrasaction='ignore') writer.writerows(allrows) i have a csv fil...
[ "Edit: If the input file is a comma-separated values file, then \nto maintain the order of the keys, use reader.fieldnames instead of the keys in allrows[0].\nSo the solution would be:\nkeepcols = [c for c in reader.fieldnames if any(r[c] != '0' for r in allrows)]\n\nThe input file posted above looks like it has sp...
[ 4 ]
[]
[]
[ "csv", "python" ]
stackoverflow_0003222831_csv_python.txt
Q: Save an email.Message object into a file I am trying to modify emails stored as text files. I first import a message like this : import email f = open('filename') msg = email.message_from_file(f) Then, I make all the modifications I want, using the features of the email module. The last step is to save the Messag...
Save an email.Message object into a file
I am trying to modify emails stored as text files. I first import a message like this : import email f = open('filename') msg = email.message_from_file(f) Then, I make all the modifications I want, using the features of the email module. The last step is to save the Message object (msg) in a file. What is the piece of...
[ "The Messsage.as_string method should give you a flattened version of the message that you can write out just as you would any other string:\nmsg.as_string()\nIf this doesn't provide exactly the format you want, consider trying the email.generator module? If I read things correctly, you should be able to do somethi...
[ 5 ]
[]
[]
[ "python" ]
stackoverflow_0003222921_python.txt
Q: Some advices for creating a WMS service and a desktop client? I'm learning to create a WMS service using MapServer and after that I want to develop a PyQt desktop application which will access it. I don't know what is the best way to do that because I have seen a lot of web solutions but it's not what I'm looking ...
Some advices for creating a WMS service and a desktop client?
I'm learning to create a WMS service using MapServer and after that I want to develop a PyQt desktop application which will access it. I don't know what is the best way to do that because I have seen a lot of web solutions but it's not what I'm looking for. Neither I know if there are libraries that can help me. Can yo...
[ "I'm assuming you have no trouble setting up a WMS service on MapServer. Test this is working with a GIS desktop client, or a simple OpenLayers web page. \nTo develop a WMS client I'd build on top of the GDAL library. This is also included in MapServer. \n\nGDAL has the ability to read images\n from a remote WMS s...
[ 1 ]
[]
[]
[ "gis", "pyqt", "python", "wms" ]
stackoverflow_0003222954_gis_pyqt_python_wms.txt
Q: geo name database (city, points of interest) I am building a travel website with django. When a user is typing in the destination city name (or points of interest, like yellow stone), I want to do ajax auto suggestion. The question is how I could get the suggestion database? Is there any web service? Best if it c...
geo name database (city, points of interest)
I am building a travel website with django. When a user is typing in the destination city name (or points of interest, like yellow stone), I want to do ajax auto suggestion. The question is how I could get the suggestion database? Is there any web service? Best if it could also support foreign cities. Thanks a lot.
[ "What you want is called a gazetteer database.\nThe official USGS gazetteer for the USA is available for download.\nTwo global geocoded databases include:\nGeonames has a free list of cities and POI. It includes the USGS gazetteer and lots of other info. You might have to subset their database however, as it migh...
[ 6, 1 ]
[]
[]
[ "autosuggest", "django", "geography", "gis", "python" ]
stackoverflow_0002970830_autosuggest_django_geography_gis_python.txt
Q: Problems regarding Boost::Python and Boost::Threads Me and a friend are developing an application which uses Boost::Python. I have defined an interface in C++ (well a pure virtual class), exposed through Boost::Python to the users, who have to inherit from it and create a class, which the application takes and use...
Problems regarding Boost::Python and Boost::Threads
Me and a friend are developing an application which uses Boost::Python. I have defined an interface in C++ (well a pure virtual class), exposed through Boost::Python to the users, who have to inherit from it and create a class, which the application takes and uses for some callback mechanism. Everything that far goes p...
[ "Python can be called from multiple threads serially, I don't think that's a problem. It sounds to me like your errors are just coming from bad C++ code, as you said the errors happened after PY_BEGIN_ALLOW_THREADS and before PY_END_ALLOW_THREADS.\nIf you know that's not true, can you post a little more of your ac...
[ 1 ]
[]
[]
[ "boost_python", "boost_thread", "c++", "python" ]
stackoverflow_0003197236_boost_python_boost_thread_c++_python.txt
Q: How to use nose with IronPython? I installed nose using the 'setup.py install' on the command line , I am able to run 'nosetests' and any python file matching testMatch regular expression is picked up and tests are automated in the %python home%\Scripts directory. Now I want nose to work with my iron Python files ...
How to use nose with IronPython?
I installed nose using the 'setup.py install' on the command line , I am able to run 'nosetests' and any python file matching testMatch regular expression is picked up and tests are automated in the %python home%\Scripts directory. Now I want nose to work with my iron Python files , how do I install nose on the %Iron P...
[ "Your solution is actually all nosetests does:\n#!/usr/bin/env python\n\nfrom nose import main\n\nif __name__ == '__main__':\n main()\n\nYou'll want to make sure you add your system's Python lib to the path for it to find the nose extensions:\n>>>import sys\n>>>sys.path.append(r'C:\\Python26\\lib')\n\nAnd you'll...
[ 0, 0 ]
[]
[]
[ "ironpython", "nosetests", "python" ]
stackoverflow_0003198500_ironpython_nosetests_python.txt
Q: Manipulate and print to PDF files in a script I have several pdf files of some lecture slides. I want to do the following: print every pdf file to another pdf file in which there are 6 slides per page and then merge all the resulting files to one big file while making sure that every original file starts on an odd...
Manipulate and print to PDF files in a script
I have several pdf files of some lecture slides. I want to do the following: print every pdf file to another pdf file in which there are 6 slides per page and then merge all the resulting files to one big file while making sure that every original file starts on an odd page number (Edit: obviously, it will be printed i...
[ "If it were me, I would use PDFjam or a similar tool to perform the 6-up on each of the source documents.\nI would then use PyPDF to calculate the number of pages in each, add a blank page if necessary, and merge the rest of the pages. Something like:\nblank_page = PDFFileReader('blank.pdf').pages[0]\ndest = PDFFil...
[ 3, 1 ]
[]
[]
[ "pdf_generation", "python" ]
stackoverflow_0003222960_pdf_generation_python.txt
Q: Is it possible, and/or advisable to develop Django web applications on OS X (10.6.4 and 10.5.8) using Python 2.6.5 64-bit? Why? I'm trying to decide on which architecture to choose for developing Django 1.0.x through Django 1.2.1. I've managed to get MySQL, MySQLdb, PIL, and Python 2.65 installed on Snow Leopard u...
Is it possible, and/or advisable to develop Django web applications on OS X (10.6.4 and 10.5.8) using Python 2.6.5 64-bit? Why?
I'm trying to decide on which architecture to choose for developing Django 1.0.x through Django 1.2.1. I've managed to get MySQL, MySQLdb, PIL, and Python 2.65 installed on Snow Leopard using x86 64-bit builds, but I'm curious as to whether or not there is a definitive answer to this question at the moment, and if so, ...
[ "Of course it's possible. Advisable? You didn't mention httpd and mod_wsgi, or some other WSGI container. Get one installed and it should be fine.\n", "It certainly is possible: I do it every day.\nSome tips: \n\nuse virtualenv to sandbox your python packages between projects.\nuse mod_passenger (via Passenger.pr...
[ 1, 1 ]
[]
[]
[ "64_bit", "django", "python", "python_2.6", "x86_64" ]
stackoverflow_0003176695_64_bit_django_python_python_2.6_x86_64.txt
Q: Since Django 1.2.1 'prepopulated_fields' won't prepopulate in the admin Since Django 1.2.1 'prepopulated_fields' won't prepopulate in the admin. prepopulated_fields = {'slug': ('title',)} doesn't seem to work since uploading to a Django 1.2.1 server after developing on a 1.1.1. What changed? I read http://code.dj...
Since Django 1.2.1 'prepopulated_fields' won't prepopulate in the admin
Since Django 1.2.1 'prepopulated_fields' won't prepopulate in the admin. prepopulated_fields = {'slug': ('title',)} doesn't seem to work since uploading to a Django 1.2.1 server after developing on a 1.1.1. What changed? I read http://code.djangoproject.com/wiki/NewformsAdminBranch#Changedprepopulate_fromtobedefinedin...
[ "It happened to me exactly when upgrading from django 1.1.1 to 1.2.1. It is because the media/admin directory it has changed, before it was something like that: media/admin/js/admin and now is: admin/media/js/admin.\nWhat I did was to change in settings ADMIN_MEDIA_PREFIX = '/media/admin/'\nTo be sure when you are ...
[ 3, 0, 0 ]
[]
[]
[ "admin", "django", "python" ]
stackoverflow_0003221666_admin_django_python.txt
Q: how can I get the ip address of the request in a regested function of python xmlrpc server I'm writing a simple xmlrpc programe in python. something like the following: def foo(data): # I want get the calling client's IP address here... How can I ? server=SimpleXMLRPCServer.SimpleXMLRPCServer((host, port)) ...
how can I get the ip address of the request in a regested function of python xmlrpc server
I'm writing a simple xmlrpc programe in python. something like the following: def foo(data): # I want get the calling client's IP address here... How can I ? server=SimpleXMLRPCServer.SimpleXMLRPCServer((host, port)) server.register_function(foo) server.handle_request() As can be seen in the above, I want to...
[ "You may do so by subclassing the server (and possibly the handler, too). E.g.:\nclass MyXMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer):\n def process_request(self, request, client_address):\n self.client_address = client_address\n return SimpleXMLRPCServer.SimpleXMLRPCServer.process_request(...
[ 3 ]
[]
[]
[ "call", "ip", "python", "xml_rpc" ]
stackoverflow_0003223373_call_ip_python_xml_rpc.txt
Q: Escaping … with BeautifulSoup I am currrently using BeautifulSoup to scrape some websites, however I have a problem with some specific characters, the code inside UnicodeDammit seems to indicate this (again) are some Microsoft-invented ones. I'm using the newest version of BeautifulSoup(3.0.8.1) as I am still usin...
Escaping … with BeautifulSoup
I am currrently using BeautifulSoup to scrape some websites, however I have a problem with some specific characters, the code inside UnicodeDammit seems to indicate this (again) are some Microsoft-invented ones. I'm using the newest version of BeautifulSoup(3.0.8.1) as I am still using python2.5 The following code illu...
[ "Found the solution myself:\nsoup = BeautifulSoup('...Baby One More Time (Digital Deluxe Version&hellip;', convertEntities=\"html\")\n\n", "MS may have invented it, but &hellip; is part of HTML 4: http://www.w3.org/TR/REC-html40/sgml/entities.html\nPerhaps your Lib/htmlentitydefs.py is missing or out-of-date, as ...
[ 2, 1 ]
[]
[]
[ "beautifulsoup", "escaping", "python", "web_scraping" ]
stackoverflow_0003155674_beautifulsoup_escaping_python_web_scraping.txt
Q: generating equation png files based on mathematical input I was wondering what options were available to generate .png based on the kind of input one feeds a graphing calculator.. so (y^2 + 5x + 3) / ((3x + 3) + 5y + 18) would return The only thing I've found so far is texvc in mediawiki, but it seems overkill t...
generating equation png files based on mathematical input
I was wondering what options were available to generate .png based on the kind of input one feeds a graphing calculator.. so (y^2 + 5x + 3) / ((3x + 3) + 5y + 18) would return The only thing I've found so far is texvc in mediawiki, but it seems overkill to get the whole mediawiki for one of it's modules.
[ "The Google Chart API has this function, it takes TeX input and creates an output image.\n\n\n\nAnother option is jsMath.\n", "There's dvipng that ships with TeX. It has a lot of parameters to twiddle. That's good if you want such control, but bad if you'd like something simpler to use.\n", "An option using Mat...
[ 9, 2, 2, 2, 1, 0 ]
[]
[]
[ "equation", "math", "python" ]
stackoverflow_0003219098_equation_math_python.txt
Q: Custom function decorator for views that modified the request path Could someone show me how i could write a login decorator like @redirect_to_home for my views so that it modifies the request.PATH variable to a new a value like / whenever it is applied to a view. I've seen people do quite complex stuff with decor...
Custom function decorator for views that modified the request path
Could someone show me how i could write a login decorator like @redirect_to_home for my views so that it modifies the request.PATH variable to a new a value like / whenever it is applied to a view. I've seen people do quite complex stuff with decorators: I'm yet to figure them out thoroughly. Thanks
[ "The best way to start is to understand the login decorator from the django project ( auth module ):\nhttp://code.djangoproject.com/browser/django/trunk/django/contrib/auth/decorators.py#L33\nIf you look at the \"user_passes_test\" function you'll see how to access request object.\nA good tutorial about decorators ...
[ 3, 1 ]
[]
[]
[ "decorator", "django", "django_views", "python" ]
stackoverflow_0003224083_decorator_django_django_views_python.txt
Q: How to render HTML form from schema using formencode? I'm using formencode for validating and submitting forms in my Pylons application. The documentation says that it can be used also for generating forms, but there is no any example. I even found the old topic which says it can be done with form = HTMLForm(form...
How to render HTML form from schema using formencode?
I'm using formencode for validating and submitting forms in my Pylons application. The documentation says that it can be used also for generating forms, but there is no any example. I even found the old topic which says it can be done with form = HTMLForm(form_template, FormSchema) form.render() but for the latest ve...
[ "Formencode library doesn't generate html for forms. \nThe code you are referring to uses formencode.htmlform module which no longer exists as it was removed in 1.1 release because, as author said, it was dumb. :)\nI think you may have mistaken that kind of functionality with different feature of this lib, namely f...
[ 1, 0 ]
[]
[]
[ "formencode", "forms", "html", "pylons", "python" ]
stackoverflow_0003222408_formencode_forms_html_pylons_python.txt
Q: Python - Acquire value from dictionary depending on location/index in list From MySQL query I get data which I put into a dictionary "d": d = {0: (datetime.timedelta(0, 25200),), 1: (datetime.timedelta(0, 25500),), 2: (datetime.timedelta(0, 25800),), 3: (datetime.timedelta(0, 26100),), 4: (datetime.timede...
Python - Acquire value from dictionary depending on location/index in list
From MySQL query I get data which I put into a dictionary "d": d = {0: (datetime.timedelta(0, 25200),), 1: (datetime.timedelta(0, 25500),), 2: (datetime.timedelta(0, 25800),), 3: (datetime.timedelta(0, 26100),), 4: (datetime.timedelta(0, 26400),), 5: (datetime.timedelta(0, 26700),)} I have a list "m" with...
[ "I'm not entirely sure if this is what you're looking for, but I'll take a shot:\n>>> indices = [index for index, i in enumerate(m) if i == 4]\n>>> h = [d[i][0] for i in indices]\n\nThen you have to process the timedeltas as you want to.\n", "deltas = [str(d[i][0]) for i, j in enumerate(m) if j == 4]\n\nproduces ...
[ 2, 0, 0 ]
[ "Are you asking for\ndef hms( td ):\n h = dt.seconds // 3600\n m = dt.seconds%3600 // 60\n s = dt.seconds%60\n return h+td.days*24, m, s\n\n\n[ hms(d[ m[i] ]) for i in m ]\n\n?\n" ]
[ -1 ]
[ "dictionary", "list", "python" ]
stackoverflow_0000653765_dictionary_list_python.txt
Q: Fuzzy runtime search without using database\index I need to filter stream of text articles by checking every entry for fuzzy matches of predefined string(I am searching for misspelled product names, sometime they have different order of words and extra non letter characters like ":" or ","). I get excellent resul...
Fuzzy runtime search without using database\index
I need to filter stream of text articles by checking every entry for fuzzy matches of predefined string(I am searching for misspelled product names, sometime they have different order of words and extra non letter characters like ":" or ","). I get excellent results by putting this articles in sphinx index and perform...
[ "This problem is almost identical to Bayesian spam filtering and tools already written for that can just be trained to recognize according to your criteria.\nadded in response to comment:\nSo how are you partitioning the stream into bins now? If you already have a corpus of separated articles, just feed that into t...
[ 1, 1 ]
[]
[]
[ "full_text_search", "fuzzy_search", "python" ]
stackoverflow_0003224207_full_text_search_fuzzy_search_python.txt
Q: what suits the most for creating interface? i have an application of text to speech convertor and now want to prepare an graphical interface for it.I did whole of the coding involved in python..i want to know which languages can be used for creating the GUI so that i can connect my python code to it easily..can py...
what suits the most for creating interface?
i have an application of text to speech convertor and now want to prepare an graphical interface for it.I did whole of the coding involved in python..i want to know which languages can be used for creating the GUI so that i can connect my python code to it easily..can python be used for creating the gui.. as i have no ...
[ "Yes, a GUI can be created in Python, I recommend wxPython.\n", "You can find a list of GUI programming packages for Python in this page http://wiki.python.org/moin/GuiProgramming\n", "There are many GUI toolkits for python:\nhttp://wiki.python.org/moin/GuiProgramming\nI would look at PyQT and wxPython first.\n...
[ 0, 0, 0, 0 ]
[]
[]
[ "python", "user_interface" ]
stackoverflow_0003083697_python_user_interface.txt
Q: Python: list of lists anf HTML table help I'm having trouble appending the values from a list of lists into a html table, for example my list if lists contains: food_list = [['A','B'], ['Apple','banana'], ['Fruit','Fruit']] How would i append each value into a correspondong HTML table? So the code looks like: <ta...
Python: list of lists anf HTML table help
I'm having trouble appending the values from a list of lists into a html table, for example my list if lists contains: food_list = [['A','B'], ['Apple','banana'], ['Fruit','Fruit']] How would i append each value into a correspondong HTML table? So the code looks like: <table> <tr><td>A</td><td>Apple</td><td>Fruit</td>...
[ "I would do it like this;\n# Example data.\nraw_rows = [[\"A\", \"B\"], [\"Apple\", \"Banana\"], [\"Fruit\", \"Fruit\"]]\n# \"zips\" together several sublists, so it becomes [(\"A\", \"Apple\", \"Fruit\"), ...].\nrows = zip(*raw_rows) \n\nhtml = \"<table>\"\nfor row in rows:\n html += \"<tr>\"\n # Make <tr>-pai...
[ 3, 3, 0 ]
[]
[]
[ "html", "python" ]
stackoverflow_0003224657_html_python.txt
Q: Python/Django or C#/ASP.NET for web development? I am a .NET developer. I have no experience on Python. Which platform is more scalable? Which platform is more suitable for large-size high-traffic web sites? If you have any experience about scalability on these platforms, please inform us. Thank you. A: Much as ...
Python/Django or C#/ASP.NET for web development?
I am a .NET developer. I have no experience on Python. Which platform is more scalable? Which platform is more suitable for large-size high-traffic web sites? If you have any experience about scalability on these platforms, please inform us. Thank you.
[ "Much as I love Python (and, that's a LOT!-), if you're highly skilled at C# and, as you say, \"have no experience on Python\", your code will be more scalable and suitable (for the next several months, at least) if you stick with what you know best. For a hypothetical developer extremely skilled at both platforms,...
[ 16, 14, 3, 1 ]
[]
[]
[ "asp.net", "django", "python", "scalability" ]
stackoverflow_0001031438_asp.net_django_python_scalability.txt
Q: Python: Sanitize a string for unicode? Possible Duplicate: Python UnicodeDecodeError - Am I misunderstanding encode? I have a string that I'm trying to make safe for the unicode() function: >>> s = " foo “bar bar ” weasel" >>> s.encode('utf-8', 'ignore') Traceback (most recent call last): File "<pyshell#8>", ...
Python: Sanitize a string for unicode?
Possible Duplicate: Python UnicodeDecodeError - Am I misunderstanding encode? I have a string that I'm trying to make safe for the unicode() function: >>> s = " foo “bar bar ” weasel" >>> s.encode('utf-8', 'ignore') Traceback (most recent call last): File "<pyshell#8>", line 1, in <module> s.encode('utf-8', '...
[ "Good question. Encoding issues are tricky. Let's start with \"I have a string.\" Strings in Python 2 aren't really \"strings,\" they're byte arrays. So your string, where did it come from and what encoding is it in? Your example shows curly quotes in the literal, and I'm not even sure how you did that. I try to pa...
[ 41, 5 ]
[]
[]
[ "character_encoding", "python", "unicode" ]
stackoverflow_0003224427_character_encoding_python_unicode.txt
Q: Learning Python, is there a better way to write this? I am learning Python (2.7) and to test what I have learned so far I wrote a temperature converter that converts Celsius to Fahrenheit and I wanted to know if my code could be written better to be faster or something more Pythonic. And could someone tell me if t...
Learning Python, is there a better way to write this?
I am learning Python (2.7) and to test what I have learned so far I wrote a temperature converter that converts Celsius to Fahrenheit and I wanted to know if my code could be written better to be faster or something more Pythonic. And could someone tell me if there is an actual name for the if __name__ == '__main__': m...
[ "import sys\n\ndef to_f(c): # Convert celsius to fahrenheit\n return (c * 9/5) + 32\n\ndef to_c(f): # Convert fahrenheit to celsius\n return (f - 32) * 5/9\n\ndef convert(args):\n if len(args) < 2:\n return 1 # If less than two arguments\n t = args[1]\n if args[0] == '-f': # If the first argum...
[ 11, 4, 3, 1 ]
[]
[]
[ "python" ]
stackoverflow_0003224412_python.txt
Q: Detect data type from XML string using python I have some XML tagged string as follows. <Processor>AMD Athlon(tm) 64 X2 Dual Core Processor 4400+ 2.31 GHz</Processor> <ClockSpeed>2.31</ClockSpeed> <NumberOfCores>2</NumberOfCores> <InstalledMemory>2.00</InstalledMemory> <OperatingSystem>Windows 7 Professional</Oper...
Detect data type from XML string using python
I have some XML tagged string as follows. <Processor>AMD Athlon(tm) 64 X2 Dual Core Processor 4400+ 2.31 GHz</Processor> <ClockSpeed>2.31</ClockSpeed> <NumberOfCores>2</NumberOfCores> <InstalledMemory>2.00</InstalledMemory> <OperatingSystem>Windows 7 Professional</OperatingSystem> How can I detect the data type automa...
[ "One possibility is to try various types in precise sequence, defaulting to str if none of those work. E.g.:\ndef what_type(s, possible_types=((int, [0]), (float, ()))):\n for t, xargs in possible_types:\n try: t(s, *xargs)\n except ValueError: pass\n else: return t\n return str\n\nThis ...
[ 3, 2, 0 ]
[]
[]
[ "python", "sqlite" ]
stackoverflow_0003224969_python_sqlite.txt
Q: Change the gcc version that distutils uses I'm on Snow Leopard, and want distutils to use gcc 4.0 and not 4.2, can anyone tell me how to make it do that? I've tried changing the /usr/bin/g* symlinks, and setting the C* environment vars -- but to no avail. Any thoughts? A: Did you try python setup.py build --comp...
Change the gcc version that distutils uses
I'm on Snow Leopard, and want distutils to use gcc 4.0 and not 4.2, can anyone tell me how to make it do that? I've tried changing the /usr/bin/g* symlinks, and setting the C* environment vars -- but to no avail. Any thoughts?
[ "Did you try python setup.py build --compiler=gcc? it is described in the docs.\nEDIT:\nAlso, this discussion looks very similar the present one. distutils.core appears to have the functions to specify the compiler and platform. distutils.ccompiler.get_compiler(osname, platform) or distutils.ccompiler.new_compile...
[ 0 ]
[]
[]
[ "distutils", "gcc", "osx_snow_leopard", "python" ]
stackoverflow_0003224934_distutils_gcc_osx_snow_leopard_python.txt
Q: Removing HTML tags from a unicode string in Python I have a strong that I scraped from an XML file and It contains some HTML formatting tags (<b>, <i>, etc) Is there a quick and easy way to remove all of these tags from the text? I tried str = str.replace("<b>","") and applied it several times to other tags, b...
Removing HTML tags from a unicode string in Python
I have a strong that I scraped from an XML file and It contains some HTML formatting tags (<b>, <i>, etc) Is there a quick and easy way to remove all of these tags from the text? I tried str = str.replace("<b>","") and applied it several times to other tags, but that doesn't work
[ "Using lxml.html:\nlxml.html.fromstring(s).text_content()\n\nThis strips all tags and converts all entities to their corresponding characters.\n", "Answer depends on your exact needs. You might have a look at regular expressions. But I would advise you to use http://www.crummy.com/software/BeautifulSoup/ if you w...
[ 6, 1, 1 ]
[]
[]
[ "html", "python", "replace", "string", "unicode" ]
stackoverflow_0003224358_html_python_replace_string_unicode.txt
Q: Jinja2: Looking for a View-Helper I'am new to the Jinja2 template engine. Is there something like the view-helpers from Zend Framework? Can i create simple functions and reuse them all over all my template-files? Something like this? #somewhere in my python code: def nice_demo_function(message): """"return a s...
Jinja2: Looking for a View-Helper
I'am new to the Jinja2 template engine. Is there something like the view-helpers from Zend Framework? Can i create simple functions and reuse them all over all my template-files? Something like this? #somewhere in my python code: def nice_demo_function(message): """"return a simple message""" return message So...
[ "There are a number of ways you can expose helper functions to your templates. You could define them using macros, and then import them into templates that use them. You could add functions to the globals attribute of your Template objects, or pass them to the render() method. You could subclass Template to do t...
[ 3, 2 ]
[]
[]
[ "jinja2", "python" ]
stackoverflow_0003223920_jinja2_python.txt
Q: Matplotlib: plot multiple graphs using same figure, without them overlapping I have a class which I use to plot things then save them to a file. Here's a simplified version of it: import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt class Test(): def __init__(self, x, y, filename): ...
Matplotlib: plot multiple graphs using same figure, without them overlapping
I have a class which I use to plot things then save them to a file. Here's a simplified version of it: import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt class Test(): def __init__(self, x, y, filename): fig = plt.figure(1) ax = fig.add_subplot(111) ax.plot(x, y, 'D',...
[ "You could use the figure's clf method to clear the figure after you're done with one. Also, pyplot.clf will clear the current figure.\nAlternatively, if you just want a new figure then call pyplot.figure without an explicit num argument -- it will autoincrement, so you don't need to keep a counter.\n" ]
[ 10 ]
[]
[]
[ "matplotlib", "python" ]
stackoverflow_0003225138_matplotlib_python.txt
Q: Which web technology to learn for an experienced C++ developer? Friends, I've got some exp in c++ and now kind of starting my way to J2EE (to survive:))). Meanwhile, I've got a plan to venture in to a web portal my own. But with very little experience in web technology, I'd need to start from scratch. I'm little ...
Which web technology to learn for an experienced C++ developer?
Friends, I've got some exp in c++ and now kind of starting my way to J2EE (to survive:))). Meanwhile, I've got a plan to venture in to a web portal my own. But with very little experience in web technology, I'd need to start from scratch. I'm little confused on which way to go and I'm here. PHP, Python or JSP, consid...
[ "Before learning either of these, spend some real time and learn HTML and CSS in depth. Also learn Javascript and JQuery (or your favorite client side library). The O'Reilly books on the topic are pretty much all good IMO.\nI say that because I think that you'll find that for most modern web sites, a lot of richn...
[ 13, 1, 1, 1, 0, 0, 0 ]
[]
[]
[ "jsp", "php", "python" ]
stackoverflow_0003223557_jsp_php_python.txt
Q: Pango error after a minute of running I have the following python modules. Sorry if the code is ugly. This is my first python GUI app and I'm fairly new to python as well. It's some sort of a count down timer with a todo list. It works kinda well except that after two minutes after running the program, it crashes ...
Pango error after a minute of running
I have the following python modules. Sorry if the code is ugly. This is my first python GUI app and I'm fairly new to python as well. It's some sort of a count down timer with a todo list. It works kinda well except that after two minutes after running the program, it crashes with the following error: Pango:ERROR:/buil...
[ "You should have used wx.Timer instead of starting a thread that will be most of the time waiting.\nwx.Timer will call your code in the specified interval.\n" ]
[ 0 ]
[]
[]
[ "python", "wxglade", "wxpython" ]
stackoverflow_0003225183_python_wxglade_wxpython.txt
Q: How to check if an element of a list is a number? How can I check if the first element of the list (below) is a number (using some sort of regular expression) in python: temp = ['1', 'abc', 'XYZ', 'test', '1'] Many thanks. A: try: i = int(temp[0]) except ValueError: print "not an integer\n" try: i = floa...
How to check if an element of a list is a number?
How can I check if the first element of the list (below) is a number (using some sort of regular expression) in python: temp = ['1', 'abc', 'XYZ', 'test', '1'] Many thanks.
[ "try:\n i = int(temp[0])\nexcept ValueError:\n print \"not an integer\\n\"\n\ntry:\n i = float(temp[0])\nexcept ValueError:\n print \"not a number\\n\"\n\nIf it must be done with a regex:\nimport re\nre.match( '^[-+]?(([0-9]+([.][0-9]*)?)|(([0-9]*[.])?[0-9]+))$', temp[0] )\n\n", "If you are just expecting a s...
[ 13, 4, 1 ]
[]
[]
[ "python" ]
stackoverflow_0003225305_python.txt
Q: mod_python for python 2.7 I recently downloaded python 2.7 on my computer (x64) and I would like to install mod_python for it (I have apache 2.2), however, I can't find a mod_python release supporting python 2.7. Has development stopped? If so, what should I use instead? A: Development on mod_python has stopped ...
mod_python for python 2.7
I recently downloaded python 2.7 on my computer (x64) and I would like to install mod_python for it (I have apache 2.2), however, I can't find a mod_python release supporting python 2.7. Has development stopped? If so, what should I use instead?
[ "Development on mod_python has stopped and its use is no longer recommended. I suggest mod_wsgi \nFrom the mod_python Django documentation:\n\nSupport for mod_python has been deprecated, and will be removed in Django 1.5. If you are configuring a new deployment, you are strongly encouraged to consider using mod_wsg...
[ 12 ]
[]
[]
[ "mod_python", "python", "python_2.7" ]
stackoverflow_0003225498_mod_python_python_python_2.7.txt
Q: Base64 encode binary uploaded data on the AppEngine I've been trying to Base64 encode image data from the user (in this case a trusted admin) in order to skip as many calls to the BlobStore as I possibly can. Every time I attempt to encode it, I recieve an error saying: Error uploading image: 'ascii' codec can't d...
Base64 encode binary uploaded data on the AppEngine
I've been trying to Base64 encode image data from the user (in this case a trusted admin) in order to skip as many calls to the BlobStore as I possibly can. Every time I attempt to encode it, I recieve an error saying: Error uploading image: 'ascii' codec can't decode byte 0x89 in position 0: ordinal not in range(128) ...
[ "your store image code could be like this....\nimg = Image( name=name, data=file.read() )\nimg.put()\nreturn ( str(img.name), img.key() )\n\ndoing base64encode of binary data may increase the size of data itself and increase the cpu encoding and decoding time.\nand Blobstore uses the same storage sturcuture as data...
[ 4 ]
[]
[]
[ "base64", "encoding", "google_app_engine", "python" ]
stackoverflow_0003225500_base64_encoding_google_app_engine_python.txt
Q: MemoryError when using imaplib fetch Please help me, I am getting MemoryError when trying to fetch a specific email. This is the error message: python(23838,0x1888c00) malloc: *** vm_allocate(size=3309568) failed (error code=3) python(23838,0x1888c00) malloc: *** error: can't allocate region python(23838,0x1888c00...
MemoryError when using imaplib fetch
Please help me, I am getting MemoryError when trying to fetch a specific email. This is the error message: python(23838,0x1888c00) malloc: *** vm_allocate(size=3309568) failed (error code=3) python(23838,0x1888c00) malloc: *** error: can't allocate region python(23838,0x1888c00) malloc: *** set a breakpoint in szone_er...
[ "A MemoryError usually indicates that your system ran out of free memory. Perhaps your Python script is keeping references to all messages it's seen and the total sum of them is too big to fit in memory?\n", "http://bugs.python.org/issue1092502\nThe suggested fix there by a_lauer seems to have fixed my problem.\...
[ 0, 0 ]
[]
[]
[ "imaplib", "malloc", "python" ]
stackoverflow_0003184198_imaplib_malloc_python.txt
Q: 3d Drawing in Python with OpenGL I need to: draw 3d models with specific 3ds textures have the models be moving (just position) have a camera viewer which is easily maneuverable (ideally in real time) I would like to accomplish this with Python and OpenGL. What would be the best libraries to accomplish this and ...
3d Drawing in Python with OpenGL
I need to: draw 3d models with specific 3ds textures have the models be moving (just position) have a camera viewer which is easily maneuverable (ideally in real time) I would like to accomplish this with Python and OpenGL. What would be the best libraries to accomplish this and what are some good resources to read u...
[ "I recommend python-ogre for this. It abstracts away keyboard, mouse, windowing, OpenGL and with some additional extension you can even get sound and physics. I have a fairly sophisticated 3D project that I have been writing with OGRE so I can attest to its ease of use. The tutorial apps and examples are enough to ...
[ 4, 2, 0 ]
[]
[]
[ "opengl", "python" ]
stackoverflow_0003225539_opengl_python.txt
Q: How do I concatenate strings from a dictionary by identifying the last item with Python? I need to concatenate string to an existing one as follows. for k,v in r.iteritems(): tableGenString += "%s %s, " % (k, what_type(v)) The problem is that for the last item the comma(',') should not be added. How can I che...
How do I concatenate strings from a dictionary by identifying the last item with Python?
I need to concatenate string to an existing one as follows. for k,v in r.iteritems(): tableGenString += "%s %s, " % (k, what_type(v)) The problem is that for the last item the comma(',') should not be added. How can I check if k,v is the last item? Added The example is a simplified version of the real code as foll...
[ "Don't build large strings with concatenation like that. Do this instead:\ntableGenString = ', '.join('%s %s' % (k, what_type(v)) for k, v in r.iteritems())\n\n", "The OP insists in a comment:\n\nI need to find a way to find the last\n item as I added to my original\n question\n\napparently for purposes other ...
[ 15, 2, 1, 0 ]
[]
[]
[ "dictionary", "python" ]
stackoverflow_0003225594_dictionary_python.txt
Q: Removing the first part of a concatenated string with Python I have a string as follows CompilationStatistics_Compilation_StepList_Map_TimingUsage_ClockList_Clock_MinimumPeriod What would be the simplest way to remove the first part (CompilationStatistics_) or the last part (_MiniumuPeriod)? I think about using...
Removing the first part of a concatenated string with Python
I have a string as follows CompilationStatistics_Compilation_StepList_Map_TimingUsage_ClockList_Clock_MinimumPeriod What would be the simplest way to remove the first part (CompilationStatistics_) or the last part (_MiniumuPeriod)? I think about using regular expression, but I expect there should a better way. m = r...
[ "See the Python documentation for String methods, particularly partition and rpartition:\ns = \"CompilationStatistics_Compilation_StepList_Map_TimingUsage_ClockList_Clock_MinimumPeriod\"\nprint s.partition('_')[2].rpartition('_')[0]\n\nResult\nCompilation_StepList_Map_TimingUsage_ClockList_Clock\n\n", "'_'.join(s...
[ 3, 3, 2, 1, 0 ]
[]
[]
[ "python", "string" ]
stackoverflow_0003225716_python_string.txt
Q: How many can a tuple or list contain in Python? How many items can contain tuple or list in python? What will be if it is 10 000? A: import sys print sys.maxsize # prints some system-dependent number representing the maximum # size most containers can hold. Python sys module I suspect on most platforms, sys.ma...
How many can a tuple or list contain in Python?
How many items can contain tuple or list in python? What will be if it is 10 000?
[ "import sys\n\nprint sys.maxsize\n# prints some system-dependent number representing the maximum\n# size most containers can hold.\n\nPython sys module\nI suspect on most platforms, sys.maxsize would return the same value as sys.maxint (which is guaranteed to be at least 2**31-1), but I doubt that's guaranteed.\n",...
[ 6, 3, 0 ]
[]
[]
[ "list", "python", "tuples" ]
stackoverflow_0003225712_list_python_tuples.txt
Q: GAE: Best way to determine how many of a Kind is stored? What is the best way to determine how many models of a certain kind are in my app's datastore? The documentation says that MyKind.all().count() is only marginally better than retrieving all of the data, and has a limit of 1000. This is not helpful, because I...
GAE: Best way to determine how many of a Kind is stored?
What is the best way to determine how many models of a certain kind are in my app's datastore? The documentation says that MyKind.all().count() is only marginally better than retrieving all of the data, and has a limit of 1000. This is not helpful, because I am expecting to have 6000+ instances of MyKind stored. Is the...
[ "If an approximate count is good enough, you could use the statistics API:\nhttp://code.google.com/appengine/docs/python/datastore/stats.html\n", "If you do keys-only it should be pretty fast, since this only has to read the index and doesn't actually fetch any entities. Use a cursor and loop until count() return...
[ 5, 3, 2, 1 ]
[]
[]
[ "google_app_engine", "python" ]
stackoverflow_0003225397_google_app_engine_python.txt
Q: Python: JobID counter Whats the best to make a job ID counter in python? For example if a Job ID startd of with value of "0" and everytime someone ran the script the counter went up by one? E.G. X = 0 Perform_some_process x +=1 Now the value of x will be one, but if i ran the script again x will be equal to one...
Python: JobID counter
Whats the best to make a job ID counter in python? For example if a Job ID startd of with value of "0" and everytime someone ran the script the counter went up by one? E.G. X = 0 Perform_some_process x +=1 Now the value of x will be one, but if i ran the script again x will be equal to one again and not two. How wou...
[ "You need to \"persist\" that counter -- simplest is to use a file for the purpose. For example:\nimport os\n\ndef onemore():\n f = __file__ + '.counter'\n if os.path.exists(f):\n with open(f) as thefile:\n counter = int(thefile.read())\n else:\n counter = -1\n counter += 1\n ...
[ 2 ]
[]
[]
[ "python" ]
stackoverflow_0003225784_python.txt
Q: Simulating C#'s sbyte (8 bit signed integer) casting in Python In C#, I can cast things to 8bit signed ints like so: (sbyte)arg1; which when arg1 = 2, the cast returns 2 also. However, obviously casting 128 will return -128. More specifically casting 251 will return -5. What's the best way to emulate this behavio...
Simulating C#'s sbyte (8 bit signed integer) casting in Python
In C#, I can cast things to 8bit signed ints like so: (sbyte)arg1; which when arg1 = 2, the cast returns 2 also. However, obviously casting 128 will return -128. More specifically casting 251 will return -5. What's the best way to emulate this behavior? Edit: Found a duplicate question: Typecasting in Python s8 = (i ...
[ "With ctypes:\nfrom ctypes import cast, pointer, c_int32, c_byte, POINTER\ncast(pointer(c_int32(arg1)), POINTER(c_byte)).contents.value\n\n", "I'd use the struct module of the Python standard library, which, as so often, comes in handy for turning values into bytes and viceversa:\n>>> def cast_sbyte(anint):\n ...
[ 3, 2, 0, 0, 0 ]
[]
[]
[ "c#", "casting", "python" ]
stackoverflow_0003222088_c#_casting_python.txt
Q: Help me translate Python code which replaces an extension in file name to C++ I apologize if you know nothing about Python, however, the following snippet should be very readable to anyone. The only trick to watch out for - indexing a list with [-1] gives you the last element if there is one, or raises an exceptio...
Help me translate Python code which replaces an extension in file name to C++
I apologize if you know nothing about Python, however, the following snippet should be very readable to anyone. The only trick to watch out for - indexing a list with [-1] gives you the last element if there is one, or raises an exception. >>> fileName = 'TheFileName.Something.xMl' >>> fileNameList = fileName.split('.'...
[ "If you're using ATL why not just use CAtlString's methods?\nCAtlString filename = _T(\"TheFileName.Something.xMl\");\n\n//search for '.' from the end\nint dotIdx = filename.ReverseFind( _T('.') );\n\nif( dotIdx != -1 ) {\n //extract the file extension\n CAtlString ext = filename.Right( filename.GetLength() - dot...
[ 6, 3 ]
[]
[]
[ "c++", "python", "string", "unicode_string", "visual_studio_2010" ]
stackoverflow_0003216805_c++_python_string_unicode_string_visual_studio_2010.txt
Q: to remove specific rows in a csv file using python i want ro remove specific lines from the following csv file : "Title.XP PoseRank" 1VDV-constatomGlu-final-NoGluWat. 1VDV-constatomGlu-final-NoGluWat. P6470-Usha.1 P6470-Usha.2 P6470-Usha.3 P6470-Usha.4 P6470-Usha.5 P6515-Usha.1 P6515-Usha.2 P65...
to remove specific rows in a csv file using python
i want ro remove specific lines from the following csv file : "Title.XP PoseRank" 1VDV-constatomGlu-final-NoGluWat. 1VDV-constatomGlu-final-NoGluWat. P6470-Usha.1 P6470-Usha.2 P6470-Usha.3 P6470-Usha.4 P6470-Usha.5 P6515-Usha.1 P6515-Usha.2 P6517.1 P6517.2 P6517.3 P6517.4 P6517.5 P6553-Ush...
[ "The right solution is to use csv parser(i didn't test this code):\n\n\nwriter = csv.writer(open('corrected.csv'))\nfor row in csv.reader('myfile.csv'):\n if not row[0].startswith('1VDV-constatomGlu-final-NoGluWat.'):\n writer.writerow(row)\nwriter.close()\n\n\nYou can use also regular expression or some ...
[ 2 ]
[]
[]
[ "csv", "python" ]
stackoverflow_0003226285_csv_python.txt
Q: Matching "~" at the end of a filename with a python regular expression I'm working in a script (Python) to find some files. I compare names of files against a regular expression pattern. Now, I have to find files ending with a "~" (tilde), so I built this regex: if re.match("~$", string_test): print "ok!" Wel...
Matching "~" at the end of a filename with a python regular expression
I'm working in a script (Python) to find some files. I compare names of files against a regular expression pattern. Now, I have to find files ending with a "~" (tilde), so I built this regex: if re.match("~$", string_test): print "ok!" Well, Python doesn't seem to recognize the regex, I don't know why. I tried the...
[ "re.match() is only successful if the regular expression matches at the beginning of the input string. To search for any substring, use re.search() instead:\nif re.search(\"~$\", string_test):\n print \"ok!\"\n\n", "Your regex will only match strings \"~\" and (believe it or not) \"~\\n\".\nYou need re.match(r...
[ 10, 9, 7, 0 ]
[]
[]
[ "python", "regex", "tilde" ]
stackoverflow_0003226202_python_regex_tilde.txt
Q: How do I ensure that the same Python instance is always returned for a particular C++ instance? I'm using Boost.Python to wrap a C++ library. How do I ensure that the same Python instance (by object identity) is always returned for a particular C++ instance (by pointer identity)? I can't extend the C++ classes, bu...
How do I ensure that the same Python instance is always returned for a particular C++ instance?
I'm using Boost.Python to wrap a C++ library. How do I ensure that the same Python instance (by object identity) is always returned for a particular C++ instance (by pointer identity)? I can't extend the C++ classes, but I can add a member variable (such as a PyObject * or a boost::python::handle<>) if that helps. I'm ...
[ "After investing some time into this very problem I came to the conclusion that it's more trouble than it's worth. I have resigned myself that id() will identify the (potentially short-lived) wrapper object and not the actual C++ object.\nInstead I identify my C++ objects in some other way, e.g. by looking at the c...
[ 1 ]
[]
[]
[ "boost", "boost_python", "c++", "python" ]
stackoverflow_0003182264_boost_boost_python_c++_python.txt
Q: Full text search: Whoosh Vs SOLR I am working on a Django project, where I need to implement full text search. I have seen SOLR and found some good comments for the same. But as its implemented in Java and would need java enviroment to be installed on the system along with Python. Looking for the python equivalent...
Full text search: Whoosh Vs SOLR
I am working on a Django project, where I need to implement full text search. I have seen SOLR and found some good comments for the same. But as its implemented in Java and would need java enviroment to be installed on the system along with Python. Looking for the python equivalent for SOLR, I have seen Whoosh but I am...
[ "Whoosh is actually very fast for a python-only implementation. That said, it's still at least an order of magnitude slower. Depending on the amount of data you need to index and search and the requirements on the maximum allowable latency and concurrent searches, it may not be an option.\nSOLR is a bit of a compli...
[ 16, 3 ]
[]
[]
[ "django", "python", "solr" ]
stackoverflow_0003226596_django_python_solr.txt
Q: index in google app engine application can anyone tell me how to do indexing in gql A: Yes Google can, http://code.google.com/appengine/docs/python/config/indexconfig.html. Alternatively there are books on the matter http://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=google+app+engin...
index in google app engine application
can anyone tell me how to do indexing in gql
[ "Yes Google can, http://code.google.com/appengine/docs/python/config/indexconfig.html.\nAlternatively there are books on the matter http://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=google+app+engine&x=0&y=0\nThe best way is to create your code and let the default automatic index creati...
[ 2 ]
[]
[]
[ "google_app_engine", "python" ]
stackoverflow_0003226664_google_app_engine_python.txt
Q: Pass request to model form using generic view in Django I using Django and a generic view "django.views.generic.create_update.create_object" I have a model form wich i pass to the generic view: url(r'^add$', create_object, {'template_name':'tpl.html','form_class':MyModelForm,'post_save_redirect':'/'},name = 'add')...
Pass request to model form using generic view in Django
I using Django and a generic view "django.views.generic.create_update.create_object" I have a model form wich i pass to the generic view: url(r'^add$', create_object, {'template_name':'tpl.html','form_class':MyModelForm,'post_save_redirect':'/'},name = 'add'), I need to get current user in my ModelForm.save method.. B...
[ "You could probably hack something up to inject the request into the form instantiation, but why would you bother? Generic views are meant as a quick-and-easy solution to the basic requirements only. As soon as you start needing massive customisations, you might as well just write the actual view yourself. It's not...
[ 2, 1, 1 ]
[]
[]
[ "django", "forms", "python" ]
stackoverflow_0003224307_django_forms_python.txt
Q: to add column values in a specific manner in a csv file using python i have a csv file similar to the following : title title2 h1 h2 h3 ... l1.1 l1 1 1 0 l1.2 l1 0 1 0 l1.3 l1 1 0 1 l2.1 l2 0 0 1 l2.2 l2 1 0 1 l3.1 l3 0 1 1 l3.2 l3 ...
to add column values in a specific manner in a csv file using python
i have a csv file similar to the following : title title2 h1 h2 h3 ... l1.1 l1 1 1 0 l1.2 l1 0 1 0 l1.3 l1 1 0 1 l2.1 l2 0 0 1 l2.2 l2 1 0 1 l3.1 l3 0 1 1 l3.2 l3 1 1 0 l3.3 l3 1 1 0 l3.4 l3 1 1 0 i w...
[ "Something like this should work. It takes an input in the form\ntitle,title2,h1,h2,h3\nl1.1,l1,1,1,0\nl1.2,l1,0,1,0\nl1.3,l1,1,0,1\nl2.1,l2,0,0,1\nl2.2,l2,1,0,1\nl3.1,l3,0,1,1\nl3.2,l3,1,1,0\nl3.3,l3,1,1,0\nl3.4,l3,1,1,0\n\nand outputs\ntitle2,h1,h2,h3\nl1,2,2,1\nl2,1,0,2\nl3,3,4,1\n\nTested with Python 3.1.2. In ...
[ 2, 0 ]
[]
[]
[ "csv", "python" ]
stackoverflow_0003226656_csv_python.txt
Q: Python not loading a specific function I just run into a problem with the hamster's codebase where a module is loaded with one function and not the other. It's not my code, so I don't know many details, but I'd really like to learn how can such situation arise. There is a module called hamster which includes i18n....
Python not loading a specific function
I just run into a problem with the hamster's codebase where a module is loaded with one function and not the other. It's not my code, so I don't know many details, but I'd really like to learn how can such situation arise. There is a module called hamster which includes i18n.py which has two functions: setup_i18n and C...
[ "You have an old version of the file in your system path. Notice that the most recent change to that file in the repo is to add the setup_i18n function. It's also possible you have an old .pyc file that for some reason isn't being compared properly to the .py file.\n" ]
[ 6 ]
[]
[]
[ "import", "module", "python" ]
stackoverflow_0003227573_import_module_python.txt
Q: need help in understanding the code class Problem: """ This class outlines the structure of a search problem, but doesn't implement any of the methods (in object-oriented terminology: an abstract class). """ def getStartState(self): """Returns the start state for the search problem"...
need help in understanding the code
class Problem: """ This class outlines the structure of a search problem, but doesn't implement any of the methods (in object-oriented terminology: an abstract class). """ def getStartState(self): """Returns the start state for the search problem""" sahan.raiseNotDefined() Now...
[ "This class is an attempt to define an abstract base class, this is what would be an Interface in Java or a class with only pure virtual methods in C++. Essentially it is defining the contract for a group of classes but not providing the implementation. The users of this class will implement the behaviour in subcla...
[ 2, 1, 0 ]
[]
[]
[ "oop", "python" ]
stackoverflow_0003226928_oop_python.txt
Q: GAE: Is it necessary to call fetch on a query before getting its cursor? When the following code is executed: q = MyKind.all() taskqueue.add(url="/admin/build", params={'cursor': q.cursor()}) I get: AssertionError: No cursor available. Why does this happen? Do I need to fetch something first? (I'd rather...
GAE: Is it necessary to call fetch on a query before getting its cursor?
When the following code is executed: q = MyKind.all() taskqueue.add(url="/admin/build", params={'cursor': q.cursor()}) I get: AssertionError: No cursor available. Why does this happen? Do I need to fetch something first? (I'd rather not; the code is cleaner just to get the query and pass it on.) I'm using Pyt...
[ "Yes, a cursor is only available if you've fetched something; there's no cursor for the first result in the query.\nAs a workaround, you could wrap the call to cursor() in a try/except and pass on None to the next task if there isn't a cursor available.\n" ]
[ 3 ]
[]
[]
[ "google_app_engine", "google_cloud_datastore", "python" ]
stackoverflow_0003226188_google_app_engine_google_cloud_datastore_python.txt
Q: Matching all records in a datastore query Is there a way to substitute: def get_objects(attr1,attr2,..): objects = Entities.all() if attr1 != None: objects.filter('attr1',attr1) if attr2 != None: objects.filter('attr2',attr2) .... return objects With a single query: Entities.a...
Matching all records in a datastore query
Is there a way to substitute: def get_objects(attr1,attr2,..): objects = Entities.all() if attr1 != None: objects.filter('attr1',attr1) if attr2 != None: objects.filter('attr2',attr2) .... return objects With a single query: Entities.all().filter('attr1',attr1).filter('attr2',attr2...
[ "The datastore doesn't support regex queries or OR queries.\nHowever, if you're only using equality filters, indexes shouldn't be automatically created; these types of queries can be served using a merge-join strategy as long as the number of filters remains low (if you try to add too many filters, you'll get an er...
[ 1 ]
[]
[]
[ "google_app_engine", "google_cloud_datastore", "python", "web_applications" ]
stackoverflow_0003226775_google_app_engine_google_cloud_datastore_python_web_applications.txt
Q: Pylons importing Psycopg2 error Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Python/2.6/site-packages/psycopg2/__init__.py", line 60, in <module> from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID ImportError: dlopen(/Library/Python/2.6/site-packages/psyc...
Pylons importing Psycopg2 error
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Python/2.6/site-packages/psycopg2/__init__.py", line 60, in <module> from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID ImportError: dlopen(/Library/Python/2.6/site-packages/psycopg2/_psycopg.so, 2): Symbol not foun...
[ "You get this error because your 64-bit version of python can't find a 64-bit psycopg2.\nYou can either downgrade your python to run in 32-bit mode or try to get a 64-bit psycopg2. There is more discussion on this topic over on Ben Kreeger's blog.\n", "Could it be that the postgres installation was removed/updat...
[ 4, 1, 1, 1 ]
[]
[]
[ "psycopg2", "pylons", "python" ]
stackoverflow_0001623449_psycopg2_pylons_python.txt
Q: Is the Python Imaging Library not available on PyPI, or am I missing something? easy_install pil results in an error: Searching for pil Reading http://pypi.python.org/simple/pil/ Reading http://www.pythonware.com/products/pil Reading http://effbot.org/zone/pil-changes-115.htm Reading http://effbot.org/downloads/#I...
Is the Python Imaging Library not available on PyPI, or am I missing something?
easy_install pil results in an error: Searching for pil Reading http://pypi.python.org/simple/pil/ Reading http://www.pythonware.com/products/pil Reading http://effbot.org/zone/pil-changes-115.htm Reading http://effbot.org/downloads/#Imaging No local packages or download links found for pil error: Could not find suitab...
[ "Of course PIL is on PyPi! Specifically, it's right here.\n", "easy_install is case-sensitive. The package is under PIL.\n", "workaround is in easy_install PIL egg directory create link to this directory in name \"PIL\"\n", "\nimport Image\n\nDjango tries to import PIL directly:\nfrom PIL import Image\n\nYou...
[ 5, 1, 1, 0, 0 ]
[]
[]
[ "django", "python", "python_imaging_library" ]
stackoverflow_0000994281_django_python_python_imaging_library.txt
Q: Python images display Django Since my last question here: Python images display I understood that from all the answers I got the glob.glob could be the only one in the direction I need. However where I am stuck right now is here: I can create a list with all the filenames in my media directory by using glob.glob: ...
Python images display Django
Since my last question here: Python images display I understood that from all the answers I got the glob.glob could be the only one in the direction I need. However where I am stuck right now is here: I can create a list with all the filenames in my media directory by using glob.glob: all = glob.glob("/Path_to_MEDIA/*/...
[ "Make a direct-to-template url with extra-context in urls.py:\nfrom django.views.generic.simple import direct_to_template\n...\nurl(r'^whatever', direct_to_template, \n { 'template':'foo.html', 'extra_context': {'files':myfiles} }\n name='whatever' ),\n\nWhere myfiles above is a list...
[ 0 ]
[]
[]
[ "django", "image", "python" ]
stackoverflow_0003228342_django_image_python.txt
Q: Using PIL and NumPy to convert an image to Lab array, modify the values and then convert back I am trying to convert a PIL image into an array using NumPy. I then want to convert that array into Lab values, modify the values and then convert the array back in to an image and save the image. I have the following co...
Using PIL and NumPy to convert an image to Lab array, modify the values and then convert back
I am trying to convert a PIL image into an array using NumPy. I then want to convert that array into Lab values, modify the values and then convert the array back in to an image and save the image. I have the following code: import Image, color, numpy # Open the image file src = Image.open("face-him.jpg") # Attempt t...
[ "Without having tried it, scaling errors are common in converting colors:\nRGB is bytes 0 .. 255, e.g. yellow [255,255,0],\nwhereas rgb2xyz() etc. work on triples of floats, yellow [1.,1.,0].\n(color.py has no range checks: lab2rgb( rgb2lab([255,255,0]) ) is junk.)\nIn IPython, %run main.py, then print corners of s...
[ 10, 7 ]
[]
[]
[ "color_space", "colors", "numpy", "python", "python_imaging_library" ]
stackoverflow_0003228361_color_space_colors_numpy_python_python_imaging_library.txt
Q: google app engine ApplicationError: 2 nonnumeric port: '' I am getting the ApplicationError: 2 nonnumeric port: '' randomly for about 1/10th of my url request, the rest work fine, I seen this is a bug but I have yet to find any solutions, anyone have any thoughts in why this is occurring? I am running python 2.5...
google app engine ApplicationError: 2 nonnumeric port: ''
I am getting the ApplicationError: 2 nonnumeric port: '' randomly for about 1/10th of my url request, the rest work fine, I seen this is a bug but I have yet to find any solutions, anyone have any thoughts in why this is occurring? I am running python 2.5.4 and google app engine 1.3.3 here is some generic code the e...
[ "Couple of things with your code that could be problems. One is that you aren't doing anything with the incoming value of page, but it is being over-written by the assignment fort thing inside your try block. Also, as I noted in my comment, the %s in the assignment wants to have a variable to substitute in its plac...
[ 1 ]
[]
[]
[ "google_app_engine", "python" ]
stackoverflow_0003229019_google_app_engine_python.txt
Q: Checking whether a link is dead or not using Python without downloading the webpage For those who know wget, it has a option --spider, which allows one to check whether a link is broke or not, without actually downloading the webpage. I would like to do the same thing in Python. My problem is that I have a list of...
Checking whether a link is dead or not using Python without downloading the webpage
For those who know wget, it has a option --spider, which allows one to check whether a link is broke or not, without actually downloading the webpage. I would like to do the same thing in Python. My problem is that I have a list of 100'000 links I want to check, at most once a day, and at least once a week. In any case...
[ "You should use the HEAD Request for this, it asks the webserver for the headers without the body. See How do you send a HEAD HTTP request in Python 2?\n" ]
[ 9 ]
[ "Not sure how to do this in python but generally you could check 'Response Header' and check 'Status-Code' for code 200. at that point you could stop reading the page and continue with your next link that way you don't have to download the whole page just the 'Response Header'\nList of Status Codes\n" ]
[ -1 ]
[ "python", "urllib2" ]
stackoverflow_0003229607_python_urllib2.txt
Q: import pyodbc results in DLL load failed with error code 193 on Win7 I am running 64-bit Windows 7 and the ActiveState Python 2.5 installation (64-bit version). I just downloaded and installed the pyodbc 2.1.7 win32 package. When I run the installer as an admin it proceeds with no problem. When I run python and...
import pyodbc results in DLL load failed with error code 193 on Win7
I am running 64-bit Windows 7 and the ActiveState Python 2.5 installation (64-bit version). I just downloaded and installed the pyodbc 2.1.7 win32 package. When I run the installer as an admin it proceeds with no problem. When I run python and try import pyodbc I receive the following error: ImportError: DLL load...
[ "It shouldn't be too difficult to build yourself. I know pyodbc supports 64 bit (I worked with the author a bit adding 64 bit support a couple years ago). If unzip the source zip, you can run:\nsetup.py bdist_wininst \n\nOf course for Python 2.5, I think you'll need Visual Studio 2003, that's probably a deal-brea...
[ 1 ]
[]
[]
[ "64_bit", "pyodbc", "python", "windows_7" ]
stackoverflow_0003229471_64_bit_pyodbc_python_windows_7.txt
Q: Python Language Nuances Possible Duplicate: Common Pitfalls in Python I'm learning Python and I come from a diverse background of programming languages. In the last five years, I've written quite a bit of Java, C++, VB.Net, and PHP. As many of you might agree, once you learn one programming language, learning an...
Python Language Nuances
Possible Duplicate: Common Pitfalls in Python I'm learning Python and I come from a diverse background of programming languages. In the last five years, I've written quite a bit of Java, C++, VB.Net, and PHP. As many of you might agree, once you learn one programming language, learning another is just a mater of lea...
[ "This one took me a few hours to figure out when I first encountered it in a real program:\nA default argument to a function is a mutable, static value.\ndef foo(bar = []):\n bar.append(1)\n print(bar)\n\nfoo()\nfoo()\n\nThis will print\n[1]\n[1, 1]\n\n", "For your example, the usual way would be something like...
[ 4, 3, 2, 1, 0 ]
[]
[]
[ "pep8", "performance", "python" ]
stackoverflow_0003226650_pep8_performance_python.txt
Q: HTTP Auth coordinated by web application rather than server I'm working with Django on Linux and I have an application that integrates with Active Directory. I'm seeking opinions and advice about whether or not it would be feasible or reasonable to access the HTTP headers from within the application to coordinate...
HTTP Auth coordinated by web application rather than server
I'm working with Django on Linux and I have an application that integrates with Active Directory. I'm seeking opinions and advice about whether or not it would be feasible or reasonable to access the HTTP headers from within the application to coordinate HTTP authentication. The end goal would be to perform NTLM auth...
[ "Sure. Just return a HttpResponse with a 401 status code, and tell your web server-Django connector to let the auth headers through.\n" ]
[ 1 ]
[]
[]
[ "authentication", "django", "http", "http_authentication", "python" ]
stackoverflow_0003229783_authentication_django_http_http_authentication_python.txt
Q: Debugger for google appengine python I am developing for appengine python on windows 7. I am looking for a set up that will allow me to debug my python scripts. I would prefer a GUI based defugger as opposed to command line one. Something like eclipse provides. A: If non-free (as beer) is a option, WingIDE is a ...
Debugger for google appengine python
I am developing for appengine python on windows 7. I am looking for a set up that will allow me to debug my python scripts. I would prefer a GUI based defugger as opposed to command line one. Something like eclipse provides.
[ "If non-free (as beer) is a option, WingIDE is a very powerful Python IDE, especially It's new version 4 (still in beta) puts focus on Django Debug support.\nIt's a GUI based Debugger as you want, and has a how-to for \"Using Wing IDE with the Google App Engine\"\n", "Aptana is an Eclipse modification, you can us...
[ 2, 1, 0 ]
[]
[]
[ "debugging", "google_app_engine", "python" ]
stackoverflow_0003229702_debugging_google_app_engine_python.txt