def restorePathClassesAfterUnpickling(): ''' After unpickling, leave pathlib alone. ''' from music21.common.misc import getPlatform platform = getPlatform() if platform == 'win': pathlib.PosixPath = _storedPathlibClasses['posixPath'] else: pathlib.WindowsPath = _storedPathlibClasses['windowsPath']
def preparePathClassesForUnpickling(): ''' When we need to unpickle a function that might have relative paths (like some music21 stream options), Windows chokes if the PosixPath is not defined, but usually can still unpickle easily. ''' from music21.common.misc import getPlatform platform = getPlatform() if platform == 'win': pathlib.PosixPath = pathlib.WindowsPath else: pathlib.WindowsPath = pathlib.PosixPath