do not fail if user does not have pywin32
This commit is contained in:
parent
3d5c3e59a1
commit
5e6766a3a4
|
@ -25,10 +25,15 @@ import pango
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
HAS_PYWIN32 = True
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
import win32file
|
try:
|
||||||
import win32con
|
import win32file
|
||||||
import pywintypes
|
import win32con
|
||||||
|
import pywintypes
|
||||||
|
except ImportError:
|
||||||
|
HAS_PYWIN32 = False
|
||||||
|
|
||||||
from common import i18n
|
from common import i18n
|
||||||
i18n.init()
|
i18n.init()
|
||||||
|
@ -356,6 +361,9 @@ def file_is_locked(path_to_file):
|
||||||
if os.name != 'nt': # just in case
|
if os.name != 'nt': # just in case
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not HAS_PYWIN32:
|
||||||
|
return
|
||||||
|
|
||||||
secur_att = pywintypes.SECURITY_ATTRIBUTES()
|
secur_att = pywintypes.SECURITY_ATTRIBUTES()
|
||||||
secur_att.Initialize()
|
secur_att.Initialize()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue