deep_trader icon indicating copy to clipboard operation
deep_trader copied to clipboard

UnicodeDecodeError

Open yeshengyi opened this issue 6 years ago • 5 comments

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?

yeshengyi avatar Jul 05 '18 18:07 yeshengyi

looks like python2 vs python3 problem

tivvit avatar Jul 05 '18 20:07 tivvit

I use python3

yeshengyi avatar Jul 05 '18 20:07 yeshengyi

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)

smileyung avatar Jul 19 '18 15:07 smileyung

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.

BTCTON avatar Aug 19 '18 19:08 BTCTON

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?

greg2paris avatar Nov 08 '18 10:11 greg2paris