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

Pandoc error generating final stage of interview (document assembly) #23

Closed
nroach opened this issue May 4, 2017 · 7 comments
Closed

Comments

@nroach
Copy link

nroach commented May 4, 2017

I'm not sure what's causing this beyond the subject line. The logs don't seem real informative as to what's going on and which things are trying to be concatenated into what. I'm on a docker image current as of 4/28/17. Here's the log:

Error
TypeError: cannot concatenate 'str' and 'NoneType' objects
Log
Traceback (most recent call last):
  File "/usr/share/docassemble/local/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/share/docassemble/local/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/share/docassemble/local/local/lib/python2.7/site-packages/docassemble/webapp/server.py", line 3125, in index
    interview.assemble(user_dict, interview_status)
  File "/usr/share/docassemble/local/local/lib/python2.7/site-packages/docassemble/base/parse.py", line 2370, in assemble
    interview_status.populate(question.ask(user_dict, 'None', 'None'))
  File "/usr/share/docassemble/local/local/lib/python2.7/site-packages/docassemble/base/parse.py", line 1876, in ask
    attachment_text = self.processed_attachments(user_dict, the_x=the_x, the_i=the_i)
  File "/usr/share/docassemble/local/local/lib/python2.7/site-packages/docassemble/base/parse.py", line 1908, in processed_attachments
    result_list.append(self.finalize_attachment(item[0], item[1], user_dict))
  File "/usr/share/docassemble/local/local/lib/python2.7/site-packages/docassemble/base/parse.py", line 2025, in finalize_attachment
    result['content'][doc_format] = docassemble.base.filter.markdown_to_html(result['markdown'][doc_format], use_pandoc=True, question=self)
  File "/usr/share/docassemble/local/local/lib/python2.7/site-packages/docassemble/base/filter.py", line 946, in markdown_to_html
    a = html_filter(unicode(a), status=status, question=question, embedder=embedder)
  File "/usr/share/docassemble/local/local/lib/python2.7/site-packages/docassemble/base/filter.py", line 437, in html_filter
    text = re.sub(r'\[FILE ([^,\]]+)\]', lambda x: image_url_string(x, question=question), text)
  File "/usr/share/docassemble/local/lib/python2.7/re.py", line 155, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/usr/share/docassemble/local/local/lib/python2.7/site-packages/docassemble/base/filter.py", line 437, in <lambda>
    text = re.sub(r'\[FILE ([^,\]]+)\]', lambda x: image_url_string(x, question=question), text)
  File "/usr/share/docassemble/local/local/lib/python2.7/site-packages/docassemble/base/filter.py", line 767, in image_url_string
    return('<img class="daicon" style="' + width_string + '" src="' + server.url_finder(file_reference, question=question) + '"/>')
TypeError: cannot concatenate 'str' and 'NoneType' objects
@jhpyle
Copy link
Owner

jhpyle commented May 4, 2017

Yes, an error like that should be trapped better! It seems like you are making reference to a graphics file which exists but is not displayable for some reason. If it is a file in a package, it needs to be in the data/static folder in order to be displayable. Or is it a file uploaded by the user?

@nroach
Copy link
Author

nroach commented May 4, 2017 via email

@nroach
Copy link
Author

nroach commented May 4, 2017

Appearing in Preview
screenshot 2017-05-04 13 52 51

Shows as downloadable
screenshot 2017-05-04 13 53 31

Produces a zero-byte PDF or RTF file when downloaded
screenshot 2017-05-04 13 53 42

Errorlog:

pandoc: Error producing PDF
! Extra }, or forgotten \endgroup.
\endminipage ...pagefalse \color@endgroup \egroup 
                                                  \expandafter \@iiiparbox \...
l.338 \end{minipage}

@jhpyle
Copy link
Owner

jhpyle commented May 5, 2017

I think the image inclusion problem might be remedied by writing [FILE firmlogo.jpg], though what you did should have worked -- I will need to test that more thoroughly.

As for the Pandoc problem, I think that's caused by the inclusion of the address block within a Markdown table. Markdown tables are fragile. However, the [BEGIN_TWOCOL] ... [BREAK] ... [END_TWOCOL] construct documented here might be a good alternative.

@jhpyle
Copy link
Owner

jhpyle commented May 5, 2017

I believe the image inclusion problem may have been caused by the fact that your package name had hyphens in it. I think if you include hyphens in your package name, Python treats the hyphens as minus signs and tries to do subtraction. I tried taking out the hyphens from the package name and then the image references worked.

@jhpyle
Copy link
Owner

jhpyle commented May 5, 2017

Check out this example to see how the [BEGIN_TWOCOL] ... [BREAK] ... [END_TWOCOL] feature can be used and an address block can be incorporated.
I think the inclusion of the address block using the .address_block() method will require the latest version of the software (which is compiling now on Docker Hub) but even with the older version you should be able to construct the address block if you do it one line at a time.

@jhpyle
Copy link
Owner

jhpyle commented Aug 12, 2017

I believe this issue has been addressed, so I am closing it.

@jhpyle jhpyle closed this as completed Aug 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants