protocollabs / dmpr-simulator

Dynamic Multipath Routing Protocol - Simulator
MIT License
1 stars 2 forks source link

Catched Import Errors #32

Open hgn opened 6 years ago

hgn commented 6 years ago

A new setup triggered an import error where the drawing/video generation failed.

Source was this:

  try:
       from dmprsim.simulator import draw
       from PIL import Image, ImageDraw, ImageFont, ImageFilter
  except ImportError:

The exception raised from from dmprsim.simulator import draw where the origin was a missing numpy installation. So this is somewhat shitty, first, the error was hidden because of it was not clear was module was missing. The second problem was that the video generation (make promovideo) did not raised any visiable error. The error message was printed in the beginning of the video generation. Two problems.

One suggestion: we should provide under utils a function where can can check if everything required is available.

def try_probe_cairo():
    import cairo

Implemented in utils.py. That can be used everywhere so that we can say, "no video generation not possible, no cairo installed".

reisub-de commented 6 years ago

Are you sure you installed all dependencies? We should not have to assume that the user has not installed the deps everytime we import something

hgn commented 6 years ago

Yes, now I installed all deps and it works like a charm. The problem was that It was not visible that I forgot to installed a dependency. No warning message really visible.

Some minutes ago I triggered a exception that video generation did not worked because ffmpeg was not installed. This was really fine because subprocess failed with ffmpeg not found. This is what the user expect if he type make promotion.

Another idea: let make the simulation depends on some modules, if not, exit and printout module foo not installed.

Why not in this way? This optional stuff is fine, but who cares if the user installs one or two addiitional packages via apt-get or pip?

reisub-de commented 6 years ago

That's what we made make check for, we could run the dep-check parts of that before every run