Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
ValueError: invalid literal for float(): -1.#IND (pickle.py)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Grant Edwards, post: 4100494"] That's an infinity. In Python 2.x, pickle doesn't handle infinities and NaNs. IMO, it's a bug. It's been fixed in 3.x. If you want to pickle floating point data that includes infinities and NaNs, you need to write your own handler for floating point values. When pickling you need to check for infinities and NaNs and output some defined strings. When unpickling, you need to check for those strings and generate infinities and NaNs as appropriate. The CPython 2.x version of pickle just uses the underlying C library routines to print and parse floating point values. If those libraries are broken in the way that they represent infinity and NaN, then pickle is broken in the same manner. Windows standard libraries are broken. When formatting floating point values, it produces strings that it can't parse as input. IIRC, Linux works better -- but if you want something that you know is going to work (and work cross-platform), then you need to write your own floating point pickle/unpickle methods, and hook them into the pickle module. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
ValueError: invalid literal for float(): -1.#IND (pickle.py)
Top