Closed bow closed 7 years ago
What if I made the following change?
--- a/setup.py
+++ b/setup.py
@@ -147,7 +147,10 @@ def build_parasail(libname):
if not os.path.exists(archive):
print("Downloading latest parasail master")
theurl = 'https://github.com/jeffdaily/parasail/archive/master.zip'
- name,hdrs = urllib.urlretrieve(theurl, archive)
+ try:
+ name,hdrs = urllib.urlretrieve(theurl, archive)
+ except:
+ name,hdrs = urllib.request.urlretrieve(theurl, archive)
else:
print("Archive '{}' already downloaded".format(archive))
Would that work?
That doesn't exactly work, unfortunately. I just saw that request.py
is a Python file inside the urllib
directory.
I tried this locally and python setup.py bdist_wheel
seems to work:
diff --git i/setup.py w/setup.py
index 2b12c2b..43dd83c 100644
--- i/setup.py
+++ w/setup.py
@@ -6,7 +6,10 @@ import shutil
import stat
import subprocess
import sys
-import urllib
+try:
+ from urllib import urlretrieve
+except ImportError:
+ from urllib.request import urlretrieve
import zipfile
from distutils.util import get_platform
@@ -147,7 +150,7 @@ def build_parasail(libname):
if not os.path.exists(archive):
print("Downloading latest parasail master")
theurl = 'https://github.com/jeffdaily/parasail/archive/master.zip'
- name,hdrs = urllib.urlretrieve(theurl, archive)
+ name,hdrs = urlretrieve(theurl, archive)
else:
print("Archive '{}' already downloaded".format(archive))
I can't believe to took me so long to get this fixed. I just took your code and committed it. Please try it if you get a chance.
Hi @jeffdaily,
No worries. Thanks for committing the changes, it works fine now.
Hi @jeffdaily,
Thanks for writing parasail. I was about to try it out under Python 3.5, when I found out that the pip installation is not working (I'm on CPython 3.5.2, to be exact).
Here's my stack trace:
Parasail is still installed afterwards, but importing failed (as expected). The cause is is simply
urlretrieve
being moved underurllib.request
(instead of justurllib
) in Python 3.5 (official docs here).I haven't checked if there's any other
urllib
-related errors aside from this.