diff --git a/src/unasync/__init__.py b/src/unasync/__init__.py index 80845ff..92be78d 100644 --- a/src/unasync/__init__.py +++ b/src/unasync/__init__.py @@ -78,7 +78,9 @@ def _unasync_file(self, filepath): tokens = _tokenize(f) tokens = self._unasync_tokens(tokens) result = _untokenize(tokens) - result = self._unasync_remove(contents=result, filename=filepath) + # Limit to Python3.8+ until we know how to support older versions + if (sys.version_info[0] == 3 and sys.version_info[1] >= 8) or sys.version_info[0] > 3: + result = self._unasync_remove(contents=result, filename=filepath) outfilepath = filepath.replace(self.fromdir, self.todir) _makedirs_existok(os.path.dirname(outfilepath)) with open(outfilepath, "w", **write_kwargs) as f: