#!/usr/bin/env python import parted import parted.device import parted.disk import sys try: device = parted.device.Device(sys.argv[1]) disk = parted.Disk(device) print disk.partitions[0].path except: pass