Closed hadim closed 7 years ago
I use Python 3.6
Here is the patch that used to make it work :
diff --git a/betago/dataloader/index_processor.py b/betago/dataloader/index_processor.py
index 89effe0..0bc8f54 100644
--- a/betago/dataloader/index_processor.py
+++ b/betago/dataloader/index_processor.py
@@ -4,9 +4,13 @@
from __future__ import print_function
import os
import sys
-import urllib
import multiprocessing
+if sys.version_info[0] == 3:
+ from urllib.request import urlopen, urlretrieve
+else:
+ from urllib import urlopen, urlretrieve
+
def worker(url_and_target):
'''
@@ -15,7 +19,7 @@ def worker(url_and_target):
try:
(url, target_path) = url_and_target
print('>>> Downloading ' + target_path)
- urllib.urlretrieve(url, target_path)
+ urlretrieve(url, target_path)
except (KeyboardInterrupt, SystemExit):
print('>>> Exiting child process')
@@ -80,8 +84,8 @@ class KGSIndex(object):
index_file.close()
else:
print('>>> Downloading index page')
- fp = urllib.urlopen(self.kgs_url)
- data = unicode(fp.read())
+ fp = urlopen(self.kgs_url)
+ data = str(fp.read())
fp.close()
index_contents = data
index_file = open(self.index_page, 'w')
Also the tutorial lacks some import to work out of the box (related to Keras such as layers and Sequential
).
Hi hadim, betago theoretically supports python 3, but as you can see we haven't been careful about testing in both Python versions.
Thanks for your patch! I will modify it to use the six library and merge.
above PR will hopefully close this. we still need more test coverage for the data loading.
About the readme, it's meant to skim through to get an idea, but maybe we should link to a full example explicitly.
alright @hadim, I'll close this for now. Thanks again for the patch! let me know in case we missed something.
Is it Python 3 compatible ?
raises