enmapboxapplications main.ui refers to none-exisiting ressources

Issue #130 closed
Benjamin Jakimow created an issue

main.ui referes to QGIS-master/images/images.qrc which is not available during runtime.

This errors occures in QDesingner as well and when loading the application from coreapps/enmapboxapplications

traceback:

No module named 'images'
Traceback:
  File "C:\Users\geo_beja\Repositories\QGIS_Plugins\enmap-box\enmapbox\gui\applications.py", line 278, in addApplicationFolder
    appModule = __import__(appPkgName)
  File "C:\Program Files\QGIS 3.0\apps\qgis\python\qgis\utils.py", line 665, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users\geo_beja\Repositories\QGIS_Plugins\enmap-box\enmapbox\coreapps\enmapboxapplications\__init__.py", line 4, in <module>
    from enmapboxapplications.imagemathapp.core import ImageMathApp
  File "C:\Program Files\QGIS 3.0\apps\qgis\python\qgis\utils.py", line 665, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users\geo_beja\Repositories\QGIS_Plugins\enmap-box\enmapbox\coreapps\enmapboxapplications\imagemathapp\core.py", line 731, in <module>
    class ImageMathApp(QMainWindow, loadUIFormClass(pathUi=join(pathUi, 'main.ui'))):
  File "C:\Users\geo_beja\Repositories\QGIS_Plugins\enmap-box\enmapbox\coreapps\enmapboxapplications\utils.py", line 71, in loadUIFormClass
    FORM_CLASS, _ = uic.loadUiType(buffer, resource_suffix=RC_SUFFIX)
  File "C:\PROGRA~1\QGIS3~1.0\apps\Python36\lib\site-packages\PyQt5\uic\__init__.py", line 201, in loadUiType
    exec(code_string.getvalue(), ui_globals)
  File "<string>", line 166, in <module>
  File "C:\Program Files\QGIS 3.0\apps\qgis\python\qgis\utils.py", line 665, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)


Failure
Traceback (most recent call last):
  File "C:\PROGRA~1\QGIS3~1.0\apps\Python36\lib\unittest\case.py", line 59, in testPartExecutor
    yield
  File "C:\PROGRA~1\QGIS3~1.0\apps\Python36\lib\unittest\case.py", line 601, in run
    testMethod()
  File "C:\Users\geo_beja\Repositories\QGIS_Plugins\enmap-box\enmapbox\tests\test_applications.py", line 224, in test_apps
    self.assertTrue(n2 > n1,  msg='Unable to add APP(s) "{}" from {}'.format(d, p))
  File "C:\PROGRA~1\QGIS3~1.0\apps\Python36\lib\unittest\case.py", line 678, in assertTrue
    raise self.failureException(msg)
AssertionError: False is not true : Unable to add APP(s) "enmapboxapplications" from C:\Users\geo_beja\Repositories\QGIS_Plugins\enmap-box\enmapbox\coreapps\enmapboxapplications

Comments (3)

  1. Benjamin Jakimow reporter

    The error is caused by a none existing resource reference. check the latest loadUIFormClass from enmapbox/gui/utils.py which removes missing resource locations and throws a warning

    Load EnMAPBoxApplication(s) from "enmapboxapplications"
    None-existing resource file(s) in: C:\Users\geo_beja\Repositories\QGIS_Plugins\enmap-box\enmapbox\coreapps\enmapboxapplications\imagemathapp\ui\main.ui
        <include location="../../../../../QGIS-master/images/images.qrc"/>
    None-existing resource file(s) in: C:\Users\geo_beja\Repositories\QGIS_Plugins\enmap-box\enmapbox\coreapps\enmapboxapplications\imagestatistics\ui\main.ui
        <include location="../../../../../QGIS-master/images/images.qrc"/>
    Load EnMAPBoxApplication(s) from "hubtimeseriesviewerapp"
    Load EnMAPBoxApplication(s) from "metadataeditorapp"
    
  2. Benjamin Jakimow reporter

    I added a dummy enmapbox/images.py which is used in enmapbox/init.py by calling:

    if not 'images' in list(sys.modules.keys()):
        import enmapbox.images
        sys.modules['images'] = enmapbox.images
    

    This should prevent the UI loading from complaining about not finding a images module.

  3. Log in to comment