testpath = PosixPath('/tmp/pytest-of-user/pytest-8')
@pytest.fixture
def ge_two_gep_files_ppg(testpath):
> tmp = fetch_file("qawjv", testpath, "RESPData_epiRT_0000000000_00_00_000.gep")
phys2bids/tests/conftest.py:115:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
phys2bids/tests/conftest.py:53: in fetch_file
urlretrieve(url, full_path)
../../../anaconda3/lib/python3.9/urllib/request.py:239: in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
../../../anaconda3/lib/python3.9/urllib/request.py:214: in urlopen
return opener.open(url, data, timeout)
../../../anaconda3/lib/python3.9/urllib/request.py:523: in open
response = meth(req, response)
../../../anaconda3/lib/python3.9/urllib/request.py:632: in http_response
response = self.parent.error(
../../../anaconda3/lib/python3.9/urllib/request.py:555: in error
result = self._call_chain(*args)
../../../anaconda3/lib/python3.9/urllib/request.py:494: in _call_chain
result = func(*args)
../../../anaconda3/lib/python3.9/urllib/request.py:747: in http_error_302
return self.parent.open(new, timeout=req.timeout)
../../../anaconda3/lib/python3.9/urllib/request.py:523: in open
response = meth(req, response)
../../../anaconda3/lib/python3.9/urllib/request.py:632: in http_response
response = self.parent.error(
../../../anaconda3/lib/python3.9/urllib/request.py:561: in error
return self._call_chain(*args)
../../../anaconda3/lib/python3.9/urllib/request.py:494: in _call_chain
result = func(*args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <urllib.request.HTTPDefaultErrorHandler object at 0x7fc0167032b0>, req = <urllib.request.Request object at 0x7fc016677c40>, fp = <http.client.HTTPResponse object at 0x7fc016677fd0>, code = 308, msg = 'PERMANENT REDIRECT'
hdrs = <http.client.HTTPMessage object at 0x7fc0166776d0>
def http_error_default(self, req, fp, code, msg, hdrs):
> raise HTTPError(req.full_url, code, msg, hdrs, fp)
E urllib.error.HTTPError: HTTP Error 308: PERMANENT REDIRECT
../../../anaconda3/lib/python3.9/urllib/request.py:641: HTTPError
- Python version: 3.9.12
- phys2bids version: 2.10.0
- Platform: Linux
Expected Behavior
Actual Behavior
Steps to Reproduce the Problem
From the phys2bids/ directory:
pytest phys2bids/tests/test_integration.pySpecifications
Possible solution
It seems like the
osf.io/{osf_id}/downloadhave been moved permanently (HTTP Error 308) and that redirection can't be done automatically withe the current code..One option could be to use the
requestslibrary with the parameterallow_redirects=True(see documentation) instead of urlretrieve.