From 20906c2d25175e32bf0ce7edbd3f008c488b854e Mon Sep 17 00:00:00 2001 From: Teun Date: Wed, 5 Dec 2018 10:42:01 +0100 Subject: [PATCH] Moved RuntimeError from initialisation of Dummy ctype to where the variable is written. Reading is allowed for easier debugging. --- ads/adssymbols.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ads/adssymbols.py b/ads/adssymbols.py index 4907eaa..1c95008 100644 --- a/ads/adssymbols.py +++ b/ads/adssymbols.py @@ -56,7 +56,8 @@ class Dummy(Array): _length_ = 1 _type_ = c_ubyte def __init__(self, *args): - raise RuntimeError('Dummy ctypes object cannot be created or written') + pass # moved RuntimeError to where the variable is written + # raise RuntimeError('Dummy ctypes object cannot be created or written') class Entry: """ @@ -517,6 +518,8 @@ class constructor. else: # Write assert self.__ctype is not None + if isinstance( self.__cype, Dummy ): + raise RuntimeError('Dummy ctypes object cannot be created or written') if len(args) == 1 and len(kwargs)==0 and isinstance(args[0], self.__ctype): # We have exactly one argument, which is of the correct type data = args[0] @@ -669,7 +672,9 @@ def getCtype(self, dtypename, size = None): self.ctypes[dtypename] = ctype return ctype - + + + def getVariables(netId = None, port = 851): cpyads.adsPortOpen()