Category: Python

  • Python3DS: Access 3ds Archives with Python

    Here’s one just for the Pythoneers in the house.  Python3DS:

    python3ds is a small set of Python routines for reading 3ds archives. It features support for animations, textures, and collision detection, and it is compatible with pyopengl and pygame.

    New for the 0.2 release:

    This release adds a new engine for animations, collision functions, exportation of 3ds files to Dict types, and a small demo.

     

  • The Joy of Python: class2dict and dict2class

    One of V. Satheesh Babu‘s joys of Python is coverting dictionaries to classes and back again.  Silly but cool!

  • New O’Reillynet Articles on XML, Python, and Web Services

    O’Reilly unleashed several new articles today:

    Is There a Consensus Web Services Stack? by Kendall Clark:

    What Marx said of world history — that it occurs the first time as tragedy, the second as farce — is increasingly true of conversations in the XML development community. Conversation among XML developers has grown increasingly ossified. Permanent topics of conversation return — never, it appears, to be fully repressed — over and over: the ins and outs of namespaces, the nature of resources and representations, why SOAP is sweetness-and-light or pure evil, the ideal simplifying refactor of XML itself, and so on. And, each time the cycle repeats itself, the positions grow more shrill, more caricatured, and less interesting. I suppose that it’s possible that someone eventually learn something from all of this; more likely, people give up the hope of learning something and stop paying attention.

    Building Metadata Applications with RDF [and RDFlib] by Bob DuCharme:

    The real test of any technology’s value is what kinds of tasks are easier with it than without it. If I hear about some new technology, I’m not going to learn it and use it unless it saves me some trouble. Well, being a bit of a geek, I might play with it a bit, but I’m going to lose interest if I don’t eventually see tangible proof that it either makes new things possible or old things easier.

    Simple XML Processing With elementtree by Uche Ogbuji:

    Fredrik Lundh, well known in Python circles as “the effbot“, has been an important contributor to Python and to PyXML. He has also developed a variety of useful tools, many of which involve Python and XML. One of these is elementtree, a collection of lightweight utilities for XML processing. elementtree is centered around a data structure for representing XML. As its name implies, this data structure is a hierarchy of objects, each of which represents an XML element. The focus is squarely on elements: there is no zoo of node types. Element objects themselves act as Python dictionaries of the XML attributes and Python lists of the element children. Text content is represented as simple data members on element instances. elementtree is about as pythonic as it gets, offering a fresh perspective on Python-XML processing, especially after the DOM explorations of my previous columns.

    I’ll be reading all of these articles later this evening after some coding for schoolwork gets done.

  • Perl vs. Python vs. Ruby

    X-Archetypes:

    via Michael J. Tsai: Perl vs. Python vs. Ruby provides a look at the three scripting languages and compares the syntax on small project. There are also some great comments that follow his piece. Thanks Michael!

  • Plone 1.0 Released

    X-Archetypes:

    Exploring Plone has been fun. After much anticipation, version 1.0 of the Zope overlay was released on Friday. Plone provides a great set of tools for tapping into Zope quickly.

    Python is a great language for web programming. Zope and Plone are built with this solid OO scripting language. I am interested to see how others with be utilizing this new release.

    I only ever played with zope for a little bit a year or two ago, before I had any “real” Python experience/knowledge.  It seemed incredibly cool, but I didn’t really see how I could apply it to things that I deal wtih.  I haven’t had a chance to take a look at it since.

  • Testing Trackbacks with tblib

    Matthew Langham:

    Frank is looking for someone to test whether his Trackback works. Radio doesn’t support Trackback – so perhaps some kind person will help. Thanks!

    I use Radio, and therefore don’t have trackback support, but I did ping his weblog manually with a python trackback library that I wrote.  His trackbacks seem to be working fine.

    [user @ box tb]$ ./tbclient.py -tburl http://www.koehntopp.com/cgi-bin/mt-tb.cgi/204 -title "Testing Trackback" -excerpt "I use Radio, which doesn't support trackback either, so I'm pinging gadgetguy.de with a command line client using tblib." -blogname "Matt Croydon::postneo" -url http://postneo.com/2003/02/07.html#a1992
    Trackback command line client here.  Preparing TrackBack...
    TrackBack URL: http://www.koehntopp.com/cgi-bin/mt-tb.cgi/204
    TrackBack Title: Testing Trackback
    TrackBack Excerpt: I use Radio, which doesn't support trackback either, so I'm pinging gadgetguy.de with a command line client using tblib.
    Your Weblog Name: Matt Croydon::postneo
    Your URL: http://postneo.com/2003/02/07.html#a1992
    Pinging http://www.koehntopp.com/cgi-bin/mt-tb.cgi/204...
    HTTP Response: 200 OK
    TrackBack Error Code is: 0 (zero is okay)
    Done!

  • Dict, Python clients, and Gophers, Oh My!

    I don’t use a spell checker for this weblog, and I’m truly sorry for that.  Sucks to be you, my reader.  Most of the time if I’m not sure of the spelling of a word, I’ll either look it up at dict.org or find a similar, easier to spell word.

    I was curious about DICT protocol clients, so I went to the links page.  This led me to John Goerzen’s Python client class.  I’m taking a look at it now, it looks simple yet powerful.  John hosts his content with a gopher.  I miss gopher.  Gopher used to be the coolest thing on the planet.

    Of course John has also written a gopher server in Python.  It’s called PyGopherd (duh!).  I so have to set one up.

  • pylibini 0.1.2 Released!

    Another gem this evening from freshmeat, pylibini 0.1.2 is out.  It’s a bugfix/tweak release.  It is also now released under the LGPL (previously GPL).  Here’s a quick description:

    pylibini is a Python module which provides powerful access and easy manipulation of .ini files in Python applications.

    Another useful tool for the toolbox.  Most of my work in Python has been fairly lightweight, probably not requiring .inis, but it’s good to know about.

  • PyObjC

    OSNews:

    Some programmers see the advantage of combining Python and Objective-C in the same environment, believing that a bridge between the two languages provides tremendous power and advantages to either language. For the Objective-C developer, access to Python provides a rapid application-development solution that’s far more efficient than one requiring a compiler. For the Python developer, transparent access to Objective-C would allow the developer’s scripts to leverage the full power and elegance of the MacOSX environment. In this article, Bill Bumgarner shows you how to bring these worlds together.

    Python just screams out to be integrated into other languages and environments, doesn’t it?

    I don’t currently have an OSX testbed, but I have an old G3 coming in that I have to troubleshoot and buy a few parts for.  We’ll see how that goes.

  • MoinMoin Updates

    I spent some time this evening chatting with Thomas Waldmann on #moin at irc.freenode.net. MoinMoin is currently at 1.0, though 1.1 is just around the corner. Hopefully 1.1 will include some caching support which should speed things up (Slashotting a MoinMoin wiki is not recommended) a bit. 1.1 should also bring compatability with persistance, such as the Twisted Framework and mod_python. More details on that can be found at the mailing list archives. Planned features for 1.2 include some darn smart internationalization. Linking WikiNames across languages sounds like a headache, but there is a working demo up and running.

    Aparently Thomas isn’t much of a Python guy, but he loves MoinMoin and is pleased to be working in Python.

  • PyCon DC 2003 Registration Open!

    Excellent! You can now register for PyCon DC 2003.

  • weblogs.py: Aggregated Python News

    Python Programmer Weblogs aggregates approximately 30 (as of this writing) python-related weblogs, my Python category included.  Think of it as the python equivalent to java.blogs.

    It is simple, yet elegant.

    It uses pyblagg [cvsweb], which relies on Mark’s awesome RSS parser.  Pyblagg was written by V. Satheesh Babu, and was obviously influenced by Rael’s blagg.

  • Tyler Eaves’ Python Tutorial

    Matthew Langham:

    Steven points to this tutorial [pdf] on Python. Even though it is still a work in progress, it looks promising.

    I’ve just begun to skim it, but it looks informative.

  • Python News and Linkage

    A sneak peek of some of the tracks and presentations for PyCon DC 2003 are available on the PyCon Wiki.

    OSNews points to an InformIT article (free reg req’d) about writing a multithreaded GUI app with Python.

    LinuxToday has this weeks Python-URL.  There are a few interesting links, but nothing spectacular.

    I think that’s about it, I’m pretty much caught up on Python stuff.

  • TBPY + tblib == EVIL!

    Phil Ringnalda points to Mark Paschal’s TBPY, a TrackBack server as a CGI written in Python.  (Thanks Phil!)

    You could do some evil stuff with TBPY + tblib.  EVIL!

    I’ve also added a highlighted version of the source (using GNU Source-highlighter).  Here they are:

    Are you sick of hearing about tblib yet?  Sorry.  I’ve been posting the more munade details in my projects channel. 

  • tblib Command Line Client

    Here it is, that command line client using tblib that I promised you.  It’ll be fairly useful under a unix-like environment, as you can just type ./tbclient.py <args> while in windows you have to do python tbclient.py <args> or use PythonWin or something.  Here is a sample session from one of my Linux boxes:

    [user @ box tb]$ ./tbclient.py
    Usage: tblib <args>
      Valid arguments:
        -tburl foo: ping the trackback url foo
        -title foo: title of your trackback or weblog post
        -excerpt foo: Uses foo as the excerpt to be posted to the trackback
        -url foo: The url to point to (usually the url of the post in which you ref the trackback)
        -blogname foo: The name of your weblog
    [user @ box tb]$ ./tbclient.py -tburl http://Queue/weblog/mt-tb.cgi/7 -title "My Title" -excerpt "My Excerpt" -url http://postneo.com -blogname "My Weblog Name"
    Trackback command line client here.  Preparing TrackBack...
    TrackBack URL: http://Queue/weblog/mt-tb.cgi/7
    TrackBack Title: My Title
    TrackBack Excerpt: My Excerpt
    Your URL: http://postneo.com
    Your Weblog Name: My Weblog Name
    Pinging http://Queue/weblog/mt-tb.cgi/7...
    HTTP Response: 200 OK
    TrackBack Error Code is: 0 (zero is okay)
    Done!

    The client, as the library is released under GPL, but I’m waiting for someone to speak up and I’ll be flexible on licensing.  There are a couple of gotchas in the current (really simple) client.  For example, you need to enclose arguments that are more than one word in quotes, otherwise it will truncate to the first word.  I’m really not dealing with command line args as well as I should be, but you can view the source for a quick and dirty way to DIY.

    That’s about all the functionality that you get in this 0.0.2 release.  The source code is here.  It relies on tblib-0.1.0 or greater (unless I break something in the future).  Send any questions or comments my way.  Over the next day or two, I’ll try to complete the client with an -autodiscover option.  I also want to clean things up with the option of -a || –autodiscover, etc.  I know it’s quite easy, I just didn’t have the energy to google it up.

    I still owe you some real docs and an actual project page, but that will come eventually.

  • Python in PHP

    Keith points out Python in PHP:

    To that end, I’ve written a Python extension for PHP. In short, this extensions allows the Python interpretter to be embedded inside of PHP (think of PHP as the parent language with Python as its child). This allows native Python objects to be instantiated and manipulated from within PHP. There is also initial support for accessing PHP functions and data from within the embedded Python environment.

    I’ll take two.

  • How Many Langues Will Fit in my Head?

    I’m going to one of my classes for the first time tonight.  It looks like I’ll be working almost exclusively in .NET and C#.  For kicks, I thought I’d wear my Linux Rocks tshirt to class.  We’ll see if people have a sense of humor or not.

    Now all I have to do is find a Microsoft shirt to wear to my Saturday morning class in which I’ll be working almost exclusively in Java.

    Java in the morning, C++ in the afternoon, C# in the evening.  If you count my recent Python on the side (and in the middle of the night), you could explain my current headache.  I’ll blame it on a lack of caffeine, though.

  • tblib in Action

    Here’s a shot from the trackback section of a MovableType weblog I have running behind the firewall:

    tblib

    For the record, implementing these functions in Python was trivial.  The source for tblib is pretty darn short even with a bunch of comments.  I could compress it a bit, but I’d like to keep it as readable to the newbie as possible.  Perhaps grokking the source to tblib would be the next logical step for a newbie after reading my ftplib example.  After they read Dive Into Python, of course.

  • tblib 0.1.0 Released!

    I managed to pick up tblib this evening and start working on it again.  I implemented some basic error checking and autodiscovery.  (Yay!)  The previous version of tblib would just consume the XML that resulted from a trackback ping.  Now it parses the xml with a really simple regular expression (thanks Steve!).  If it was a successful ping, self.tbErrorCode will be 0 (which is a good thing) and self.tbErrorMessage will be None.  If something went wrong, self.tbErrorCode will be 1 and self.tbErrorMessage will hopefully help you a bit.

    Here’s an example for you:

    >>> import tblib
    >>> tb = tblib.TrackBack()
    >>> tb.autodiscover('http://Queue/weblog/matt/archives/2003_01.html#000007')
    >>> print tb.tbUrl
    http://Queue/weblog/mt-tb.cgi/7
    >>> tb.blog_name = 'My Weblog'
    >>> tb.title = 'This Post Will Ping That Weblog Entry'
    >>> tb.url = 'http://postneo.com'
    >>> tb.excerpt = 'I released tblib 0.1.0 today.  It supports autodiscovery...'
    >>> tb.ping()
    >>> print tb.tbErrorCode
    0

    Here’s the source: tblib-0.1.0.py.txt.  To use it, save it (as tblib.py) to a directory, create a script in that directory, and put import tblib at the top.  It doesn’t use anything bleeding edge, but I’m pretty sure you’ll need Python 2.x.  See my original tblib weblog post for additional info.  It is currently licensed under the GPL, though if that is stopping you from including it in your project, email me and I can dual-license it or something.  Also use that email link to send me any questions or comments.

    Eventually, I’ll code a setup script for tblib, and I still owe you a command line trackback client using tblib.