Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError #19

Open
yeshengyi opened this issue Jul 5, 2018 · 5 comments
Open

UnicodeDecodeError #19

yeshengyi opened this issue Jul 5, 2018 · 5 comments

Comments

@yeshengyi
Copy link

when I run it, I encounter the following error:

Warning (from warnings module):
File "C:\Users\ben\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\cross_validation.py", line 41
"This module will be removed in 0.20.", DeprecationWarning)
DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
Traceback (most recent call last):
File "C:\Users\ben\Documents\python\deep_trader\tensor-reinforcement\dqn_model.py", line 11, in
from train_stock import *
File "C:\Users\ben\Documents\python\deep_trader\tensor-reinforcement\train_stock.py", line 22, in
data = episodic_data.load_data("data.pkl",episode=10)
File "C:\Users\ben\Documents\python\deep_trader\tensor-reinforcement\episodic_data.py", line 77, in load_data
data = load_file_data(file)
File "C:\Users\ben\Documents\python\deep_trader\tensor-reinforcement\episodic_data.py", line 82, in load_file_data
data = six.moves.cPickle.load(myFile)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x97 in position 0: ordinal not in range(128)

Can someone help me out here?

@tivvit
Copy link

tivvit commented Jul 5, 2018

looks like python2 vs python3 problem

@yeshengyi
Copy link
Author

I use python3

@smileyung
Copy link

UnicodeDecodeError: 'ascii' codec can't decode byte 0x97 in position 0: ordinal not in range(128)
I have the same problem with python 3

/home/smilewater/anaconda3/envs/tensorflow-gpu/lib/python3.6/site-packages/sklearn/cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
"This module will be removed in 0.20.", DeprecationWarning)
Traceback (most recent call last):
File "dqn_model.py", line 11, in
from train_stock import *
File "/media/smilewater/Disk/pywork/SinicaFinancial/deep_trader/tensor-reinforcement/train_stock.py", line 21, in
data = episodic_data.load_data("data.pkl",episode=10)
File "/media/smilewater/Disk/pywork/SinicaFinancial/deep_trader/tensor-reinforcement/episodic_data.py", line 71, in load_data
data = load_file_data(file)
File "/media/smilewater/Disk/pywork/SinicaFinancial/deep_trader/tensor-reinforcement/episodic_data.py", line 76, in load_file_data
data = six.moves.cPickle.load(myFile)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x97 in position 0: ordinal not in range(128)

@BTCTON
Copy link

BTCTON commented Aug 19, 2018

def load_file_data(file):
with open(file, 'rb') as myFile:
    # data = six.moves.cPickle.load(myFile)
    data = pickle.load(myFile, encoding='latin')
return data

change episodic_data.py to this.

@greg2paris
Copy link

I have tried the solution you provided but i got an other error.

return hashlib.md5(string).hexdigest()
Unicode-objects must be encoded before hashing

how do you think I can fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants