replaced debug print statements with logging.debug

This commit is contained in:
Rhet Turnbull
2019-11-17 16:46:34 -08:00
parent e0b1113870
commit 17bc04a24a

View File

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