Changing os.system calls to using specific Python libraries