htm.core icon indicating copy to clipboard operation
htm.core copied to clipboard

saveToFile() not implemented correctly for python regions

Open Zbysekz opened this issue 4 years ago • 2 comments

See comments https://github.com/htm-community/htm.core/pull/873#discussion_r486977186

Probably needs just create bindings for enum. Now can be bypassed by using save() and saving as binary stream, like:

with open(filepath+"_basal.dump", "wb") as f:
            f.write(self._tm.basalConnections.save())

Zbysekz avatar Sep 14 '20 13:09 Zbysekz

Thanks for posting this for me.

dkeeney avatar Sep 14 '20 15:09 dkeeney

Corrected with PR #966

for saveToFile( ) and loadFromFile( ) the arguments are filename and fmt fmt is optional and defaults to "BINARY". The fmt argument is a string and can be one of

  • "BINARY" - fastest but not readable.
  • "PORTABLE" - a little slower than "BINARY" but handles big/little endings when going between machines.
  • "JSON" - a JSON text serialization that is mostly readable.
  • "XML" - an XML text serialization that is mostly readable.

Note: in C++ the fmt argument can now be either a std::string or the enum as previously defined (see Serialization.hpp).

dkeeney avatar May 06 '21 18:05 dkeeney