Open operte opened 9 years ago
My naive approach was to simply remove the last two elements of Frontend.__class__.__mro__
, hoping to avoid inspect.getfile(cls)
to operate on type
and object
. I thought about doing it like this:
class Frontend(QtGui.QMainWindow, metaclass=_FrontendType):
# ...
def __init__(self, parent=None, backend=None):
# ...
if self.gui:
for cls in self.__class__.__mro__[0:-2]: # <<< Change here.
# ...
This (certainly) naive modification eliminates the previous error message. However it does raise a new problem:
Traceback (most recent call last):
File "<ipython-input-1-d6e2c2282680>", line 1, in <module>
runfile('C:/[...]/test.py', wdir='C:/[...]')
File "C:\[...]\Anaconda\envs\py34\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 601, in runfile
execfile(filename, namespace)
File "C:\[...]\Anaconda\envs\py34\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 80, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "C:/[...]/test.py", line 20, in <module>
start_gui_app(app, FeatScanUi)
File "C:\[...]\Anaconda\envs\py34\lib\site-packages\lantz\ui\app.py", line 242, in start_gui_app
frontend = frontend_class(backend=backend)
File "C:\[...]\Anaconda\envs\py34\lib\site-packages\lantz\ui\app.py", line 139, in __init__
raise ValueError('{}: loading gui file {}'.format(self, self.gui))
ValueError: FeatScanUi: loading gui file scan.ui
It seems to me that now, the condition if os.path.exists(filename)
in Frontend.__init__
is never true
for the elements in self.__class__.__mro__[0:-2]
. However, I have manually tested every element in Frontend.__class__.__mro__[0:-2]
, namely (lantz.ui.app._FrontendType, PyQt4.QtCore.pyqtWrapperType, sip.wrappertype)
and the output of applying os.path.exists(filename)
on each one is True
. That said, I think that either my naive approach didn't work or I have reached yet another issue. Any tips to solving this are very much welcome!
@operte Thanks for the bug report. I have not seen this problem before. Can you tell me which Python version and PyQt version are you using?
@hgrecco I am using Python 3.4.2, PyQt4 4.10.4 and Qt 4.8.6. I don't have PySide installed so I'm not certain that the issue you referenced is connected to this problem.
I have roughly the same setup. and it works for me. I will try to mimick your installation, try it and let you know.
@hgrecco Also I am running on Windows. Could it be related?
I do not use Windows but I have tried it on windows. I am wondering if this is because you are running within IPython. Can you try it outside?
Running this on a Python shell results in the same error message. I am going to try to install a new conda environment with the minimum amount of libraries necessary to check if my problem persists.
I have access to a Windows computer tomorrow. I will try and let you know.
Hi! I found the same problem that @operte. I'm using python 3.4.3 on windows. Any tips about how to solve that?
@operte and @jflima11br are you both usiing PyQt or PySIDE?
I'm using PyQt.
I am not sure if you are still looking for an answer but I had a similar issue than the ones reported by @operte and @jflima11br. My problem was the missing ui files for the different blocks (scan.ui, loop.ui...). I just added the files taken from lantz_qt/ui/blocks in the lantz/ui/blocks folder and now everything is working. Hope it helps.
Hi @bizarri! Same problem here... everything is working. Thank you!
Thanks @bizarri ! Solved it for me
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 throughtype
andobject
. I think that since these two classes are built-ins,inspect.getfile(cls)
raises theTypeError
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.