Tag Archives: scripting

Running MySQL queries in Python

Being able to access MySQL databases in Python opens up quite a wide range of possibilities. It’s essential for a number of tasks such as connecting disparate datasources, performing maintenance, running regular updates, and more. While there are a number … Continue reading

Posted in MySQL, Programming | Tagged , , , , | 5 Comments

Simple and effective Python logging

I have been using the quite capable logging module for all of my logging in Python programs for some time. After trying a number of different options and formats, I have stabilized my setup into what I will describe below. … Continue reading

Posted in Programming | Tagged , , , | 4 Comments

Elegant option checking with optparse

A fair amount of the Python code that I write is in the form of scripts designed for command line use. In support of sysadmin activities, data massaging, or other tasks, they often call for options to be passed and … Continue reading

Posted in CLI, Programming | Tagged , , , , , | Leave a comment

Run vim without being there…

Say you have a text file. You need to alter it in some regular way before sending it on somewhere else. Instead of editing by hand, there is a neat option you can use to edit the file with familiar … Continue reading

Posted in CLI | Tagged , | 2 Comments

All your base…

Master Ian (whom I would link to, if his blog were not continually DOWN), showed me a very simple yet useful command: 1basename . You give it the path to a file, it gives you the filename and extension. If … Continue reading

Posted in CLI | Tagged , | Leave a comment