From 5f9e1ddc7d9c7a72cd309af886f4721452e7c488 Mon Sep 17 00:00:00 2001 From: spielman Date: Fri, 9 Feb 2024 12:16:15 -0500 Subject: [PATCH 1/2] Fixed. --- labscript_utils/device_registry/_device_registry.py | 7 ++++++- labscript_utils/modulewatcher.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/labscript_utils/device_registry/_device_registry.py b/labscript_utils/device_registry/_device_registry.py index 256d76d..00cb0cc 100644 --- a/labscript_utils/device_registry/_device_registry.py +++ b/labscript_utils/device_registry/_device_registry.py @@ -1,12 +1,17 @@ import os import importlib -import imp import warnings import traceback import inspect from labscript_utils import dedent from labscript_utils.labconfig import LabConfig +# deal with removal of _imp from new python +try: + import _imp as imp +except ImportError: + import imp + """This file contains the machinery for registering and looking up what BLACS tab and runviewer parser classes belong to a particular labscript device. "labscript device" here means a device that BLACS needs to communicate with. These devices have diff --git a/labscript_utils/modulewatcher.py b/labscript_utils/modulewatcher.py index 25df904..6533d75 100644 --- a/labscript_utils/modulewatcher.py +++ b/labscript_utils/modulewatcher.py @@ -14,10 +14,15 @@ import threading import time import os -import imp import site import sysconfig +# deal with removal of _imp from new python +try: + import _imp as imp +except ImportError: + import imp + # Directories in which the standard library and installed packages may be located. # Modules in these locations will be whitelisted: From da5a2c457f0f3b44b363e320d4ce53ceadc5adcd Mon Sep 17 00:00:00 2001 From: spielman Date: Fri, 9 Feb 2024 12:22:20 -0500 Subject: [PATCH 2/2] Comment fix. --- labscript_utils/device_registry/_device_registry.py | 2 +- labscript_utils/modulewatcher.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/labscript_utils/device_registry/_device_registry.py b/labscript_utils/device_registry/_device_registry.py index 00cb0cc..0c64cb2 100644 --- a/labscript_utils/device_registry/_device_registry.py +++ b/labscript_utils/device_registry/_device_registry.py @@ -6,7 +6,7 @@ from labscript_utils import dedent from labscript_utils.labconfig import LabConfig -# deal with removal of _imp from new python +# deal with removal of imp from python 3.12 try: import _imp as imp except ImportError: diff --git a/labscript_utils/modulewatcher.py b/labscript_utils/modulewatcher.py index 6533d75..d9029dd 100644 --- a/labscript_utils/modulewatcher.py +++ b/labscript_utils/modulewatcher.py @@ -17,7 +17,7 @@ import site import sysconfig -# deal with removal of _imp from new python +# deal with removal of imp from python 3.12 try: import _imp as imp except ImportError: