dmulyalin / ttp

Template Text Parser
MIT License
350 stars 34 forks source link

TTP dictionary cache not rebuilt #66

Closed dmulyalin closed 2 years ago

dmulyalin commented 2 years ago

After fixes related to making TTP thread safe, need to make sure that ttp dict cache getting rebuilt after uprade to newer version, which make sense to do anyway.

As of TTP 0.8.2 getting this error after upgrade from previous version to 0.8.2:

Traceback (most recent call last):
  File "/usr/local/bin/ttp", line 8, in <module>
    sys.exit(cli_tool())
  File "/usr/local/lib/python3.8/dist-packages/ttp/ttp.py", line 3535, in
cli_tool
    ttp_template = _ttp_["utils"]["load_files"](TEMPLATE_FILE,
read=True)[0][1]
  File "/usr/local/lib/python3.8/dist-packages/ttp/ttp.py", line 67, in
__call__
    self.load()
  File "/usr/local/lib/python3.8/dist-packages/ttp/ttp.py", line 51, in load
    setattr(module, "_ttp_", self._ttp_)
AttributeError: 'CachedModule' object has no attribute '_ttp_'
dmulyalin commented 2 years ago

should be fixed in 0.8.3

dmulyalin commented 2 years ago

Prior to 0.8.3, fix for that issue would be to manually delete ttp_dict_cache.pickle file from TTP package installation directory

As per docs :

Because of caching, TTP no longer scans sub folders, this means that to make TTP to see and use new function, ttp_dict_cache.pickle file must be deleted, forcing TTP to rescan and cache new function.

0.8.3 introduced check for TTP version in ttp_dict_cache.pickle, if it does not match, that file overwritten.