Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More friendly messages when imports fail on app load #173

Open
CRImier opened this issue May 9, 2019 · 0 comments
Open

More friendly messages when imports fail on app load #173

CRImier opened this issue May 9, 2019 · 0 comments
Labels
cleanup developer-friendliness Anything that helps people working on apps good first issue New contributors should be able to tackle this help wanted input needed Implementation needs to be discussed

Comments

@CRImier
Copy link
Member

CRImier commented May 9, 2019

Some imports in certain ZPUI apps are not in the emulator requirements (tricky to install, or not that necessary for core functionality). To be exact:

Traceback (most recent call last):
File "/home/pi/ZPUI/libs/matrix_client/matrix_client/client.py", line 21, in <module>
from .crypto.olm_device import OlmDevice
File "/home/pi/ZPUI/libs/matrix_client/matrix_client/crypto/olm_device.py", line 5, in <module>
import olm
ImportError: No module named olm

(this one is non-critical, it only prevents encryption from working in Matrix)

2. File "/home/pi/ZPUI/apps/app_manager.py", line 152, in load_all_apps
    app = self.load_app(module_path)
  File "/home/pi/ZPUI/apps/app_manager.py", line 204, in load_app
    app = importlib.import_module(app_path + '.main', package='apps')
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/pi/ZPUI/apps/network_apps/ssh/main.py", line 10, in <module>
    from libs import systemctl
  File "/home/pi/ZPUI/libs/systemctl.py", line 2, in <module>
    from pydbus import SystemBus
  File "/home/pi/venv/local/lib/python2.7/site-packages/pydbus/__init__.py", line 1, in <module>
    from .bus import SystemBus, SessionBus, connect
  File "/home/pi/venv/local/lib/python2.7/site-packages/pydbus/bus.py", line 1, in <module>
    from gi.repository import Gio
ImportError: No module named gi.repository

(this one is critical as it prevents the systemctl app from working)

We need to silence those messages so that the logs are more readable when launching the emulator. Also, feel free to silence any additional ones. You can probably use the same technique that the nmap app does, printing a warning in logs and then showing a warning to the user when they try to enter the app

Thoughts:

  • Might also hide the apps from the main menu/submenus if the thing lacking is critical
    • But then, the user won't know about these apps' existence until they look into the logs?
    • We don't really have a good mechanism for "if this condition is true, do not show the app in the UI", the app won't show up if it doesn't have callback()/.on_start(), but something like conditional del will likely be an unwelcome hack. Something like "different return value for init_app to show the app is deactivated" could be a better idea, but then, restarting ZPUI to make an app work is something that is best avoided.
@CRImier CRImier added help wanted developer-friendliness Anything that helps people working on apps cleanup good first issue New contributors should be able to tackle this input needed Implementation needs to be discussed labels May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup developer-friendliness Anything that helps people working on apps good first issue New contributors should be able to tackle this help wanted input needed Implementation needs to be discussed
Projects
None yet
Development

No branches or pull requests

1 participant