Issue 28844: Pickling units - Python tracker (original) (raw)
Issue28844
Created on 2016-11-30 20:25 by abz64, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Messages (3) | ||
---|---|---|
msg282099 - (view) | Author: Adam (abz64) | Date: 2016-11-30 20:25 |
See below code to show you can't round-trip units through pickle: Python 3.5.1 |Anaconda 4.0.0 (64-bit) | (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit AMD64)] import units u = units.unit('myUnit') x = u(3.0) import pickle f = open('C:/temp/what.pkl', 'wb') pickle.dump(x, f) f.close() f = open('C:/temp/what.pkl', 'rb') y = pickle.load(f) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) in () ----> 1 y = pickle.load(f) TypeError: __new__() missing 2 required positional arguments: 'num' and 'unit' | |
msg282100 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2016-11-30 20:28 |
unit is not part of the stdlib. Please report this to whatever the upstream is for the package and/or to Anaconda. | ||
msg282101 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2016-11-30 20:29 |
To clarify: it looks from your report like units hasn't implemented pickling support. It isn't automatic for all classes. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:40 | admin | set | github: 73030 |
2016-11-30 20:29:20 | r.david.murray | set | messages: + |
2016-11-30 20:28:29 | r.david.murray | set | status: open -> closednosy: + r.david.murraymessages: + resolution: third partystage: resolved |
2016-11-30 20:25:08 | abz64 | create |