Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions subuserlib/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
#external imports
import os
import inspect
try:
import importlib.resources as importlib_resources
except ImportError:
# For compatibility with older Python versions (< 3.7)
import importlib_resources
#internal imports
import subuserlib.executablePath as executablePath

Expand Down Expand Up @@ -36,9 +41,8 @@ def getSubuserDataFile(filename):
if os.path.exists(dataFile):
return dataFile
else:
import pkg_resources
dataFile = pkg_resources.resource_filename("subuserlib",os.path.join("data",filename))
if not os.path.exists(dataFile):
ref = importlib_resources.files("subuserlib").joinpath("data", filename)
if not ref.is_file():
exit("Data file does not exist:"+str(dataFile))
else:
return dataFile
return str(ref)
Loading