python-quantities-developers team mailing list archive
-
python-quantities-developers team
-
Mailing list archive
-
Message #00111
[Bug 406119] Re: Pickle strips units
** Changed in: python-quantities
Status: Fix Committed => Fix Released
--
Pickle strips units
https://bugs.launchpad.net/bugs/406119
You received this bug notification because you are a member of Python
Quantities Development Team, which is subscribed to python-quantities.
Status in Physical Quantities for Python: Fix Released
Bug description:
It seems as though the units are striped from Quantity objects during the pickling/unpickling process.
Note: i'm new to python so perhaps I simply do not understand the how the pickle module is supposed to work.
----------------------------------------
Code:
----------------------------------------
import quantities as quant
import cPickle
quan1 = quant.Quantity([1,3,4,5],'s')
file = open('/Users/psilentp/qfile.cPkl','wb')
cPickle.dump(quan1,file)
file.close()
file2 = open('/Users/psilentp/qfile.cpkl','rb')
quan2 = cPickle.load(file2)
file2.close()
print(quan1)
print(quan2)
------------------------------------------------
output
------------------------------------------------
run /Users/psilentp/pybin/quanttest.py
[1 3 4 5] s
[1 3 4 5] dimensionless