Category: Python

  • PyXML 0.8.2

    PyXML 0.8.2 has been released:

    Version 0.8.2 of the Python/XML distribution is now available. It should be considered a beta release. The Python/XML distribution contains the basic tools required for processing XML data using the Python programming language, assembled into one easy-to-install package. The distribution includes parsers and standard interfaces such as SAX and DOM, along with various other useful modules.

    From my limited experience, the built-in XML tools that ship with the Python Standard Library are quite good.  Of course, I’ve been parsing extremely small and simple files, and I’m sure it could be done more efficiently.

    I haven’t had a chance to check this package out, but I’ll let you know if I do.

  • Programming at Python Speed

    Thanks to Erik for pointing out an interview with Guido van Rossum about, imagine that, Python.  There are two previous interviews also available.

  • Blosxom 1.0 and pyRuby?

    Here’s two birds with one stone.  So if you show up at PyCon, Sam, will you still be wearing your Perl shirt?

    Rael Dornfest: I’m thrilled to announce the 1.0 release of my Blosxom weblog app…. With the choice of dynamic or static rendering, Blosxom is at the point I’d hoped it’d be when it went 1.0.

    Now I have my first dillema. I want to do static rendering for scalability, but in accordance with the teachings of REST, I also want my URI to identify resources that can serve both GETs and POSTs.

    Meanwhile, the temptation to ditch Perl for Python is growing…

  • Pay No Attention to the TrackBack in the Corner

    Okay.  I put together a really simple trackback implementation in Python last night.  I took a look at the trackback tech specs and have so far implemented the ping method.  The code below illustrates usage of the trackback library.

    import tblib
    tb = tblib.TrackBack("http://mt.develooper.com/mt/mt-tb.cgi/17",
    "Python Test",
    "I'm testing my Python TracbBack implementation...",
    "http://postneo.com/2003/01/22.html#a1829",
    "Matt Croydon::Postneo")
    tb.ping()

    Here’s the output for the above code:

    200 OK
    <?xml version="1.0" encoding="iso-8859-1"?>
    <response>
    <error>0</error>

    The implementation does not know anything about auto-discrovery yet.  It also does not deal with error handling, it just prints out the response.  Future versions will handle both.  If you’d like to play, you can download the source: tblib-0.0.4.py.txt.

    In order to run a script similar to the example I provided (which pings a page on Ask’s weblog), you’ll have to rename it to tblib.py and place it in the directory of the calling script.  Once the library is polished, I’ll create a setup script so you can simply run python setup.py –install.

    As soon as I get the chance, I’ll complete the implementation and put together a command line client.  The program is released under the GPL.  Thanks go out to Mark for Dive Into Python and to the Python people for the excellent docs available online.

  • My New Python Best Friends

    I’d like to give a quick shout out to a few of my favorite new Python modules:

    • httplib: The httplib example page has some excellent usage examples for both GET and POST methods.
    • urllib: urllib.urlencode is your friend if you need to encode a url for inclusion in a POST request.
    • urlparse: I started to parse and split up urls by hand using regular expressions and string manipulation.  Then I found urlparse.  It will take a url like http://postneo.com/projects/wapblog and turn it into a useful tuple: (‘http’, ‘postneo.com’, ‘/projects/wapblog’).  This improved my quality of life considerably, and makes POST requests via httplib possible.

    P.S. These libraries converge to make working with RESTful interfaces DUH-simple in Python.

  • SCons: a Make Replacement using Python

    SCons 0.10 has been released:

    SCons alpha release 0.10 is now available for download. SCons is a software construction tool (build tool, or substitute for Make) implemented in Python, based on the winning design in the Software Carpentry build tool competition (in turn based on the Cons build tool).

  • LinuxWorld Expo Blogger Dinner

    Yesterday I asked if any bloggers out there would be attending LinuxWorld Expo January 22-24.  I haven’t heard anything, but if you’d like more info or might attend, you can visit (and modify!) the wiki page I set up for it.

    I finally got around to installing MoinMoin on my web provider.  The installation was really easy.  If you’d like, you can poke around the wiki root at Matt Croydon::Postwiki.

    Update: Oops, the wiki page now actually points to the wiki page.

  • Scripting Languages Year In Review

    Slashdot pointed to a really cool scripting languages year in review.  It covers several scripting languages.

  • PyCon 2003 Update

    I just got an email from the Pycon interest mailing list by Guido van Rossum.  Here are some details on pricing:

    • $150 early bird (registered and paid up to 4 weeks before the conference)
    • $200 regular pre-registration (registered and paid up to a few days before the conference)
    • $250 all on-site payment (pre-registration is still strongly recommended when paying on-site, to ensure your space and to speed up badge creation)

    There is also an IRC channel on irc.freenode.net called #pycon.

  • Freshmeat Roundup

    Here are several programs that I think are worth mentioning or taking a look at.  These have been released or updated in the last day or so.  I regularly try to point out notable freshmeat releases in individual posts, but there are a bunch today:

    fn 0.0.1 was announced on freshmeat today.  Here’s the project description:

    fn (FetchNews) is a non-interactive command-line tool for downloading and aggregating xml-based newsfeeds from web sites. It is suitable for use in a cron job to gather newsfeeds and generate reports at regular intervals.

    It looks like this bad boy is written in C for the following reason:

    A program like this should really have been done in a scripting language like perl or python, but when I started writing it I was bored with both those languages and was looking for a challenge.

    Good stuff.  The author has made some output from his program available.

    pycURL 7.10.3 (and the underlying cURL/libCURL 7.10.3) has been released.  Looks like a bugfix/tweak release from here.

    JCTerm, a Java SSH2 terminal emulator, 0.0.2 has been released:

    New features include sftp support, function keys and arrow keys support, and improved rendering speed.

    TkVNC, a VNC viewer written in pure Tcl/Tk (!!!), 0.9 is out.

    Qt# 0.6 is out:

    This version improves support for Portable.NET and Ximian Mono, corrects the ctor signature for QTabWidget, now explicitly names all anonymous enums, includes boxing constructor access modifiers, adds missing methods to QComboBox, corrects ctor syntax for the examples, adds byte[] to QByteArray conversion, adds a new qmake-based build system for qtc distributions, adds a new csant-based build system for Qt# distributions, and includes a QFractals sample, a port of a Java quantum fractal generator to C#.

  • New Edition of Py (the zine)

    NewsForge notes that Py (the zine) 1.3 is out.

  • Python Happenings

    LWN points to this weeks Dr. Dobb’s Python-URL and also recent happenings at Python-dev.

  • Rdflib 1.2.0

    Phillip Pearson notes the latest release of rdflib for Python:

    rdflib 1.2.0 is now the latest stable release of Daniel ‘eikeon‘ Krech’s Python RDF parser/generator.

    This is amusing mostly because I started poking around the 1.1.5 development release a few days ago.

  • Python Tweakings

    I snagged the latest IDLEfork this morning and updated my ftplib example to download something smaller than a 5 meg file.  It worked great on my dev box on cable, but it took a long time on a box at work running DSL, and I thought of the poor dialup users.  That’s fixed, it now downloads a file that is a couple of hundred k.

    I like IDLEfork so far, it seems to perform well.  I wound up having 4 or 5 windows open at one point, as it seems to spawn a new window for each file opened or script run.  I like progress though.

  • Python Ftplib Example

    This evening I wrote a simple script that hopefully explains Python’s ftplib a little bit more than your typical example.  For some reason, I couldn’t find anything approaching a comprehensive example of using ftplib on the web.  This article is aimed at Python newbies who are looking to do something useful with ftplib.

    So here’s my first semi-in-depth piece of 2003: Beyond the Basic Python Ftplib Example.  You can also look at the GPL’d source: ftptest.py.  Don’t let the name fool you, it’s still very basic, just slightly more in-depth than current online tutorials.  Hopefully I’ll be able to expand upon this in the future.

  • Zen and the Art of Comprehensive Archive Networks

    This is a great article for many audiences.  Anyone from geeks and programmers to sysadmins or architects of distributed storage systems would get a kick out of this article:

    It seems that there is a lot of interest in having similar archives for other languages like CPAN [1] is for Perl. I should know; over the years people from at least Python, Ruby, and Java communities have approached me or other core CPAN people to ask basically “How did we do it?”. Very recently I’ve seen even more interest from some people in the Perl community wanting to actively reach out a helping hand to other communities. This ‘missive’ tries to describe my thinking and help people wanting to build their own CANs. Since I hope this message will somehow end up reaching the other language communities I will explicitly include URLs that are (hopefully) obvious to Perl people. Note that I’m going to describe what things worked for Perl, translate appropriately for other languages.

    [via Use Perl;]

  • Parsing with Spark

    David Mertz at IBM developerWorks goes over Spark, a Python parser:

    Spark is a powerful and general parser/compiler framework written in Python. In some respects, Spark offers more than SimpleParse or other Python parsers. Being pure Python, however, it is also slower. In this article, David discusses the Spark module, with code samples, an explanation of its usage, and suggestions for its areas of application.

    [Via RootPrompt]

  • Something Up My Sleeve

    I’ve got something up my sleeve.  I’ve been fiddling around with the python I need (gotta love interactivity) in order to pull it off.  It should be pretty interesting.  It should be trivial but neat.  More info as I code it.

    Python’s ftplib seems really zippy, by the way.  At least over a full-duplex 100 megabit switched network anyway.

  • creativeCommons RSS Module Validates

    Sam Ruby has made sure that the creativeCommons RSS 2.0 module validates.

  • Open Source and Proprietary Licensing Problems

    More licensing questions, this time from Alan James Salmoni at Advogato:

    Will MS and the FSF allow me to mix GPL’d Python code with an instance of MS’s Internet Explorer? Help!!!

    • Is it “safe” for me to release the program (whether under an open source or proprietary license) to the unsuspecting public, when the program will need to embed IE into it, but doesn’t include IE at all?
    • Would the GPL allow me to embed an instance of IE within my program?

    Don’t flame the messenger, and your best bet is probably to comment on the article.