Posts tagged “Python”
2013 Feb 14
WSGI and truncated chunked response bodies
I may be almost through with WSGI. While it has certainly worked for a number of my close-to-the-wire HTTP projects over the years, I seem finally to have reached an edge case where — as a standard — it cannot guarantee that I even return a correct response to browsers!…
2013 Jan 12
iPython Notebook and Astronomy at CodeMash
Another CodeMash is over! Bacon has been eaten, the Kalahari water park has echoed with talks about languages both static and dynamic, and one of the world's most eclectic programming conferences has sent more than a thousand attendees away happy. You're missing @brandon_rhodes #codemash talk. twitter.com/benjaminws/sta…— Benjamin W. Smith (@benjaminws)…
2012 Jun 4
Updates to my free chapter on Screen Scraping
There are two updates that I need to share with readers of the “Screen Scraping” chapter of Foundations of Python Network Programming, the book I revised for Apress in 2010 — a rewrite of the original edition by John Goerzen that was published in 2004. The chapter is now available…
2012 Apr 13
Introspect Python logging with logging_tree
It is frustrating that Python's logging module cannot display the tangled tree of configured loggers that often result from combining your own application code with several libraries and frameworks. So I have released a new Python package named logging_tree, which I announced last month during the PyCon 2012 closing lightning…
2012 Apr 6
Adventure in Python 3
I have just released adventure 1.2 on the Python Package Index, an update of my Python 3 port of the original Colossal Cave Adventure game that I announced more than a year ago during the final round of PyCon 2011 lightning talks. Written in the late 1970s, “Adventure” was the…
2012 Apr 3
Semantic Linefeeds
I give some advice each year in my annual Sphinx tutorial at PyCon. A grateful student asked where I myself had learned the tip. I have done some archæology and finally have an answer. Let me share what I teach them about “semantic linefeeds,” then I will reveal its source…
2012 Mar 30
Counting, without counting, in Python
It often irks me that the normal Python pattern for running the body of a loop n times results in the allocation and destruction of n integer objects, even if the body of the loop does not need them. # Creates one million integers for i in range(1000000): print #…
2012 Mar 13
Walking to PyCon on your own two feet
Before arranging for a cab ride or airport shuttle, have you considered that your own body is designed for traveling long distances under load? Last Tuesday I simply walked the 5 miles (8 km) from the San Jose Airport to the PyCon 2012 venue. My route included a stream lined…
2012 Jan 15
JavaScript Breaks Math
Why do we Python programmers stay so annoyed with JavaScript's broken this keyword? After all, every programming language has rough edges. The problem with this even turns out to be easy to work around once you learn the knack. So why does it feel like JavaScript has committed a fresh…
2012 Jan 10
Why am I going to CodeMash?
By this time tomorrow I will doubtless be wearing swimming trunks — in northern Ohio — in winter — while listening to people rave about Java and C# and Ruby and wondering what I have gotten myself into. I will be at CodeMash, a conference that was started by developers…
2011 May 4
Mounting WSGI Applications Under CherryPy
Today I got stuck between a rock and hard place — or, more specifically, stuck between the assumptions of Robert Brewer and those of Ian Bicking. In case you ever try mounting a WSGI application underneath a larger CherryPy application, here is the story. Simple WSGI grafting Robert Brewer's CherryPy…
2011 Feb 20
Visible Indentation in Python Publishing
It suddenly occurred to me that I managed to write an entire blog post about my new book last month without so much as mentioning that it represents a landmark, so far as I know, in Python publishing. What was my big idea? That in printed Python code, indentation should…
2011 Jan 26
Grin and search it
I want to admit how much I am enjoying the grin search tool that lets you use Python regular expressions in recursive searches across your filesystem, automatically ignoring directories like .hg and files with extensions like .pyc and .jpg. Over the years I had already built a stable full of…
2011 Jan 24
Foundations of Python Network Programming: A Last Hurrah For Python 2
My long labor is at last at an end: Apress has published my rewrite of John Goerzen's Foundations of Python Network Programming (2004) and I have released the example programs as both Python 2 and Python 3 code in a Bitbucket repository and also as a zipfile on the Apress…
2010 Oct 19
CherryPy and running out of file descriptors during development
Well, that was interesting! A fellow developer complained that, following my recent introduction of ØMQ into our project, he could only go through a few cycles of editing the source code, saving his changes, and watching CherryPy automatically restart before it would fail with: IOError: [Errno 24] Too many open…
2010 Jun 10
Grok has book. Book good!
I little suspected the great chasm that lies between the simple act of agreeing to review a book, and the actual exercise of sitting down later to write the review. It feels quite pleasant, really, to jot off a positive reply to the publisher's polite question. One feels magnanimous for…
2010 May 14
Python multiprocessing is different under Linux and Windows
One of the great recent advances in the Python Standard Library is the addition of the multiprocessing module, maintained by Jesse Noller who has also blogged and written about several other concurrency approaches for Python — Kamaelia, Circuits, and Stackless Python. I have wanted to try the multiprocessing module out…
2010 Mar 21
Sphinx + Mercurial = My favorite CMS
Though I write and maintain some of the content for our Python Atlanta web site, updates and additional content often come in from other users. For example, our Plone interest group — headed up by Christopher Johnson — has their own page on our web site. And the information about…
2010 Feb 25
Ubuntu Python: raise an exception, import 190 modules
Imagine my surprise, while writing my first PEP 302 compliant import hook this afternoon, to carefully watch sys.modules for the results of my import but see it suddenly grow by nearly two hundred modules! What on earth had I done wrong? Some quick experiments revealed that my only sin was…
2010 Feb 24
Opening tabs remotely in Google Chrome
Now that I use Google Chrome almost exclusively, I miss the fact that a running Firefox instance could be controlled from the command line so that Emacs could call for a new tab when I clicked on a URL. It would run a command something like this: firefox -remote 'openURL(http://example.com/,…
2010 Feb 1
Leaving Python Magazine
It was with regret that I tendered my resignation yesterday as the Editor-in-Chief of Python Magazine. While the publisher will keep producing the magazine by distributing PDFs on the web site, the transition to the new format has dragged on long enough — both for both myself and our customers…
2009 Oct 20
The September 2009 issue of Python Magazine
The September issue of Python Magazine appeared on the web late last week and only now, as a new week has started, am I finally sitting down to announce it! The articles range from technically heavy development topics to high-level thoughts about the whole Python community, with plenty in between.…
2009 Sep 30
Google Earth and Middle-earth
Importing a normal, rectangular map of Middle-earth as a Google Earth overlay is too narrow toward the north. I wanted to measure distances in Tolkien's Middle-earth. While a flat map distorts such measurements, it occured to me that Google Earth can correctly measure both lines and paths across the curved…
2009 Sep 21
Python at the 2009 Atlanta Linux Fest
My Python table at the Atlanta Linux Fest. You can also watch a short video of me demonstrating a depth-first search to some students who dropped by the table. (Thanks, Richard Davies, for the video!) Running the Python table at the Atlanta Linux Fest this past weekend was a really…
2009 Sep 10
GetPaid needs customizable forms
I would like some advice from Zope and Plone folks about how to create forms that are not only easy for other developers to specialize, but which allow several specializations to be composed together. While I have used zope.formlib and z3c.form before for simple tasks, I have not yet been…
2009 Sep 7
The August 2009 issue of Python Magazine
The August issue of Python Magazine is out, and the cover issue is one of the most exciting that I have had the privilege to publish. Following up on his popular talk at PyCon 2009, professor of computer science Dr. Bill Punch has written an article for us with his…
2009 Aug 15
The July 2009 issue of Python Magazine
I am home from a relaxing vacation to the Midwest, and while I was gone last week my excellent publishing team released the July issue Python Magazine to the world. I am particularly pleased that two of the feature articles in this issue come from important segments of the Python…
2009 Aug 1
Installing "lxml" for Python under your WebFaction account
Well, drat. Thanks to more than an hour of work today, I have a pretty list of a few dozen commands that make it easy for a WebFaction account holder to install the powerful lxml Python package for parsing HTML and XML under their hosting account. You can read Ian…
2009 Aug 1
The Road to WebFaction
I am very happy with my first weeks of hosting sites at WebFaction. They have taken so much responsibility off of my shoulders. They run nginx in front of my web applications on my behalf. I fill out a simple form, placing Pylons under / and Wordpress under /blog, and…
2009 Jul 20
Plone and IRC
Hypothesis — the vibrancy of a framework's IRC channel is proportional to the amount of time that the framework takes to start up each time you tweak your code or settings and need it reloaded. Further hypothesis — this relationship is non-linear. My guess is that frameworks which take, say,…
2009 Jul 15
The terrible magic of setuptools
I am providing a bit of assistance to the wonderful Natural Language Toolkit Project, who have implemented a wide array of language processing algorithms in Python atop a common set of very sleek — and cleanly Pythonic — data structures for representing natural language. If you are at all interested,…
2009 Jul 9
The June 2009 issue of Python Magazine
The new issue of Python Magazine is out, and it's a technically hefty issue that, while lacking the kind of human-interest “what Python did for me” stories that I often use to balance the articles about programming, does do a really good job of showing the diverse kinds of problems…
2009 Jun 27
The Python language and poetry
If programming languages were poets, which poet would the Python language be? Obviously, Python would be e. e. cummings — the poet for whom whitespace was most truly significant!…
2009 Jun 5
The May 2009 issue of Python Magazine
The May issue of Python Magazine is now online! Obviously things fell a bit behind schedule this month, as I am writing this five days into the month of June. But with all of the excitement surrounding the publisher's flagship annual conference last month — php|tek 2009 in Chicago —…
2009 May 2
The April issue of Python Magazine
It was back in the early 1990s, if memory serves me, that the Coca-Cola company — it may have been in one of their annual reports — decided to change their perspective. They declared that the soft drink market, of which they held more than 50%, was simply too small…
2009 Apr 22
pyron: Making Python package development DRY to the point of no return
I finally snapped last week. After years of writing verbose and repetitive setup.py files for my Python packages, I am unable to write another. Instead, I have started writing Pyron, a tool that gathers the same information by inspecting a Python package itself. Not only does this mean that I…
2009 Mar 28
My first issue of Python Magazine
My first issue of Python Magazine is out! After two months of being tutored in the arts of magazine publishing by retiring editor Doug Hellmann, March has been my first month in the Editor-in-Chief chair of Python Magazine. It is exciting to have my first issue come out while I…
2009 Mar 15
Adding margins to PDF watermarks
This is the second article in my series on adding “watermark” images to PDF files, which sit behind any text and graphics that were already on the page. Last week I outlined the first two lessons that I learned while developing this watermark process: first, always use Adobe Acrobat to…
2009 Mar 11
I finally understand nested comprehensions
This entire blog post can be summarized in the words of Guido himself that I have just discovered down at the bottom of PEP-202 (“List Comprehensions”): The form [... for x... for y...] nests, with the last index varying fastest, just like nested for loops. Have you ever seen a…
2009 Feb 25
Installing Python packages for Emacs with virtualenv
The only rough edge I have found amidst the otherwise exceptional advice on Ryan McGuire's Enigma Curry blog is that Ryan recommends installing Python packages with: $ sudo easy_install package_url This means that his Emacs configuration — which, very generously, he has started maintaining as a project on github so…
2009 Jan 1
New Year's meme: What are the oldest files in your home directory?
Celebrate the new year with a blog post discussing the oldest files that are still sitting somewhere beneath your home directory! The procedure is simple: Run the following script in your home directory. (You might want to use less to read the output.) Ignore files whose date does not reflect…
2008 Dec 14
Why triple-quotes make PyFlakes hang Emacs
I need to refine the aspersions which I cast against PyFlakes last night in my response to Chris McDonough, answering his bounty against the bug that Emacs would hang in Flyspell mode when he typed triple-quotes. My email, I admit, was not entirely fair to PyFlakes; but you must remember…
2008 Dec 13
PyEphem now available for Python 3.0!
Eager not to be left behind by the advance of history, I have released PyEphem tonight for Python 3.0! After updating its C-language routines earlier this week, as described in my previous post, and adjusting its Python syntax, I thought that my work was done — until I received a…
2008 Dec 9
Porting a C extension module to Python 3.0
With several packages already advertising Python 3.0 compatibility, it seemed high time to look into releasing my PyEphem astronomy package in an edition compatible with the new language. But I hesitated: how difficult is it really, and how many hours of work will it consume, to port a C-language extension…
2008 Dec 4
Comprehension consistency at last in Python 3.0!
A new era is begun: Python 3.0 has been released, bringing the bright and burning lights of reason, consistency, and symmetry to bear on my favorite language. Guido van Rossum, the creator of Python, has carefully guided this final attempt to remove the warts that have accumulated over the language's…
2008 Aug 19
Reading Code: A Computer Science Curriculum
I developed the following ideas about how to teach computer programming during a recent conversation with Daniel Rocco, a professor at the University of West Georgia, and Georgia Tech grad student Derek Richardson, and I wanted to expand on the ideas here on my blog. I have been heavily influenced…
2008 Jun 14
PyEphem 3.7.2.4, now on Launchpad!
I have decided to give my PyEphem astronomy library for Python a public source code repository, an open forum for user questions, and a bug tracker where my users can see the progress of their bug reports out in the open rather than having them scattered across our email inboxes.…
2008 Jun 5
My NOLA Plone Symposium talk, “the Zope 3 Component Architecture”
I have delivered my “Zope 3 Component Architecture” talk to the 2008 North American Plone Symposium meeting here in New Orleans. I want to thank the folks at Enfold Systems both for hosting the Symposium, inviting me to speak, and for generously making it possible for me to attend! Here…
2008 Feb 23
Presentations on Buildout and KSS
After several frustrating weeks learning how to create, edit, and publish a screencast under Linux (about which I will write a separate post), I have now published screencasts of both presentations that I gave at the PyAtl meetup in January. I opened with a talk about the import statement, and…
2007 Nov 9
My November Grok Presentation
In this post, I provide the slides and examples from a recent talk that I gave to some fellow software developers at Georgia Tech. Many of them were not familiar with web frameworks, and I wanted to introduce them to two common concepts: the idea of “convention over configuration,” and…
2007 Nov 9
PyEphem available for Windows!
Over the years I have received many requests from frustrated Windows users, asking for a Windows-native version of my PyEphem astronomy library for Python. For most Windows users, an attempt to build the extension ends abruptly with the terrible and famous message: error: Python was built with version 7.1 of…