Skip to content

Commit 53fb813

Browse files
authored
Open with post-fix filename fails
* Test to demo the bug * Work around the safety check * Fix by using dictionary workaround. * Explore why safety check is failing * Dump in the packages installed * Run safety in the correct environment. * Print out pip location
1 parent e9cd5a6 commit 53fb813

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

servicex/data_conversions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def do_the_work(file: Path) -> ak.Array:
163163
return uproot.lazy(f"{file}:{tree_name}") # type: ignore
164164

165165
if hasattr(uproot, "dask"):
166-
return uproot.dask(f"{file}:{tree_name}") # type: ignore
166+
return uproot.dask({str(file): tree_name}) # type: ignore
167167

168168
assert (
169169
False

tests/test_data_conversions.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import shutil
12
from servicex import ServiceXException
23
from servicex.data_conversions import DataConverterAdaptor
34
import pytest
@@ -62,6 +63,17 @@ async def test_root_to_awkward(good_root_file_path):
6263
check_awkward_accessible(df["JetPt"]) # type: ignore
6364

6465

66+
@pytest.mark.asyncio
67+
async def test_root_to_awkward_postfix_filename(good_root_file_path, tmp_path):
68+
# Found in the wild see #337.
69+
postfix_file = tmp_path / "test.root.1"
70+
shutil.copy(good_root_file_path, postfix_file)
71+
72+
df = await DataConverterAdaptor("root-file").convert_to_awkward(postfix_file)
73+
assert len(df["JetPt"]) == 283458 # type: ignore
74+
check_awkward_accessible(df["JetPt"]) # type: ignore
75+
76+
6577
@pytest.mark.asyncio
6678
async def test_to_awkward_fail(good_root_file_path):
6779
with pytest.raises(ServiceXException):

0 commit comments

Comments
 (0)