insanum / sncli

Simplenote CLI
MIT License
397 stars 35 forks source link

`distutils` is removed in Python 3.12 #137

Open clauseggers opened 11 months ago

clauseggers commented 11 months ago

As per https://docs.python.org/3.12/whatsnew/3.12.html distutils is removed from Python 3.12 Of note, the distutils package has been removed from the standard library.

Executing sncli now throws ModuleNotFoundError: No module named 'distutils'

N0ury commented 7 months ago

Hi,

Here's how I've solved this issue in simplenote_cli/clipboard.py

@@ -1,5 +1,5 @@
 import os
-from distutils import spawn
+from shutil import which
 from subprocess import Popen, PIPE

@@ -8,9 +8,9 @@
         self.copy_command = self.get_copy_command()

     def get_copy_command(self):
-        if (spawn.find_executable('xsel')):
+        if (which('xsel')):
             return ['xsel', '-ib']
-        if (spawn.find_executable('pbcopy')):
+        if (which('pbcopy')):
             return ['pbcopy']
         return None
N0ury commented 3 months ago

Closed with this commit

@clauseggers please close the issue