I ran a python program on Windows 10 which generated a .p file with pickle to save the data structure. When I tried to open this file on a Linux machine I got this issue:
25 """
26 if os.path.isfile(filename):
---> 27 list_to_open = pickle.load(open(filename, 'rb'))
28 return list_to_open
29 return None
~/Applications/miniconda3/envs/test/lib/python3.7/pathlib.py in __new__(cls, *args, **kwargs)
1023 if not self._flavour.is_supported:
1024 raise NotImplementedError("cannot instantiate %r on your system"
-> 1025 % (cls.__name__,))
1026 self._init()
1027 return self
NotImplementedError: cannot instantiate 'WindowsPath' on your system
Path has been used in the script, so the separator might be compatible to any OS ('/', '\', etc.). Is there another way to load this pickle file on Linux? Or is it possible to change all paths from WindowsPath to PosixPath inside the .p file?