background preloader

CS 495

Facebook Twitter

A Logging System for Python. The Red Dove Consultants website would like to place some cookies on your computer to help us make this website better.

A Logging System for Python

To find out more about these cookies, please see our privacy page. In order to stop seeing this box, you need to tick the box below which says "I accept cookies from this site" and then click on the Continue button (the button will remain disabled until you tick the box). Note: You need to have JavaScript enabled in your browser for this to work. I accept cookies from this site. Table of Contents AbstractMotivationInfluencesA Simple ExampleControl FlowLevelsLoggersHandlersFormattersFiltersConfigurationThe GUI ConfiguratorCase ScenariosThread SafetyOn-The-Fly ReconfigurationModule-Level Convenience FunctionsPerformanceImplementation StatusAcknowledgementsStill To DoDownload and InstallationChange HistoryCopyright and License Abstract Motivation The Python community has been incredibly helpful to me, a relative newcomer to the language.

Influences A Simple Example Control Flow. Vim. VI Improved (Vim) is an improved version of the editor "vi", one of the standard text editors on UNIX systems.

Vim

It has all the features you'll ever need from an editor, and probably three times that many more that you'll never use The newer versions also include a 'vimdiff' mode that you can use to diff and merge file(s). Oh, I didn't mention it's also scriptable in Python, and there's a graphical version: GVIM. Get it from Vim is also available in your favourite OS. You can download many scripts from and learn new tips from the site Vim 7.0 (released mid-2006) includes the Intellisense-like omni-completion for several languages. You can automatically enable syntax coloring and automatic indentation for Python code by adding the following lines to your ~/.vimrc file: syntax on filetype indent plugin on The following sections correspond to the guidelines from the HowToEditPythonCode page.

Indentation A useful addition to Python source files is this comment: set modeline Or: Syntax Highlighting. [projects] Contents of /python/trunk/Lib/SimpleHTTPServer.py. Issue839496: SimpleHTTPServer should open all files in binary mode.

[projects] Contents of /python/trunk/Lib/SimpleHTTPServer.py

Forward-port of 38255 (2005/01/15!) This was already fixed in 2.4, but never merged into trunk... py3k is already right, thanks to the bytes/str distinction! Should be backported to 2.5. Raymond Curry's Web Server Test Page. MIME Types by Content Type - List of MIME Types. Simple Portable Python Web Server. I am doing some work with Python at my internship, and for part of it I needed a simple dev web server (just for serving html pages, not interpreting or anything) and It was really easy to do.

Simple Portable Python Web Server

I adapted code from Jon Berg at turtlemeat.com, and came up with a thin, insecure, extremely portable dev web server. Here’s the code: (I’ve created this page as a wiki, so if you feel the need to tweak go ahead) #Adapted from work by Jon Berg, turtlemeat.com from os import curdir, sepfrom BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer # Global Variablesport = 80 class WebHandler(BaseHTTPRequestHandler): def do_GET(self): try: if self.path.endswith(".html") or self.path.endswith(".js") or self.path.endswith(".css") or self.path.endswith(".svg"): f = open(curdir + sep + self.path) #self.path reads in as /test.html#note that this potentially makes every file (of those types) on your computer readable by the internet def do_POST(self): global rootnode try: set.do_GET(self) except : pass.