replaced debug print statements with logging.debug
This commit is contained in:
@@ -43,7 +43,8 @@ _PHOTOS_5_VERSION = "6000"
|
|||||||
# which major version operating systems have been tested
|
# which major version operating systems have been tested
|
||||||
_TESTED_OS_VERSIONS = ["12", "13", "14"]
|
_TESTED_OS_VERSIONS = ["12", "13", "14"]
|
||||||
|
|
||||||
_debug = True
|
# set _debug = True to enable debug output
|
||||||
|
_debug = True
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.DEBUG,
|
level=logging.DEBUG,
|
||||||
format="%(asctime)s - %(levelname)s - %(filename)s - %(lineno)d - %(message)s",
|
format="%(asctime)s - %(levelname)s - %(filename)s - %(lineno)d - %(message)s",
|
||||||
@@ -52,6 +53,7 @@ logging.basicConfig(
|
|||||||
if not _debug:
|
if not _debug:
|
||||||
logging.disable()
|
logging.disable()
|
||||||
|
|
||||||
|
|
||||||
def _get_os_version():
|
def _get_os_version():
|
||||||
# returns tuple containing OS version
|
# returns tuple containing OS version
|
||||||
# e.g. 10.13.6 = (10, 13, 6)
|
# e.g. 10.13.6 = (10, 13, 6)
|
||||||
@@ -91,7 +93,7 @@ class PhotosDB:
|
|||||||
"WARNING: This module has only been tested with MacOS 10."
|
"WARNING: This module has only been tested with MacOS 10."
|
||||||
+ f"[{', '.join(_TESTED_OS_VERSIONS)}]: "
|
+ f"[{', '.join(_TESTED_OS_VERSIONS)}]: "
|
||||||
+ f"you have {system}, OS version: {major}",
|
+ f"you have {system}, OS version: {major}",
|
||||||
file=sys.stderr
|
file=sys.stderr,
|
||||||
)
|
)
|
||||||
|
|
||||||
# configure AppleScripts used to manipulate Photos
|
# configure AppleScripts used to manipulate Photos
|
||||||
@@ -312,7 +314,7 @@ class PhotosDB:
|
|||||||
else:
|
else:
|
||||||
print(
|
print(
|
||||||
"Could not extract photos URL String from IPXDefaultLibraryURLBookmark",
|
"Could not extract photos URL String from IPXDefaultLibraryURLBookmark",
|
||||||
file=sys.stderr
|
file=sys.stderr,
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -345,7 +347,7 @@ class PhotosDB:
|
|||||||
conn = sqlite3.connect(f"{fname}")
|
conn = sqlite3.connect(f"{fname}")
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
except sqlite3.Error as e:
|
except sqlite3.Error as e:
|
||||||
print(f"An error occurred: {e.args[0]} {fname}",file=sys.stderr)
|
print(f"An error occurred: {e.args[0]} {fname}", file=sys.stderr)
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
# logger.debug("SQLite database is open")
|
# logger.debug("SQLite database is open")
|
||||||
return (conn, c)
|
return (conn, c)
|
||||||
|
|||||||
Reference in New Issue
Block a user