Skip to content

Commit 5202c7b

Browse files
committed
FIX: python 3 compability
1 parent 1a9726f commit 5202c7b

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

openml/apiconnector.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,6 @@ def _create_run_from_xml(self, xml):
947947
url = file_[u"oml:url"]
948948
files[name] = url
949949

950-
print dic.keys()
951950
evaluations = dict()
952951
for evaluation in dic[u"oml:output_data"][u"oml:evaluation"]:
953952
name = evaluation[u"oml:name"]
@@ -1009,8 +1008,8 @@ def _read_url(self, url, data=None, file_path=None):
10091008

10101009
try:
10111010
response = requests.post(url, data=data, files=fileElement)
1012-
except URLError, error:
1013-
print error
1011+
except URLError as error:
1012+
print(error)
10141013

10151014
return response.status_code, response
10161015
else:

openml/entities/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __init__(self, id, name, version, description, format, creator,
8181
else:
8282
raise Exception()
8383

84-
with open(self.data_pickle_file, "w") as fh:
84+
with open(self.data_pickle_file, "wb") as fh:
8585
pickle.dump((X, categorical, attribute_names), fh, -1)
8686
logger.debug("Saved dataset %d: %s to file %s" %
8787
(self.id, self.name, self.data_pickle_file))

tests/test_apiconnector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def test_get_cached_datasets(self):
7171
datasets = connector.get_cached_datasets()
7272
self.assertIsInstance(datasets, dict)
7373
self.assertEqual(len(datasets), 2)
74-
self.assertIsInstance(datasets.values()[0], OpenMLDataset)
74+
self.assertIsInstance(list(datasets.values())[0], OpenMLDataset)
7575

7676
def test_get_cached_dataset(self):
7777
workdir = os.path.dirname(os.path.abspath(__file__))

0 commit comments

Comments
 (0)