Narrated Web Site report error

Generated an error with the Narrated Web Site report using just the example.gramps files to the local documents folder. Including the following:

<module name="navwebpage Example">
  <option name="contactimg" value="O0009"/>
  <option name="contactnote" value="N0011"/>
  <option name="footernote" value="N0006"/>
  <option name="headernote" value="N0010"/>
  <option name="homeimg" value="O0010"/>
  <option name="homenote" value="N0007"/>
  <option name="introimg" value="O0011"/>
  <option name="intronote" value="N0005"/>
  <option name="pid" value="I0106"/>
4101140: ERROR: line 801: Failed to run report.
Traceback (most recent call last):
  File "/home/districtsupport/Documents/GitHub/Gramps/gramps/gui/plug/report/", line 760, in report
  File "/home/districtsupport/Documents/GitHub/Gramps/gramps/plugins/webreport/", line 560, in write_report["Media"].display_pages(the_lang, the_title)
  File "/home/districtsupport/Documents/GitHub/Gramps/gramps/plugins/webreport/", line 162, in display_pages
  File "/home/districtsupport/Documents/GitHub/Gramps/gramps/plugins/webreport/", line 481, in mediapage
    (width, height) = image_size(orig_image_path)
  File "/home/districtsupport/Documents/GitHub/Gramps/gramps/gen/utils/", line 197, in image_size
    img = magic.from_file(source)
AttributeError: module 'magic' has no attribute 'from_file'

It took me several tries, but I was able to get magic to install and run on the MINGw-W64 platform. It is not in the AIO, so our code ends up using a slower method useing GdkPixbuf on the AIO.

Make sure you have python-magic installed (version 0.4.27)
It also requires (but doesn’t seem to automatically install) the ‘file’ command which comes with the libmagic library. I installed version 5.39-2.

There appear to be a few other modules with the name magic out there, I suspect that your system has the wrong one installed.


Thanks for isolating that!

What kind of bug report should I file?

Is it an installer bug? It is probably not a pre-requisites, since this is a built-in report.

The python-magic package is currently listed as optional rather than required. You should be able to generate a narrative web report without it installed.

It generated the report but kicked up the error message.

A Warning would’ve been OK. But an Error indicates something that the user HAS to fix.

The python-imagesize package is probably a better choice than python-magic.

See PR #1597.

The try/except we have around the import only takes the except path for not being able to import, not for importing the wrong program. Which is why you are getting an error message, instead of using the slow method.