diff --git a/labscript_utils/excepthook/__init__.py b/labscript_utils/excepthook/__init__.py index 9ac5975d..c6551fc8 100644 --- a/labscript_utils/excepthook/__init__.py +++ b/labscript_utils/excepthook/__init__.py @@ -28,6 +28,7 @@ class l: logger = None child_processes = [] +_original_showwarning = warnings.showwarning def install_thread_excepthook(): @@ -83,12 +84,11 @@ def tkhandler(exceptclass, exception, exec_info, reraise=True): def logwarning(message, category, filename, lineno, file=None, line=None): logmessage = warnings.formatwarning(message, category, filename, lineno, line) l.logger.warn(logmessage) - warnings._showwarning(message, category, filename, lineno, file, line) + _original_showwarning(message, category, filename, lineno, file, line) def set_logger(logger): l.logger = logger - warnings._showwarning = warnings.showwarning warnings.showwarning = logwarning # Check for tkinter availability. Tkinter is frustratingly not available diff --git a/labscript_utils/ls_zprocess.py b/labscript_utils/ls_zprocess.py index 4d9e9575..6fd47459 100644 --- a/labscript_utils/ls_zprocess.py +++ b/labscript_utils/ls_zprocess.py @@ -106,8 +106,8 @@ def get_config(): config['allow_insecure'] = labconfig.getboolean('security', 'allow_insecure') except (labconfig.NoOptionError, labconfig.NoSectionError): config['allow_insecure'] = False - if config['shared_secret'] is None and not config['allow_insecure']: - raise ValueError(_ERR_NO_SHARED_SECRET.replace('/', os.sep)) + if config['shared_secret'] is None and not config['allow_insecure']: + raise ValueError(_ERR_NO_SHARED_SECRET.replace('/', os.sep)) try: config['logging_maxBytes'] = labconfig.getint('logging', 'maxBytes') except (labconfig.NoOptionError, labconfig.NoSectionError): @@ -257,7 +257,7 @@ def socket(self, socket_type, socket_class=None, **kwargs): # be a SecureSocket. If caller has explicitly requested a different socket type # (e.g since pyzmq 25, ThreadAuthenticator sets up an internal socket by calling # `Context.socket(..., socket_class=zmq.Socket)), then don't.` - if socket_class is None or issubclass(socket_class, SecureContext): + if socket_class is None or issubclass(socket_class, SecureSocket): config = get_config() kwargs['allow_insecure'] = config['allow_insecure'] return SecureContext.socket(self, socket_type=socket_type, **kwargs) diff --git a/labscript_utils/properties.py b/labscript_utils/properties.py index 092df528..5f8488ed 100644 --- a/labscript_utils/properties.py +++ b/labscript_utils/properties.py @@ -61,6 +61,10 @@ def _default(o): # Workaround for https://bugs.python.org/issue24313 if isinstance(o, np.integer): return int(o) + if isinstance(o, np.floating): + return float(o) + if isinstance(o, np.bool_): + return bool(o) raise TypeError diff --git a/labscript_utils/zlock.py b/labscript_utils/zlock.py index 5878997f..baac341b 100644 --- a/labscript_utils/zlock.py +++ b/labscript_utils/zlock.py @@ -40,7 +40,7 @@ def main(): '-m', 'zprocess.zlock', '--port', - config['zlock_port'], + str(config['zlock_port']), '-l', LOG_PATH, ]