Browse Source

python3.5: fix "TypeError: rename: illegal type for dst parameter"

https://github.com/fphammerle/ical2vdir/pull/10/checks?check_run_id=783380308#step:8:99
Fabian Peter Hammerle 3 years ago
parent
commit
df09d54b69
2 changed files with 5 additions and 3 deletions
  1. 3 2
      CHANGELOG.md
  2. 2 1
      ical2vdir/__init__.py

+ 3 - 2
CHANGELOG.md

@@ -6,8 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased]
 ### Fixed
-- tests: fixed `TypeError` when converting to `pathlib.Path` on python3.5
-  by replacing `tmpdir` fixture with `temp_path`
+- python3.5:
+  - `TypeError` in `_write_event` when renaming temporary file
+  - tests: `TypeError` when converting to `pathlib.Path`
 
 ## [0.1.1] - 2020-02-06
 ### Fixed

+ 2 - 1
ical2vdir/__init__.py

@@ -98,7 +98,8 @@ def _write_event(event: icalendar.cal.Event, path: pathlib.Path):
         # https://tools.ietf.org/html/rfc5545#section-3.1
         os.write(temp_fd, event.to_ical())
         os.close(temp_fd)
-        os.rename(temp_path, path)
+        # python3.5 expects Union[bytes, str]
+        os.rename(temp_path, str(path))
     finally:
         if os.path.exists(temp_path):
             os.unlink(temp_path)