pod not showning image in report but file existant

Asked by amartino

Hello there.

I've created a .odt template which should contain some images in the rendered version.

I have added the following code in the comment section of my template.odt template:

do text
from document(at = file_name + '_input_curve_difference.svg')

where filename is the python variable that is being passed by my python app.
In the rendered report.odt i get the following error:

"
Error while evaluating the expression "document(at = file_name + '_input_curve_difference.svg')" defined in the "from" part of a statement. 'data_1e_03_input_curve_difference.svg' does not exist or is not a file.
"

Which is incorrect because there is a file of that name which lies in the same folder with report.odt and template.odt.

Ideas?

Question information

Language:
English Edit question
Status:
Solved
For:
Appy Edit question
Assignee:
No assignee Edit question
Solved by:
amartino
Solved:
Last query:
Last reply:
Revision history for this message
amartino (amartino) said :
#1

Started checking the source to see where does it fail.
Got to

doc_importers.py:

# Ensure this path exists, if it is a local path.
if at and not at.startswith('http') and not os.path.isfile(at):
    raise PodError(FILE_NOT_FOUND % at)

This is where the error was generated.
Checked the value of my at from debugger

ipdb> at
u'data_1e_03.svg'

Checked the current working directory:

ipdb> os.path.realpath(__file__)
'.../appy/pod/doc_importers.py'

Tried with absolute image paths:

context = {'image': os.path.join(path, image_name) }

which got the images to shoe in the template.

Conclusion, image paths are not relative to the location of the template.odt file.