From b7e4ede1e488e652c1695e8016fa67ee1ab13d07 Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Mon, 2 Nov 2020 13:53:54 +0100 Subject: [PATCH] Make pywin32 optional --- picard/util/filenaming.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/picard/util/filenaming.py b/picard/util/filenaming.py index 1e6cf46b8..637e05ee0 100644 --- a/picard/util/filenaming.py +++ b/picard/util/filenaming.py @@ -35,6 +35,7 @@ import unicodedata from PyQt5.QtCore import QStandardPaths +from picard import log from picard.const.sys import ( IS_LINUX, IS_MACOS, @@ -48,9 +49,13 @@ from picard.util import ( ) +win32api = None if IS_WIN: - import pywintypes - import win32api + try: + import pywintypes + import win32api + except ImportError: + log.warning('pywin32 not available') def _get_utf16_length(text): @@ -441,7 +446,7 @@ def move_ensure_casing(source_path, target_path): # On Linux always force a double move _move_force_rename(source_path, target_path) return - elif IS_WIN: + elif IS_WIN and win32api: # Windows supports case renaming for NTFS and SMB shares, but not # on FAT32 or exFAT file systems. Perform a normal move first, # then check the result.