system.tag.queryTagHistory from report schedule return None

I created a Project script who get some historical data with the function system.tag.queryTagHistory.
If I run this script from a window, the script works well and I get all my data. But, I want to run this script from a report schedule. But, with all the same parameters, the system.tag.queryTagHistory always return None.

dataset = system.tag.queryTagHistory(paths=[‘MyPath’], startDate=MyStartDate, endDate=MyEndDate, returnSize=1, aggregationMode=“Maximum”, returnFormat=‘Wide’)

pds = system.dataset.toPyDataSet(dataset)

myValue = pds[0][1]

So, this script works when callen by a window but return “None” when called by a report schedule.

Thanks for your help.

Did you save your project after editing the script? Reports run in gateway scope so you may have stale scripts.