Pyzotero: a Python client for the Zotero API pyzotero.readthedocs.io
zotero

More pathlib fixes

+4 -4
+4 -4
src/pyzotero/zotero.py
··· 800 800 if self.snapshot: 801 801 self.snapshot = False 802 802 pth += ".zip" 803 - with Path.open(pth, "wb") as f: 803 + with Path(pth).open("wb") as f: 804 804 f.write(file) 805 805 806 806 @retrieve ··· 1854 1854 if Path(str(self.basedir.joinpath(templt["filename"]))).is_file(): 1855 1855 try: 1856 1856 # if it is a file, try to open it, and catch the error 1857 - with Path.open(str(self.basedir.joinpath(templt["filename"]))): 1857 + with Path(str(self.basedir.joinpath(templt["filename"]))).open(): 1858 1858 pass 1859 1859 except OSError: 1860 1860 msg = f"The file at {self.basedir.joinpath(templt['filename'])!s} couldn't be opened or found." ··· 1914 1914 """Step 1: get upload authorisation for a file""" 1915 1915 mtypes = mimetypes.guess_type(attachment) 1916 1916 digest = hashlib.md5() # noqa: S324 1917 - with Path.open(attachment, "rb") as att: 1917 + with Path(attachment).open("rb") as att: 1918 1918 for chunk in iter(lambda: att.read(8192), b""): 1919 1919 digest.update(chunk) 1920 1920 auth_headers = {"Content-Type": "application/x-www-form-urlencoded"} ··· 1961 1961 upload_list = [("key", upload_dict.pop("key"))] 1962 1962 for key, value in upload_dict.items(): 1963 1963 upload_list.append((key, value)) 1964 - upload_list.append(("file", Path.open(attachment, "rb").read())) 1964 + upload_list.append(("file", Path(attachment).open("rb").read())) 1965 1965 upload_pairs = tuple(upload_list) 1966 1966 try: 1967 1967 self.zinstance._check_backoff()