Skip to content

Commit

Permalink
Remove 3.12 deprecation warning...
Browse files Browse the repository at this point in the history
regarding the use of pkgdata
  • Loading branch information
rocky committed Jul 26, 2024
1 parent 3c65969 commit 0afada1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mathics_scanner/characters.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@
and Unicode/ASCII.
"""

import re
import os
import pkg_resources
import os.path as osp
import re

try:
import ujson
except ImportError:
import json as ujson

ROOT_DIR = pkg_resources.resource_filename("mathics_scanner", "")

def get_srcdir() -> str:
filename = osp.normcase(osp.dirname(osp.abspath(__file__)))
return osp.realpath(filename)


ROOT_DIR = get_srcdir()

# Load the conversion tables from disk
characters_path = os.path.join(ROOT_DIR, "data", "characters.json")
characters_path = osp.join(ROOT_DIR, "data", "characters.json")
if os.path.exists(characters_path):
with open(characters_path, "r") as f:
_data = ujson.load(f)
Expand Down

0 comments on commit 0afada1

Please sign in to comment.