Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open ROOT over HTTPS #176

Closed
jonas-eschle opened this issue Nov 3, 2020 · 6 comments · Fixed by #201 or #203
Closed

Cannot open ROOT over HTTPS #176

jonas-eschle opened this issue Nov 3, 2020 · 6 comments · Fixed by #201 or #203
Labels
bug (unverified) The problem described would be a bug, but needs to be triaged duplicate This issue or pull request already exists

Comments

@jonas-eschle
Copy link

jonas-eschle commented Nov 3, 2020

I cannot open a ROOT file over HTTPS with uproot4 while it works with uproot

import uproot4
_ = uproot4.open('https://cern.ch/starterkit/data/advanced-python-2019/dalitzdata.root')

It fails with

OSError: remote server does not support HTTP range requests
for URL https://cern.ch/starterkit/data/advanced-python-2019/dalitzdata.root

Do you have any ideas what may goes wrong?

Full StackTrace:

OSError                                   Traceback (most recent call last)
<ipython-input-3-2fc8249c41b5> in <module>
----> 1 _ = uproot4.open('https://cern.ch/starterkit/data/advanced-python-2019/dalitzdata.root')

~/anaconda3/envs/starterkit38/lib/python3.8/site-packages/uproot4/reading.py in open(path, object_cache, array_cache, custom_classes, **options)
    134         )
    135 
--> 136     file = ReadOnlyFile(
    137         file_path,
    138         object_cache=object_cache,

~/anaconda3/envs/starterkit38/lib/python3.8/site-packages/uproot4/reading.py in __init__(self, file_path, object_cache, array_cache, custom_classes, **options)
    565             self._fUUID_version,
    566             self._fUUID,
--> 567         ) = uproot4.source.cursor.Cursor(0).fields(
    568             self._begin_chunk, _file_header_fields_small, {}
    569         )

~/anaconda3/envs/starterkit38/lib/python3.8/site-packages/uproot4/source/cursor.py in fields(self, chunk, format, context, move)
    193         if move:
    194             self._index = stop
--> 195         return format.unpack(chunk.get(start, stop, self, context))
    196 
    197     def field(self, chunk, format, context, move=True):

~/anaconda3/envs/starterkit38/lib/python3.8/site-packages/uproot4/source/chunk.py in get(self, start, stop, cursor, context)
    360         already.
    361         """
--> 362         self.wait()
    363 
    364         if (start, stop) in self:

~/anaconda3/envs/starterkit38/lib/python3.8/site-packages/uproot4/source/chunk.py in wait(self)
    314         """
    315         if self._raw_data is None:
--> 316             self._raw_data = numpy.frombuffer(self._future.result(), dtype=self._dtype)
    317             if len(self._raw_data) != self._stop - self._start:
    318                 raise OSError(

~/anaconda3/envs/starterkit38/lib/python3.8/site-packages/uproot4/source/futures.py in result(self, timeout)
    124             return self._result
    125         else:
--> 126             delayed_raise(*self._excinfo)
    127 
    128     def _run(self):

~/anaconda3/envs/starterkit38/lib/python3.8/site-packages/uproot4/source/futures.py in delayed_raise(exception_class, exception_value, traceback)
     44         exec("raise exception_class, exception_value, traceback")
     45     else:
---> 46         raise exception_value.with_traceback(traceback)
     47 
     48 

~/anaconda3/envs/starterkit38/lib/python3.8/site-packages/uproot4/source/futures.py in _run(self, resource)
    281     def _run(self, resource):
    282         try:
--> 283             self._result = self._task(resource)
    284         except Exception:
    285             self._excinfo = sys.exc_info()

~/anaconda3/envs/starterkit38/lib/python3.8/site-packages/uproot4/source/http.py in task(resource)
    199 
    200         def task(resource):
--> 201             return resource.get(connection, start, stop)
    202 
    203         return uproot4.source.futures.ResourceFuture(task)

~/anaconda3/envs/starterkit38/lib/python3.8/site-packages/uproot4/source/http.py in get(self, connection, start, stop)
    167         if response.status != 206:
    168             connection.close()
--> 169             raise OSError(
    170                 """remote server does not support HTTP range requests
    171 for URL {0}""".format(

OSError: remote server does not support HTTP range requests
for URL https://cern.ch/starterkit/data/advanced-python-2019/dalitzdata.root

@jonas-eschle jonas-eschle added the bug (unverified) The problem described would be a bug, but needs to be triaged label Nov 3, 2020
@jpivarski
Copy link
Member

I haven't tested it, but this might be related to #121.

@jonas-eschle
Copy link
Author

jonas-eschle commented Nov 3, 2020

In fact, you're right! Thanks! closing
Update: sorry, not quite

@jpivarski jpivarski added the duplicate This issue or pull request already exists label Nov 3, 2020
@jonas-eschle jonas-eschle reopened this Nov 3, 2020
@jonas-eschle
Copy link
Author

jonas-eschle commented Nov 3, 2020

Actually, the opening works, but then it fails again (while working for uproot)

command:
uproot4.open('https://starterkit.web.cern.ch/starterkit/data/advanced-python-2019/dalitzdata.root')['tree'].arrays()

Error:

OSError: found 0 of 156 expected headers in HTTP multipart
for URL https://starterkit.web.cern.ch/starterkit/data/advanced-python-2019/dalitzdata.root

@chrisburr
Copy link
Member

It looks like something with multipart HTTP requests was broken between v0.0.17 and v0.0.20

chrisburr added a commit to chrisburr/uproot4 that referenced this issue Nov 3, 2020
chrisburr added a commit to chrisburr/uproot4 that referenced this issue Nov 3, 2020
@jpivarski jpivarski linked a pull request Nov 20, 2020 that will close this issue
@jonas-eschle jonas-eschle reopened this Nov 24, 2020
@jonas-eschle
Copy link
Author

jonas-eschle commented Nov 24, 2020

Reopened, as it seems to me that this was not entirely fixed. The snippet above still errors:
Actually, the opening works, but then it fails again (while working for uproot)

file = uproot4.open('https://starterkit.web.cern.ch/starterkit/data/advanced-python-2019/dalitzdata.root')
_ = file['tree'].arrays()  # fails here

It fails "later" though than the fix I assume, so I've rearranged the example.

Error:

OSError: found 0 of 156 expected headers in HTTP multipart
for URL https://starterkit.web.cern.ch/starterkit/data/advanced-python-2019/dalitzdata.root

@jpivarski
Copy link
Member

Darn: the test only checked

data = f["tree/Y1"].array()

which works. I'm looking into the issue with multiple branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug (unverified) The problem described would be a bug, but needs to be triaged duplicate This issue or pull request already exists
Projects
None yet
3 participants