btreport icon indicating copy to clipboard operation
btreport copied to clipboard

generate_html couldn't find templates folder on both of my systems

Open rogerjbos opened this issue 5 years ago • 1 comments

Pieter, thanks for btreport. It is a very nice addition to backtrader. I installed on both a mac and a windows machine and got it working on both, but had to make a slight change to the code.

In the generate_html() function, the line below couldn't locate the "templates" folder:

env = Environment(loader=FileSystemLoader(.))

First I hardcoded the the location to get it to work. Then I noticed that the "images" variable had the correct location for the templates folder, so I got it to work correctly by changing these two lines:

# env = Environment(loader=FileSystemLoader('M:/Python_HOME/backtrader_home/btreport/'))
env = Environment(loader=FileSystemLoader(images))
#template = env.get_template("templates/template.html")
template = env.get_template("/template.html")

I don't know if this affects anyone else or not, but I thought I would report it.

Thanks again, Roger

rogerjbos avatar Oct 23 '19 14:10 rogerjbos

Yes I had the same issue your solution works for me too. Thanks for posting @rogerjbos

sdmiami avatar Jul 22 '20 20:07 sdmiami