Can't display charts if report.htm is in a subfolder

Bug #1005615 reported by UniMedNet on 2012-05-28
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SOFA Statistics
Medium
Grant Paton-Simpson

Bug Description

I use SOFA Statistics 1.1.5

If I choose a subfolder as report path, sofastats displays a blank icon instead of charts when I make a statistic such as ANOVA or Chi-squared.

I have already copied sofastats_report_extras folder in the subfolder where report.htm is.

But if I view that htm in the browser it displays all charts correctly.

Thank you

Giuseppe Russo

Hi,

I just ran a test using a much older version 1.1.0 and it had the same problem so the bug has probably been there all along. Thanks for letting me know. The bug affects any images generated by matplotlib as part of output reports and can probably be corrected by looking at a specific function which does a search and replace on an html text file so that it links correctly to local images. I should have this fixed soon but the fix won't show up in a new version for a matter of months probably. But it might be a pretty simple, self-contained manual patch.

All the best, Grant

Changed in sofastatistics:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Grant Paton-Simpson (launchpad-p-s)

Hi,

Found the bug and have fixed it as per the following:

In output.py, line 504, is the rel2abs_rpt_img_links function. It does a search and replace on some html text. E.g. to turn my_report_name/001.png to /home/username/sofastats/reports/my_report_name/001.png. The problem was the report_path it was inserting into the link. If you were using the default report path to output to, it would work fine because report_path was os.path.join(mg.REPORTS_PATH, u""). But not if it were somewhere else. The following line:

    report_path = os.path.join(mg.REPORTS_PATH, u"")

should be replaced with these 3 lines:

    cc = config_output.get_cc()
    report_path = os.path.split(cc[mg.CURRENT_REPORT_PATH])[0]
    report_path = os.path.join(report_path, u"")

Note: Python requires you to get the indentation correct

All the best, Grant

Changed in sofastatistics:
status: Confirmed → Fix Committed
UniMedNet (unimednet) wrote :

Hi Grant,

I have just patched that file and now it runs perfectly!

Thank you very much for having fixed this bug soon.

Now, SofaStats is perfect!

Best regards, Giuseppe

Changed in sofastatistics:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers