Hacky fix for inconsistently named camera.
[python_utils.git] / misc_utils.py
index a73728a28031d48703187ff3a86274ec05ab2950..669b3ef98a20d2b4144da67299c463f73ee46851 100644 (file)
@@ -1,8 +1,11 @@
 #!/usr/bin/env python3
 
+# © Copyright 2021-2022, Scott Gasch
+
 """Miscellaneous utilities."""
 
 import os
+import sys
 
 
 def is_running_as_root() -> bool:
@@ -14,6 +17,13 @@ def is_running_as_root() -> bool:
     return os.geteuid() == 0
 
 
+def debugger_is_attached() -> bool:
+    """Return if the debugger is attached"""
+
+    gettrace = getattr(sys, 'gettrace', lambda: None)
+    return gettrace() is not None
+
+
 if __name__ == '__main__':
     import doctest