This Code works just fine on Ubuntu and MacOs but gives me headaches on windows.
manifest_zip_path = Path(zip_path).name / Path("manifest")
tar = tarfile.open(zip_path, "r:gz")
f = tar.extractfile(str(manifest_zip_path))
There is a Path object which I convert to a string. In Debugger the string is shown as "abcde.tar.gz\manifest". When I pass it to the extractfile function I get:
KeyError: filename 'abcde.tar.gz\\\\manifest' not found
Where do these 4 backslashes come from? The conversion has to happen inside the tarfile method? Is this an Error from them and if not how can I resolve it?
Resolved the issue by doing this
f = tar.extractfile(str(manifest_zip_path).replace("\\", "/"))
tarfile library doesn't like backslashes apparently.