Quantcast
Channel: Jaharmi’s Irreality - Python
Browsing all 15 articles
Browse latest View live

Comparison of sys.path on Python 2.3 and 2.5 framework builds

From Python 2.3.5, installed by default in Mac OS X Tiger: >>> import sys >>> print(sys.path) ['', '/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python23.zip',...

View Article



Using Python distutils.version to compare Mac OS X version numbers

After talking with Steve last Friday about how I really wanted a way to compare Mac OS X version numbers, I set off to find one myself. Determining if your script is running on an operating system...

View Article

A feeling of empowerment

I have to say that after my upgrade and implementation of Drupal 5.1, and my recent discoveries of the joys of system administration scripting with Python, I’m feeling hugely empowered. I have a lot of...

View Article

Hashing with splash in Python

Every time I do hashing in Python, I have to look it up. I forget how to do it. That’s probably a bad thing, at least compared to the shell. The shell way isn’t exactly simple, but I find it something I...

View Article

Determine if a string starts with one of a tuple of strings in Python

In Python, there is a built-in string method, “startswith,” that lets you determine whether a line starts with a character. I’ve used it before because I tend to want to use the features of the...

View Article


Get Python installation information from Distutils

The Distutils Python module includes functions to obtain information about the Python installation. This may be useful for system administrators, and it certainly caught my eye when I read about it....

View Article

Format numbers with the Python locale module

I’m constantly astounded by the breadth of features available in the Python Standard Library. Although the functions I find there are not always easy to grasp, it is almost always worth searching around...

View Article

Python to remove commands module and some Mac-specific modules

Drat! I’ve learned that the commands module for Python, which I use, is deprecated and removed in Python according to PEP 3108. That means I can no longer safely call commands.getstatusoutput()...

View Article


Conditionally import a Python module if it is available

I have been struggling with the issue of module availability in Python. While the “batteries included” nature of the standard library is great, there are occasionally times when I need to resort to a...

View Article


Get the number of pages for a PDF using the Quartz 2D Python bindings

A question came up on the AppleScript-Users mailing list and I wanted to make note if it, because I came up with a quick Python-based way to answer it. Here, I reiterate that answer on how to get the...

View Article

Get the display resolution on Mac OS X with PyObjC

I came across this hint about display properties on StackOverflow and thought it was worthwhile to write down for later. If you want to get the screen or Desktop resolution of a Mac via Python, you can...

View Article

Parse a vendor RSS feed to get the latest available product version

There may be times when you want to obtain the number of the latest available version — not just the latest installed version — of a software package through automated means. If the vendor or project...

View Article

Install Mercurial 1.9, Dulwich, and Hg-Git on Mac OS X Lion

Hg-Git is the Mercurial extension to use if you want to connect to local or remote Git repositories. I exclusively use Mercurial and Hg-Git for all of my Github transactions, so I can personally vouch...

View Article


Read preferences from a property list within a Mac OS X Python script

I had a need to read some settings from a Python script on Mac OS X recently. I wanted to be able to change selected parameters for the script — some of which could be site or implementation specific —...

View Article

Turn RSS feed items into Keynote slides with Python Appscript

I wanted to set up a kiosk system that displayed some static and some constantly-updated information. I already had a kiosk that used Apple Keynote in full-screen presentation mode to show a slideshow,...

View Article

Browsing all 15 articles
Browse latest View live




Latest Images