What do we use Python for at work?

Not uncommonly, I suspect, Python was introduced here at work in stealth mode: it wasn’t on the list of products starting with “MS” which we genreally use, but it got the job done and the management has been pragmatic enough to accept its use to the extent that it’s now installed on the baseline image for company PCs and laptops.

So what do we do with it? Well, a surprising amount when I start to enumerate it. As is often the case, quite a few of the uses are of the “glue” style: creating an easy bridge between two other pieces of software, one of which is often the operating system. As an example I years ago wrote a (tiny) piece of code to enumerate the installed printers and pipe them out to a file. Our in-house business app calls the Python and picks up the result to display to the user as a pick list. That’s just one example among many others, some of which are so small that I tend to forget that they exist until some bizarre corner case arises which means I have to revisit the code. They just work and go on working.

A by no means exhaustive list of Python Pieces off the top of my head:

* That list of printers
* The startup wrapper for our main business app
* sql2xl — provider of data to the masses (and indirectly responsible for a world of Frankensheets, I’m afraid).
* Sales Boards - our Pygame-driven availability-visualisation app
* reports - a compact module combining simple dialogs and sql2xl
* screengrabber - capture parts of the screen to save to the database
* imageviewer - simple pygame-based image display
* convert images provided by our customers to thumbnails and place them on a replicating database for our handheld scanners
* convert a batch of Word docs to PDF & PCL
* simple manipulation of DXF maps to add our internal site ids
* absolutely loads of occasional AD / filesystem / WMI scripts for the sysadmins
* the internal contacts / portraits webpage
* web-based password reset for our HR system
* web front-end, mail ingest and alerting (a la Roundup, I admit) for our Helpdesk system

.. and a whole slew of other stuff which pretty much exists to demonstrate just how versatile Python is :)

2 Comments so far »

  1. Axel said,

    Wrote on March 7, 2010 @ 3:48 pm

    Hi, Tim!

    Do you mind sharing some ideas? I’m very interested in your list of things you use python for in business. In my environment, we have developed a generic reporting infrastructure to export any kind of sql query to Excel files (I guess, similar to your sql2xl?).

    What caught my eye is what you describe as “Sales Boards - our Pygame-driven availability-visualisation app”. Could you elaborate a little bit on this?
    The other thing is your reports — what kind of “simple dialogs” are you talking about?

    Thanx again for this list,
    Axel

  2. tim said,

    Wrote on March 8, 2010 @ 11:29 am

    @Axel: The Sales Boards are not that interesting, I’m afraid :). We sell advertising space, usually in large packages. The packages are booked up in two-week chunks but can be split (ie two customers can buy half a package each at the same time).

    To be able to see at a glance how much space we have and specifically who’s booked what, I put together a sort of scrolling whiteboard app to replace the real whiteboards which used to track this information. You can zoom down to about four weeks or out to the whole year and likewise down to about two parcels or out to the whole inventory.

    One screen shows all the parcels for one media format at a time and you can print the view you’re seeing on the screen. If you click-and-hold on any of the sold units you get a summary of what’s been sold, to whom and by whom.

    It’s a read-only view (for our sales reps, principally); there’s a less flexible but more functional view on our main business app which isn’t written in Python :(.

    A slightly different view is provided within the Sales Boards for packages which we sell dynamically: with the usual (static) selling, the parcels are mutually exclusive. When selling dynamically, they’re not, so we give a colour-coded indication of the probability of selling the parcel given everything we’ve got available at the moment — there are some quite complex rules to do with juxtaposition and spread which are too costly to calculate every time.

    The “simple dialogs” are simply these:

    http://timgolden.me.uk/python/winsys/dialogs.html#module-dialogs

    https://winsys.googlecode.com/svn/trunk/winsys/dialogs.py

    although I believe that the work Greg Ewing is doing:

    http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/

    is a more complete version of the same kind of thing…

Comment RSS · TrackBack URI

Leave a Comment

OpenID

Sign in with your OpenID ?

Anonymous

Name: (Required)

E-mail: (Required)

Website:

Comment: