chaoss/grimoirelab-manuscripts

Error if no project name is specified

Closed this issue · 4 comments

When launching manuscripts with no project name (eg, no -n option), there is an error. For example:

$ manuscripts -d /tmp/report -u http://localhost:9200 --data-sources git
2018-03-14 09:31:11,530 Generating the report from 2015-01-01 00:00:00+00:00 to 2018-03-13 23:59:59.999999+00:00
2018-03-14 09:31:11,530 Generating the report data and figs from 2015-01-01 00:00:00+00:00 to 2018-03-13 23:59:59.999999+00:00
2018-03-14 09:31:11,530 Generating Overview
2018-03-14 09:31:11,889 Generating Communication Channels
2018-03-14 09:31:11,890 Generating Detailed Activity by Project
2018-03-14 09:31:11,890 Activity data for: general
2018-03-14 09:31:12,321 Community data for: general
2018-03-14 09:31:12,577 Process data for: general
2018-03-14 09:31:12,577 Data and figs done
2018-03-14 09:31:12,577 Generating PDF report
Traceback (most recent call last):
  File "/tmp/gl/bin/manuscripts", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/jgb/src/jgbarah-grimoire/grimoirelab-manuscripts/bin/manuscripts", line 133, in <module>
    report.create()
  File "./manuscripts/report.py", line 748, in create
    self.create_pdf()
  File "./manuscripts/report.py", line 673, in create_pdf
    project_replace = self.report_name.replace(' ', r'\ ')
AttributeError: 'NoneType' object has no attribute 'replace'

It would be much better if a default name is used, so that it doesn't fail if no -n argument is used. Given how the project name is now used in the report, I think a good default name would be "Unnamed". In the messages written by Manuscripts it should be obvious that the - n argument was not used, and that the default "Unnamed" project name was used because of that, and how to use -n to specify a name.

@jgbarah I would like to work on it.
Will open a PR soon.

Great! Please, go ahead.

If this issue still hasn't been fixed, I'd like to have a go at this issue

@varunotelli I am working on it, will be opening a PR soon.