finally found the os.path.realpath function that I had overlooked. Removed joinPath accordingly and replaced its use in other function with realpath.