I'm new to Lantz but I found its features to match the requirements of an experiment I'm currently working on. I'm basing most of my development on the tutorial. I've already written the drivers for my device and wanted to start building a GUI. For that, I started the rich-app tutorial. However, I immediately ran into an error after running the first piece of code:
# Weimportahelperfunctiontostarttheappfromlantz.ui.appimportstart_gui_app
# Theblockconsistsoftwopartsthebackendandthefrontendfromlantz.ui.blocksimportFeatScan,FeatScanUi
# Anthisyouknowalreadyfromlantz.drivers.examplesimportLantzSignalGeneratorwithLantzSignalGenerator('TCPIP::localhost::5678::SOCKET')as fungen:
# Hereweinstantiatethebackendsetting'frequency'astheFeattoscan
# andspecifyinginwhichinstrumentapp=FeatScan('frequency',instrument=fungen)
# Nowweusethehelpertostarttheapp.
# IttakesaBackendinstanceandaFrontEndclassstart_gui_app(app,FeatScanUi)Traceback(mostrecentcalllast):
File"<ipython-input-14-d6e2c2282680>",line1,in<module>runfile('C:/[...]/test.py',wdir='C:/[...]')File"C:\[...]\Anaconda\envs\py34\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",line601,inrunfileexecfile(filename,namespace)File"C:\[...]\Anaconda\envs\py34\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",line80,inexecfileexec(compile(open(filename,'rb').read(),filename,'exec'),namespace)File"C:/[...]/Documents/JM/Santec TSL-510/PyControl/test.py",line20,in<module>start_gui_app(app,FeatScanUi)File"C:\[...]\Anaconda\envs\py34\lib\site-packages\lantz\ui\app.py",line242,instart_gui_appfrontend=frontend_class(backend=backend)File"C:\[...]\Anaconda\envs\py34\lib\site-packages\lantz\ui\app.py",line131,in__init__filename=os.path.dirname(inspect.getfile(cls))File"C:\[...]\Anaconda\envs\py34\lib\inspect.py",line524,ingetfileraiseTypeError('{!r} is a built-in class'.format(object))TypeError: <module'builtins'(built-in)>isabuilt-inclassIt seems the problem resides on a section of lantz.ui.app.Frontend:
classFrontend(QtGui.QMainWindow,metaclass=_FrontendType):
frontends={}
# adeclarativewaytoindicatetheuserinterfacefiletouse.gui=None
# connectwidgetstoinstrumentsusingconnect_setupauto_connect=Truedef__init__(self,parent=None,backend=None):
super().__init__(parent)self._backend=Noneifself.gui:
forclsinself.__class__.__mro__:
filename=os.path.dirname(inspect.getfile(cls)) # <<<<<<Thisline!filename=os.path.join(filename,self.gui)ifos.path.exists(filename):
logger.debug('{}: loading gui file {}'.format(self,filename))self.widget=QtGui.loadUi(filename)self.setCentralWidget(self.widget)break
else:
raiseValueError('{}: loading gui file {}'.format(self,self.gui))
# ...The elements inside Frontend.__class__.__mro__ are:
(lantz.ui.app._FrontendType,PyQt4.QtCore.pyqtWrapperType,sip.wrappertype,type,object)
From this it seems the problem is when for cls in self.__class__.__mro__ goes through type and object. I think that since these two classes are built-ins, inspect.getfile(cls) raises the TypeError exception.
I'm not certain if this problem is specific to my system or if it is a general issue. Could it be an incompatibility between lantz and my current libraries? I'm using Python 3.4 and I think that I have every library up-to-date.
I'm new to Lantz but I found its features to match the requirements of an experiment I'm currently working on. I'm basing most of my development on the tutorial. I've already written the drivers for my device and wanted to start building a GUI. For that, I started the rich-app tutorial. However, I immediately ran into an error after running the first piece of code:
It seems the problem resides on a section of
lantz.ui.app.Frontend:The elements inside
Frontend.__class__.__mro__are:From this it seems the problem is when
for cls in self.__class__.__mro__goes throughtypeandobject. I think that since these two classes are built-ins,inspect.getfile(cls)raises theTypeErrorexception.I'm not certain if this problem is specific to my system or if it is a general issue. Could it be an incompatibility between lantz and my current libraries? I'm using Python 3.4 and I think that I have every library up-to-date.