online-judge-tools / api-client

API client to develop tools for competitive programming
MIT License
64 stars 17 forks source link

Migrate to importlib #161

Closed koba-e964 closed 2 years ago

koba-e964 commented 2 years ago

Fixes #157.

shino16 commented 2 years ago

I went through the document of imp.load_module and found the following workaround:

name = 'onlinejudge.__about__'
location = 'onlinejudge/__about__.py'
spec = importlib.util.spec_from_file_location(name, location)
version = importlib.util.module_from_spec(spec)
spec.loader.exec_module(version)
koba-e964 commented 2 years ago

It worked! Thank you!