Skip to content

Commit a780144

Browse files
committed
Use importlib.resources to locate flamegraph assets
1 parent 8291df0 commit a780144

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/profiling/sampling/stack_collector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import base64
22
import collections
33
import functools
4+
import importlib.resources
45
import json
56
import linecache
67
import os
7-
import pathlib
88

99
from .collector import Collector
1010

@@ -215,7 +215,7 @@ def _get_source_lines(self, func):
215215
def _create_flamegraph_html(self, data):
216216
data_json = json.dumps(data)
217217

218-
template_dir = pathlib.Path(__file__).parent
218+
template_dir = importlib.resources.files(__package__)
219219
vendor_dir = template_dir / "_vendor"
220220
assets_dir = template_dir / "_assets"
221221

0 commit comments

Comments
 (0)