Python Patterns & Practices

Find The Best Answers To Your Python Coding Problems



Help needed improving Python code using List Comprehensions

Disabling Python nosetests

.net - Scalable web application with lot of image servings

inheritance - Making a variable non-inheritable in python

restlet - Implementing a custom Python authentication handler

testing - Why my Python test generator simply doesn't work?

python - Getting "Comment post not allowed (400)" when using Django Comments

Python Error: TypeError: not all arguments converted during string formatting

dictionary - "Adding" Dictionaries in Python?

html - python calendar.HTMLCalendar

what is python equivalent to PHP $_SERVER?

Accessing Python Objects in a Core Dump

Trouble using python PIL library to crop and save image

python - Objective-C string manipulation

python - Problem in handle PNG by the PIL

python - Login input

Using Python to convert color formats?

python - pyserial - How to read the last line sent from a serial device

Replacing values in a Python list/dictionary?

uml - Are there any class diagram generating tools for python source code?

python - Are there memory efficiencies gained when code is wrapped in functions?

python - How Do I Remove Text From Generated Django Form?

python - Library to read ELF file DWARF debug information

python - Problem with SQLite executemany

python - Switching databases in TG2 during runtime

python - Why would Django's cache work with locmem but fail with memcached?

Is there a static analysis tool for Python, Ruby, Sql, Cobol, Perl, and PL/SQL?

Extending Python with C/C++

python - Is there a better way than int( byte_buffer.encode('hex'), 16 )

java - .class file from jython with pydev

python - Getting column info in cx_oracle when table is empty?

Java Python Integration

python - Run web.py as daemon

python - Best way to denormalize data in Django?

My python program executes faster than my java version of the same program. What gives?

c++ - Live RX and TX rates in linux

templates - When to use a Templating Engine in Python?

What is the correct way to set Python's locale on Windows?

python - Are asynchronous Django model queries possible?

IRC Python Bot: Best Way

javascript - I want to parse a PAC file to get some Proxy information... just not in Explorer

how can I not distribute my secret key (facebook api) while using python?

macos - Python unicode in Mac os X terminal

python - Create PyQt menu from a list of strings

Unescape _xHHHH_ XML escape sequences using Python

python - How to put infinity and minus infinity in Django FloatField?

c - How to Make a PyMe (Python library) Run in Python 2.4 on Windows?

python - How to identify whether a file is normal file or directory

python - PyQt: event is not triggered, what's wrong with my code?

Swig / Python memory leak detected

windows xp - Python script: import sys failing on WinXP setup

python - Django models: how to return a default value in case of a non-existing foreign-key relationship?

image - FFT-based 2D convolution and correlation in Python

python - Why isn't this a valid schema for Rx?

indexing - Is there a way in Python to index a list of containers (tuples, lists, dictionaries) by an element of a container?

python - Race conditions in django

web services - python web framework focusing on json-oriented web applications

python - how to fix or make an exception for this error

introspection - Finding out which functions are available from a class instance in python?

python - Flash Characters on Screen in Linux

python - Using SimpleXMLTreeBuilder in elementtree

python - Interpret this particular REGEX

profiler - Python-Hotshot error trying to profile a simple program

c - Calling an external program from python

python - Non-Standard Optional Argument Defaults

python - How do I filter by time in a date time field?

python - __lt__ instead of __cmp__

unit testing - Python unittest: how to run only part of a test file?

Why can't Python find shared objects that are in directories in sys.path?

macos - How do I run "dot" as a command from Python?

python - tkMessageBox

Does urllib2 in Python 2.6.1 support proxy via https

When Should I Start Thinking About Moving to Python 3?

python - Callable modules

django - What is a good python-based Webshop Software?

Does python have a "causes_exception()" function?

Programmatically detect system-proxy settings on Windows XP with Python

Python hashable dicts

python - Replacing variable with function/class indicating dynamic value

python - Formatting with mako

My regex in python isn't recursing properly

python - Error on connecting to Oracle from py2exe'd program: Unable to acquire Oracle environment handle

macos - Reinstall /Library/Python on OS X Leopard

c++ - Is there a database implementation that has notifications and revisions?

python - How to direct tkinter to look elsewhere for Tcl/Tk library (to dodge broken library without reinstalling)

python - Get rid of toplevel tk panewindow while usong tkMessageBox

unit testing - python, unittest: is there a way to pass command line options to the app

python - Holiday files for G20 countries

python - What are some interesting features of the EveryBlock.com source code?

python - Mechanize not being installed by easy_install?

python - Difference between type(obj) and obj.__class__

python - CherryPy interferes with Twisted shutting down on Windows

php - how to write nslookup programmatically?

How do I use a Python library in my Java application?

abstract class - Equivalent of NotImplementedError for fields in Python

python - List of values to a sound file

python - How to debug SCons scripts using eclipse and pydev?

python - How to refuse a recipient in smtpd.SMTPServer.process_message?

Translating Perl to Python

HTML Agility Pack or HTML Screen Scraping libraries for Java, Ruby, Python?

How can I tell if a certain key was pressed in Python?

metaprogramming - How to find out the arity of a method in Python

How do I draw out specific data from an opened url in Python using urllib2?

How do I find the memory address of a Python / Django model object?

How to get Python syntax highlighting for Visual Studio?

dependencies - Is there a way to know which versions of python are supported by my code?

Combining nosetests with contracts for Python

How do I include a PHP script in Python?

python - By System command

finance - Accessing Reuters data in Python

python - How to extract top-level domain name (TLD) from URL

Python and psycopg2 - raw sql select from table with integer criteria

Formatting cells in Excel with Python

python - Generating an image thumbnail that is <10KB and did not lose proportions

payment processing - pylons/python

python - How to get files in a directory, including all subdirectories

math - Multiple regression in Python

python - Help with Django app and payment systems (general queries)

How to write a proxy server in Python?

python - USB - sync vs async vs semi-async

Object Attribute in Random List Not Accessible in Python

Getting the first and last item in a python for loop

python - restore registry from file

python saving unicode into file

python - find length of sequences of identical values in a numpy array (run length encoding)

Getting object's parent namespace in python?

python - trouble with pamie

python - How do i output a dynamically generated web page to a .html page instead of .py cgi page?

python - How to see the raw SQL queries Django is running?

python - Are multiple classes in a single file recommended?

python - map raw sql to django orm

python - Serve a dynamically generated image with Django

python string input problem with whitespace!

python - PyS60 application not going full screen

serial port - Getting an input/output error from Python with pySerial

pygame - Emulate processing with python?

Multiprocessing in python with more then 2 levels

Iterating through a range of dates in Python

python - What's the point of os.error?

python - Error running tutorial that came along wxPython2.8 Docs and Demos

python - Dropdown menus in forms containing database primary keys

python - Pyinstaller traceback

oop - What is the equivalent of object oriented constructs in python?

A question regarding string instance uniqueness in python

Python Decorator 3.0 and arguments to the decorator

python - Export set of data in different formats

Python string find

python - Why does SCons VariantDir() not put output in the given directory?

Changing variable names with Python for loops

python - Pylons FormEncode with an array of form elements

TeamCity for Python/Django continuous integration

how to program functions with alternative return value signatures in python? (next() for alternative iterators)

python - Efficient Tuple List Comparisons

OpenOffice.org development with pyUno for Windows—which Python?

Python 2.5 socket._fileobject is what in Python 3.1?

Python composite pattern exception handling & pylint

python - How do I test if a string exists in a Genshi stream?

frameworks - Eventdriven Webframework for Python

python - PyQt clipboard doesn't copy to system clipboard

python - using pyodbc on ubuntu to insert a image field on SQL Server

Which gps library would you recommend for python?

django - Is the Python Imaging Library not available on PyPI, or am I missing something?

python - How to delete all the items of a specific key in a list of dicts?

Unable to understand a statement about customizing Python's Macro Syntax

Popen and python

How do I operate on the actual object, not a copy, in a python for loop?

odbc - How to escape a hash (#) char in python?

How can I explicitly disable compilation of _tkinter.c when compiling Python 2.4.3 on CentOS 5?

python - How to test if a class attribute is an instance method

c++ - Compile the Python interpreter statically?

python - Calculate score in a pyramid score system

python - Strange behavior with ModelForm and saving

python - How do I build a list of all possible tuples from this table?

regex - Python regular expression with [:numeric:]

email - Check unread count of Gmail messages with Python

python - Recommended IDE for developing Pylons apps

Python operators

python - Attribute Cache in Django - What's the point?

python - How to tell Buildout to install a egg from a URL (w/o pypi)

Printing python modulus operator as it is over command line

python - Templating+scripting reverse proxy?

python - orbited twisted installation problems

arrays - Python Memory Model

How to communicate between Python and C# using XML-RPC?

What can you do with COM/ActiveX in Python?

python - adding a **kwarg to a class

python - Combinatorics Counting Puzzle: Roll 20, 8-sided dice, what is the probability of getting at least 5 dice of the same value

Source interface with Python and urllib2

python - How to replace whitespaces with underscore?

file - SSH Connection with Python 3.0

python - How to tell a panel that it is being resized when using wx.aui

How do I install with distutils to a specific Python installation?

php - user friendly framework for personal website?

python - How can I change a user agent string programmatically?

Why won't python allow me to delete files?

linux - Handling Multiple Network Interfaces in Python

mrdivide function in MATLAB: what is it doing, and how can I do it in Python?

python - random.sample return only characters instead of strings

Generating random sentences from custom text in Python's NLTK?

python - How do I wait for an image to load after an ajax call using jquery?

python - raw_input without leaving a history in readline

Can I create a Python extension module in D (instead of C)

python - How do I get a value node moved up to be an attribute of its parent node?

xml - How to convert XSD to Python Class

python - Formatting a variable in Django and autofields

Explicit access to Python's built in scope

http - User Authentication And Text Parsing in Python

Using Perl, Python, or Ruby, how to write a program to "click" on the screen at scheduled time?

python - Using pysmbc to read files over samba

linux - Search a folder for files like "/*tmp*.log" in Python

python - Sorting a list of dictionaries of objects by dictionary values

cleaning up when using exceptions and files in python

python - Searching across multiple tables (best practices)

multithreading - Is modifying a class variable in python threadsafe?

Are Python commands suitable in Vim's visual mode?

multithreading - Python thread exit code

Special (magic) methods in Python

python - How can I deal with No module named edit.editor?

python - wxPython RichTextCtrl much slower than tkInter Text?

python - Experiences of creating Social Network site in Django

windows - Using Python to call Mencoder with some arguments

python - What is the best way to add an API to a Django application?

php - $_SERVER vs. WSGI environ parameter

python - How do you make this code more pythonic?

Error while I use math.atan in Python!

Help me find an appropriate ruby/python parser generator

pygame - Updating part of a surface in python, or transparent surfaces

messaging - Mule vs ActiveMQ for Python

python - How to retrieve the selected text from the active window

python - Pythonic Swap of 2 lists elements

python - How can I parse marked up text for further processing?

sqlite - Encrypted file or db in python

streaming - Playing MMS streams within Python

sqlite - Inferring appropriate database type declarations from strings in Python

data structures - How does Python store lists internally?

c# - What does this line mean in Python?

unicode - Writing text with diacritic ("nikud", vocalization marks) using PIL (Python Imaging Library)

python - CPython or IronPython?

OLE Compound Documents in Python

How to append two strings in Python?

In Python 2.5, how do I kill a subprocess?

Python Language Question: attributes of object() vs Function

How do I select a random element from an array in Python?

python - wxProgressDialog like behaviour for a wxDialog

python - Which template technology should I use with CherryPy?

python - Drawbacks of storing an integer as a string in a database

python - caching issues in MySQL response with MySQLdb in Django

python - Django: How can I change a ModelForm's Many2ManyField (select tag) choices verbose values?

recursion - Recursive Function palindrome in Python

python - How to debug the MySQL error message: Caught an exception while rendering

python - Is & faster than % when checking for odd numbers?

python - What would the jvm have to sacrifice in order to implement tail call optimisation?

python - Updating one aspect of a Pygame surface

How to setup twill for python 2.6 on Windows?

python - Komodo Extension

python and ruby - for what to use it?

see if two files have the same content in python

matrix - Flags in Python

unicode - Adding encoding alias to python

c# - Python: Inflate and Deflate implementations

Simple python plugin system

Coding a coroutine in Python to display "odd" and "even" numbers inifinitely

sudoku obfuscated python -> perl translation

What tools or libraries are there for decompiling python and exploring bytecode?

c# - Learning Python for a .NET developer

unicode - Capitalizing non-ASCII words in Python

python - Sending an email from Pylons

Unicode problems with web pages in Python's urllib

utf 8 - UTF-8 problem in python when reading chars

python - Create zip archive for instant download

python - Hex data from socket, process and response

python - Signals registered more than once in django1.1 testserver

php - How to build a fully-customizable application (aka database), without lose performance/good-design?

duplicate removal - Python remove all lines which have common value in fields

Use SQLite's backup API from Python/SQLAlchemy

python - Determining Letter Frequency Of Cipher Text

python - Pythonic way to implement three similar integer range operators?

python - How can I use Sphinx' Autodoc-extension for private methods?

Dynamic loading of python modules

Financial Charts / Graphs in Ruby or Python

python - Is the pickling process deterministic?

python - PyQt: Consolidating signals to a single slot

math - How to create Classes in Python with highly constrained instances

python - how to use french letters in a django template?

python - How to add hooks in twisted.web (or twisted.web2)?

python - django for loop counter break

python - How to do a meaningful code-coverage analysis of my unit-tests?

Which validating python XML api to use?

python - How to make custom PhotoEffects in Django Photologue?

urllib2 - Why am I getting "'ResultSet' has no attribute 'findAll'" using BeautifulSoup in Python?

python - What should I call this function composition?

python - How to resume program (or exit) after opening webbrowser?

Python SQL Select with possible NULL values

python - Pythonic way to log specific things to a file?

How to specify native library search path for python

string - A Python buffer that you can truncate from the left?

python - How do I satisfy a 3rd-party shared library reference to stat when I'm creating a shared library shim rather than an executable?

python - Decorator to mark a method to be executed no more than once even if called several times

Equivalent to Python’s findall() method in Ruby?

introspection - How do I look inside a Python object?

python - django - convert a list back to a queryset

python - Create SQL query using SqlAlchemy select and join functions

Tips on upgrading to python 3.0?

python - Rendering common session information in every view

python - Which reactor should i use for qt4?

Python shortcuts

python - Use Django Framework with Website and Stand-alone App

python - Execute a prepared statement in sqlalchemy

python - Django: Dynamic LOGIN_URL variable

Python IRC client: write from scratch or write plugin for existing framework?

posix - What is the easiest way to see if a process with a given pid exists in Python?

Reversible dictionary for python

I need a Python class that keep tracks of how many times it is instantiated

python - Embedding a 3-D editor (such as Blender) in a wxPython application

multithreading - Python Subprocess.Popen from a thread

Does running separate python processes avoid the GIL?

how to convert a python dict object to a java equivalent object?

How to print output using python?

debugging - Can I trace all the functions/methods executing in a python script?

python - MetaPython: Adding Methods to a Class

python - Referencing a class' method, not an instance's

import - Importing methods for a Python class

django - Custom Python exception with different include paths

python - Convert a value into row, column and char

python - Django Reporting Options

pseudocode - Transform game pseudo code into python

python - Is this a sensible approach for an EBCDIC (CP500) to Latin-1 converter?

python - Error trapping when a user inputs incorect information

python - How can I import a package using __import__() when the package name is only known at runtime?

python - How can I make a list of files, modification dates and paths?

Python threads - crashing when they access postgreSQL

read eval print loop - Python REPL for a running process

python - cx_Oracle and the data source paradigm

python class variable not visible in __init__?

Python Encryption: Encrypting password using PGP public key

python - How to use standard toolbar icons with WxPython?

What is the runtime complexity of python list functions?

c - Building a Python shared object binding with cmake, which depends upon external libraries

python - Can you suggest any extended examples on object-oriented software design?

Terminating a Python Program

c# - Does anyone know of source code for a web based study group?

python - Get the items not repeated in a list

Correct way of handling exceptions in Python?

javascript - Gantt Chart online

python - How do I infer the class to which a @staticmethod belongs?

c++ - Calling a non-returning python function from a python script

python - PythonCard - Can I launch a CustomDialog Stand Alone?

multithreading - Can client side python use threads?

Python Libraries for FTP Upload/Download?

python - ODFPy documentation

python - Form Initialization with ToscaWidgets

Python Script Executed with Makefile

python - SQLite parameter substitution and quotes

python - Django : Timestamp string custom field

dictionary - Why are 008 and 009 invalid keys for Python dicts?

python - HTML inside node using ElementTree

text - Python - Reading multiple lines into list

php - Coding collaboratively for the web

Python socket accept blocks - prevents app from quitting

python - Adding attributes into Django Model's Meta class

Python win32 com : how to handle 'out' parameter?

What is this function doing in Python involving urllib2 and BeautifulSoup?

python - Formatting date times provided as strings in Django

Sorting a Python list by key... while checking for string OR float?

python - Why does list comprehension using a zip object results in an empty list?

Python web framework with low barrier to entry

digest - Difference in SHA512 between python hashlib and sha512sum tool

A question on python sorting efficiency

python - Custom Filter in Django Admin on Django 1.3 or below

python - What is the DRY way to configure different log file locations for different settings?

html - IMAP4_SSL with gmail in python

python - Detect URLs in a string and wrap with "<a href..." tag

Python NotImplemented constant

python - ftplib checking if a file is a folder?

python - method for creating a unique validation key/number

Python: accessing DLL function using ctypes -- access by function *name* fails

ajax - Call Google Translate from Python

python - Dynamic Language Features and Meta-Programming Used in Django

How to install Python 3rd party libgmail-0.1.11.tar.tar into Python in Windows XP home?

python - How to distinguish field that requires null=True when blank=True is set in Django models?

python - Sqlalchemy complex in_ clause with tuple in list of tuples

Are there programmatic tools for Perl to Python conversion?

testing python applications that use mysql

python - Deploying Pylons with Nginx reverse proxy?

python - Does Pythoncard have an on change event?

ctypes in Python 2.6 help

events - Python Xlib catch/send mouseclick

python decimal comparison

How to recreate this PHP code in Python?

python - Scrolling through a `wx.ScrolledPanel` with the mouse wheel and arrow keys

Know any creative ways to interface Python with Tcl?

python - Preventing file handle inheritance in multiprocessing lib

file won't write in python

subprocess - Starting and Controlling an External Process via STDIN/STDOUT with Python

Create instance of a python class , declared in python, with C API

python - Pylons: address already in use when trying to serve

python - Creating a doctype with lxml's etree

Modifying list contents in Python

python - IE8 automation and https

Writing a website in Python

python - Django: How to sort a ModelForm's Many2ManyField (Select Tag) according to the object's __unicode__() value?

python - How do I exchange keys with values in a dictionary?

python - Changing brightness of the Macbook(Pro) keyboard backlight

windows - How To: View MFC Doc File in Python

python - Reportlab page x of y NumberedCanvas and Images

Very simple Python script, puzzling behaviour

python - How to walk up a linked-list using a list comprehension?

Python JSON encoding

python - Django with system timezone setting vs user's individual timezones

functional programming - Equivalent for inject() in Python?

python - Why does declaring a descriptor class in the __init__ function break the descriptor functionality?

python - Call flatpage from with a view

What's the easiest way to escape HTML in Python?

python - Django - alternative to subclassing User?

command line arguments - Python - configuration options, how to input/handle?

Validate SSL certificates with Python

Initialise a list to a specific length in Python

How to test a Python script with an input file filled with testcases?

Subclassing in Python

python - re.search() breaks for key in form.keys() loop

python - Adding Cookie to SOAPpy Request

Is there a python ftp library for uploading whole directories (including subdirectories)?

How to create "virtual root" with Python's ElementTree?

Counting repeated characters in a string in Python

Python tkInter Entry fun

python - KenKen puzzle addends: REDUX A (corrected) non-recursive algorithm

c# - Create a GUI from a XML schema automatically

python - Resolving a relative path from py:match in a genshi template

apache - Python + CGI script cannot access environment variables

Deleting files by type in Python on Windows

python - How to import a module from a directory on level above the current script

python - print statement in for loop only executes once

coding style - Autoload in Python

an error in taking an input in python

Finding a python process running on Windows with TaskManager

python - split a string by a delimiter in a context sensitive way

python - using profiles in iPython and Django

Python Video Framework

Python newbie: What does this code do?

php - Open-Source Forum with API

How to calculate a mod b in Python?

python - Problem using os.system() with sed command

String reversal in Python

algorithm - Speed of calculating powers (in python)

python - Can I be warned when I used a generator function by accident

python - server side marker clustering in django

How to fix Python indentation

python - Number of visitors in Django

python - Closing file opened by ConfigParser

Can python doctest ignore some output lines?

python - Sandboxing in Linux

c# - How to use QTP to test the application which operates in citrix of Remote Machine?

Python RSA Decryption Using OpenSSL Generated Keys

python - Form validation in django

python - Django way to do conditional formatting

python - Django: information captured from URLs available in template files?

python - Parsing HTML rows into CSV

python - What's a good data model for cross-tabulation?

python - Alternative XML parser for ElementTree to ease UTF-8 woes?

python - Looping Fget with fsockopen in PHP 5.x

subclass - Reclassing an instance in Python

Get MD5 hash of big files in Python

python - Skip steps on a django FormWizard

python web framework large project

How to stop Python parse_qs from parsing single values into lists?

c# - Is is possible to return an object or value from a Python script to the hosting application?

c - Is there an easy way to convert an std::list<double> to a Python list?

where to start OpenID implementation in python,which API is better suits

python - Large Sqlite database search

What's a good beginner setup for C++/Python on OSX?

python - most efficient data structure for a read-only list of strings (about 100,000) with fast prefix search

Add SMTP AUTH support to Python smtpd library... can't override the method?

python - pygtk loading a flow of image in only one pixbuf

Interface for modifying Windows environment variables from Python

python - How to call Apple Authorization API from PyQt4

c# - Automate SSH login under windows

file io - How to replace a column using Python's built-in .csv writer module?

python - Beautiful Soup cannot find a CSS class if the object has other classes, too

python - Is it pythonic to import inside functions?

python - pygtk: free variable referenced before assignment in enclosing scope

How to write a proxy-server in Python?

python - Difference between using __init__ and setting a class variable

python - Following a javascript postback using COM + IE automation to save text file

python - subclassing int to attain a Hex representation

python - It is possible to match a character repetition with regex? How?

python - Getting distutils to install prebuilt compiled libraries?

Using doctest "result parser" within unit-tests in Python?

What's the simplest way to put a python script into the system tray (Windows)

Python: Get Mount Point on Windows or Linux

binary - Can bin() be overloaded like oct() and hex() in Python 2.6?

python - How can I have variable assertions in Perl?

python - What's the point of alloc_color() in gtk?

how to take a matrix in python?

xml - How to create arrayType for WSDL in Python (using suds)?

active directory - Python LDAP Authentication from remote web server

which exception catches xxxx error in python

python - Execution of script using Popen fails

python - tkinter text entry validation

How to get a reference to current module's attributes in Python

python - How can I highlight a row in a gtk.Table?





top