Skip to content

Commit 905a37f

Browse files
fix not a package type error for importlib (#193)
* fix not a package type error for importlib * [pre-commit.ci] auto fixes from pre-commit hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent aeca43d commit 905a37f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/diffpy/pdfgui/gui/pdfguiglobals.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@
3030
isAltered = False
3131

3232
# Resolve APPDATADIR base path to application data files.
33-
_mydir = os.path.abspath(str(files(__name__)))
33+
try:
34+
_mydir = os.path.abspath(str(files(__name__)))
35+
except TypeError: # For Python < 3.12
36+
_mydir = os.path.abspath(os.path.dirname(__file__))
37+
3438
_upbasedir = os.path.normpath(_mydir + "/../../..")
3539
_development_mode = os.path.basename(_upbasedir) == "src" and os.path.isfile(
3640
os.path.join(_upbasedir, "../pyproject.toml")

0 commit comments

Comments
 (0)