iterator should return strings, not bytes (did you open the file in text mode?)
TommasoBendinelli opened this issue · 3 comments
I am trying to run the experiment file, but I get the following error with the dataset that you have provided:
iterator should return strings, not bytes (did you open the file in text mode?) at line 217.
I am using python 3.7.6 and executing experiment.py with the following arguments:
python3 experiment.py data/settles.acl16.learning_traces.13m.csv.gz
fixed by extracting the csv file and changing the reading from 'rb' to 'r'
Hello. I have the same issue. When I tried your technique and executed 'python3 experiment.py settles.acl16.learning_traces.13m.csv' in command line, I get another error as below:
method = "hlr"
reading data...Traceback (most recent call last):
File "experiment.py", line 284, in
trainset, testset = read_data(args.input_file, args.method, args.b, args.l, args.max_lines)
File "experiment.py", line 244, in read_data
fv.append((intern('right'), math.sqrt(1+right)))
NameError: name 'intern' is not defined
How to fix it?
@hojun0705 It looks like this code is written in Python 2, but you are trying to run it in Python3.
To run the code on Python 3, replace intern()
to sys.intern()
, for file open mode, 'rb'
to 'rt'
, wb
to w
, and .iteritems()
to .items()
.