WordFileError unexpected '/'

Which tool versions are you using?

SDK: v14.0.0
Platform: v24.02.4
Python: v3.11
Isolation mode: venv

Current Behavior

I have developed an app where I perform a number of calculations.
the results are then rendered in a word template and downloaded as a report.
Upon performing an update to the app, the following message is returned when the download button is clicked:

2024-02-25 18:05:38.259 ERROR : Exception is raised
Traceback (most recent call last):
File “viktor_connector\connector.pyx”, line 296, in connector.Job.execute
File “viktor\core.pyx”, line 1918, in viktor.core._handle_job
File “viktor\core.pyx”, line 1864, in viktor.core._handle_job._handle_button
File “C:\Users.…app.py”, line 152, in download_word_file
word_file = self.generate_memo(params)
File “C:\Users…\app.py”, line 147, in generate_memo
word_file = render_word_file(template, components)
File “viktor\external\word.pyx”, line 183, in viktor.external.word.render_word_file
File “viktor\external\word.pyx”, line 221, in viktor.external.word._call_fill_word_file_addon
File “viktor\core.pyx”, line 1532, in viktor.core._post_on_addon_endpoint
viktor.errors.WordFileError: unexpected ‘/’

Expected Behavior

I would expect the .docx file to be downloaded. to be noted that I reverted to the main branch and uploaded it to the developer environment and the problem persists. The published app works fine though.

Hi Ahmed,

The first two questions that pop up with me are:

  1. Did you update any dependencies in the app you’ve got running in your development environment? (basically, what changes are there between the app version that’s throwing this error and the published one which, as you mention, doesn’t throw this error?)

  2. Could there perhaps be a ‘/’ in one of the inputs that are given to the word renderer?

Hi Daniel,

Thank you for the prompt response.

I did not update the dependencies. However, Kaleido was not defined with a particular version in the requirements.txt file so I assume it just installed the latest available version?
However when checking on pypi I see that the latest update to it is in 2021 so there is no recent update to suggest that it is the problem.

I have revised the input and the code several times and do not seem to find anything wrong. I have published the original code on the staging app and that also doesnt work now.

Is there a way to obtain the source code of the working app?

Hi there,

Thanks for the answer, I fidgeted around a bit with the template as is used in our word report tutorial and managed to get the same error when using the / character in wrong places, specifically as used as you can see here (right before the total and total_price):

Could this also be the problem in your case? If that isn’t it, sharing your template with me would be very convenient as well in finding the exact error (you can send that in a private message if that’s more convenient).

After a quick interaction in a personal message the error seems to have been in the formatting of the tags in the word doc.
What the underlying mechanism of failure was is not clear yet. We’re still investigating and I’ll post here when we know more