#!/usr/bin/python2 #common.py - a Bippy module - 6 April 2004 - 0.0.1 #an original script written by Bill Allen for Python 2+ #this script has no price, limitations, or warranty - use at your own risk """ This module has non-GUI functions and classes used by various scripts written by the author: SUBJECT: Python common functions ---------------- fixPath - normalize path name, optionally concatenate path & file names common classes -------------- history 0.0.1 - first version 6 April 2004 """ #--- setup --- import os #--- constants --- arrayTypeCode = { 'b':'signed 1-byte integer', 'B':'unsigned 1-byte integer', 'C':'1-byte character', 'd':'8-byte double-precision', 'f':'floating point 4 bytes', 'h':'signed 2-byte integer', 'H':'unsigned 2-byte integer', 'i':'signed 2-byte integer', 'I':'unsigned 2-byte integer', 'l':'signed 4-byte long integer', 'L':'unsigned 4-byte long integer'} #Python array types #Python 2.0 note: I & L are retrieved as signed 4-byte long integer #--- common functions --- def fixPath(pname,fname=''): if fname: pname = os.path.join(pname,fname) #get correct concatenation return os.path.abspath(pname) #make whole path be correct #--- common classes --- #--- testing --- if __name__ == '__main__': print """ This module (common.py) is not a standalone program. It is a module that contains functions and classes used by other scripts. """ ### end module ###