Closed perbu closed 4 years ago
Thanks for reporting this.
Is this issue Python 3 specific?
Having said that, one thing we could do is simply ignore "illegal seek" errors in that place, but I'm not sure that's the correct approach. It may mask real issues.
EDIT: It looks like we indeed don't have a better option (https://bugs.python.org/issue12877) since Python sadly doesn't throw a more specific / better exception in that case (so we can't distinguish if underlying iterator doesn't support seek or it does support it and incorrect seek position is provided).
We could have some specific case for pipes, but that's probably not the most robust approach...
Summary
I'm running the example on https://libcloud.readthedocs.io/en/stable/storage/examples.html that creates a tarfile and uploads it via stream to an objectstore.
I'm using GCS. libcloud tries to do a seek() on the supplied iterator, this fails and the program stops.
Detailed Information
apache-libcloud==2.8.0 Python 3.7.6 macos Catalina
The example in the doc is Python 2, I've rewritten it for python 3. I'm using GCS.
This returns the following exception:
The offending code in libcloud/storage/base.py looks like this:
I'm not entirely sure why the iterator get "seek". I've been able to work around the issue by creating a SimpleIterator class that only supplies next and then taking the output from Popen.stdout and subclassing it into the SimpleIterator.
If I just comment out the seek(0) everything seems to work.
Thanks for an excellent project. Let me know if you need anything more from me.
Cheers,
Per.