Invalid argument: 'street_small.jpg?raw=true'


Hi, trying to follow this tutorial but there is a problem.

The code bellow gives me an error: Invalid argument: ‘street_small.jpg?raw=true’

im_fname ='' +
x, img = data.transforms.presets.ssd.load_test(im_fname, short=512)
print('Shape of pre-processed image:', x.shape)

I’m not sure that’s the tutorial problem or mine. Hope somebody will help :slight_smile: Thanks.


I cannot reproduce it in both python 2 or python 3… Do you run this code on Windows/Linux/MacOS?


python 3.6.5 32-bit, Windows 7.

Here is the full message of the error:

OSError                                   Traceback (most recent call last)
<ipython-input-5-7fff98664abc> in <module>()
  1 im_fname ='' +
----> 2                           'gluoncv/detection/street_small.jpg?raw=true')
  3 x, img = data.transforms.presets.ssd.load_test(im_fname, short=512)
  4 print('Shape of pre-processed image:', x.shape)

g:\programs\languages\python36-32\lib\site-packages\gluoncv\utils\ in download(url, path, overwrite, sha1_hash)
 43             raise RuntimeError("Failed downloading url %s"%url)
 44         total_length = r.headers.get('content-length')
---> 45         with open(fname, 'wb') as f:
 46             if total_length is None: # no content length header
 47                 for chunk in r.iter_content(chunk_size=1024):

OSError: [Errno 22] Invalid argument: 'street_small.jpg?raw=true'


Thanks for sharing.

It is a bug in gluoncv - the ? character is a reserved symbol and cannot be used in file names:

As a workaround, in this particular case, you can just remove ?raw=true part from the url - it should be able to save normally.

Created an issue in the github repo:


Actually, you can provide a second parameter to the function to define the file name on disk: path='street_small.jpg' to function.