CkPython
CkPython
Workaround for the deprecated Crypt2.Encode method
Shows how to replace the deprecated Encode method. (Chilkat is moving away from the use of CkByteData.)Chilkat CkPython Downloads
import chilkat
crypt = chilkat.CkCrypt2()
path = "c:/someDir/example.dat"
# Such as base64, hex, hex_lower, etc.
encoding = "base64"
# ------------------------------------------------------------------------
# The Encode method is deprecated:
inData = chilkat.CkByteData()
inData.loadFile(path)
encodedBytes = crypt.encode(inData,encoding)
# ------------------------------------------------------------------------
# Workaround.
# (Chilkat is moving away from using CkByteData)
bd = chilkat.CkBinData()
bd.LoadFile(path)
encodedBytes = bd.getEncoded(encoding)