You should write the pickled data with a lower protocol number in Python 3. Python 3 introduced a new protocol with the number 3
(and uses it as default), so switch back to a value of 2
which can be read by Python 2.
Check the protocol
parameter in pickle.dump
. Your resulting code will look like this.
pickle.dump(your_object, your_file, protocol=2)
There is no protocol
parameter in pickle.load
because pickle
can determine the protocol from the file.
Related Posts:
- ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?
- WinError 2 The system cannot find the file specified (Python)
- sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)
- sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)
- Could not find a version that satisfies the requirement tensorflow
- sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)
- Could not find a version that satisfies the requirement tensorflow
- Local variable referenced before assignment?
- TypeError: write() argument must be str, not bytes (Python 3 vs Python 2 )
- Change figure size and figure format in matplotlib
- Type error Unhashable type:set
- TypeError: ‘_io.TextIOWrapper’ object is not subscriptable
- Not able to pip install pickle in python 3.6
- What is the meaning of “int(a[::-1])” in Python?
- dump() missing 1 required positional argument: ‘fp’ in python json
- Does python have header files like C/C++?
- Use Gif Logo For Loading Screen In Kivy
- How can I make a time delay in Python? [duplicate]
- Python – TypeError: ‘int’ object is not iterable
- Python: ‘ModuleNotFoundError’ when trying to import module from imported package
- TypeError: ‘int’ object is not callable
- TypeError: ‘int’ object is not callable
- What does the list() function do in Python?
- Python ‘If not’ syntax [duplicate]
- Converting dictionary to JSON
- Saving and loading objects and using pickle
- Invalid character in identifier
- ln (Natural Log) in Python
- Python Error: AttributeError: __enter__ [duplicate]
- Unable to plot Double Bar, Bar plot using pyplot for ndarray
- Cannot find module cv2 when using OpenCV
- filedialog, tkinter and opening files
- Error in Python script “Expected 2D array, got 1D array instead:”?
- Name ‘xrange’ is not defined in Python 3 [duplicate]
- Why are Python’s ‘private’ methods not actually private?
- Error: ” ‘dict’ object has no attribute ‘iteritems’ “
- How do order of operations go on Python?
- How to upgrade pip3?
- TypeError: cannot convert the series to
- ‘End of statement expected’ in pycharm
- How to import files in python using sys.path.append?
- How can I concatenate str and int objects?
- error: Failed to load the native TensorFlow runtime
- ImportError: No module named ‘encodings’
- how does \r (carriage return) work in Python
- What is Python buffer type for?
- IndexError: index 1 is out of bounds for axis 0 with size 1/ForwardEuler
- TypeError(“‘bool’ object is not iterable”,) when trying to return a Boolean
- TypeError: unsupported operand type(s) for -: ‘list’ and ‘list’
- AttributeError: ‘datetime’ module has no attribute ‘strptime’
- Python add item to the tuple
- PermissionError: [WinError 5] Access is denied
- How can I read pdf in python?
- Converting int to bytes in Python 3
- How to get the current working directory using python 3?
- min() arg is an empty sequence
- “for line in…” results in UnicodeDecodeError: ‘utf-8’ codec can’t decode byte
- SyntaxError invalid token
- How do I format a string using a dictionary in python-3.x?
- For loop and ‘numpy.float64’ object is not iterable error
- How to fix: “UnicodeDecodeError: ‘ascii’ codec can’t decode byte”
- python mpl_toolkits installation issue
- TypeError: ‘dict_keys’ object does not support indexing
- How to strip all whitespace from string
- Python Binomial Coefficient
- What is the difference between json.load() and json.loads() functions
- pythonw.exe or python.exe?
- How to convert ‘binary string’ to normal string in Python3?
- Can’t find module cPickle using Python 3.5 and Anaconda
- Copy a list of list by value and not reference
- python3 TypeError: ‘function’ object is not iterable
- How to start from second index for for-loop
- scrapy run spider from script
- Python, how to handle the “ValueError: unsupported pickle protocol: 4” error?
- Python Error – TypeError: input expected at most 1 arguments, got 3 [duplicate]
- A general tree implementation?
- python error: TypeError: an integer is required
- ModuleNotFoundError: No module named ‘seaborn’ in Python IDE
- Is there a ceiling equivalent of // operator in Python?
- Python Requests – No connection adapters
- How to detect key presses?
- TypeError: ‘set’ object does not support indexing
- Root mean square of a function in python
- ‘virtualenv’ is not recognized as an internal or external command, operable program or batch file
- pip throws TypeError: parse() got an unexpected keyword argument ‘transport_encoding’ when trying to install new packages
- Split string using a newline delimiter with Python
- No module named urllib3
- How to know/change current directory in Python shell?
- AttributeError: ‘tuple’ object has no attribute
- What is an easy way to implement fprintf in python?
- How to open html file?
- “Python version 2.7 required, which was not found in the registry” error when attempting to install netCDF4 on Windows 8
- Generator expression must be parenthesized if not sole argument
- Error: No module named ‘fcntl’
- Python can’t find file
- TypeError: got multiple values for argument
- IOError: [Errno 32] Broken pipe when piping: `prog.py | othercmd`
- Python webbrowser.open() to open Chrome browser
- Python 2.7 mixing iteration and read methods would lose data
- Python: OSError: [Errno 2] No such file or directory: ”