sncli icon indicating copy to clipboard operation
sncli copied to clipboard

`distutils` is removed in Python 3.12

Open clauseggers opened this issue 2 years ago • 2 comments

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'

clauseggers avatar Dec 13 '23 09:12 clauseggers

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 avatar Mar 30 '24 06:03 N0ury

Closed with this commit

@clauseggers please close the issue

N0ury avatar Aug 04 '24 06:08 N0ury