navio-online / navio-builder

Navio Online python lightweight builder tool
MIT License
1 stars 1 forks source link

3.12 incompatibility in test_nb.py *and* navio.builder._nb #4

Open matthewdeanmartin opened 5 months ago

matthewdeanmartin commented 5 months ago

\navio-builder\navio\builder\tests\test_nb.py:7: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses import imp

I guess it isn't urgent because it is in the tests, but eventually it will be a problem.

matthewdeanmartin commented 5 months ago

I was wrong, the import imp is also in the main module.

This hack seems to work

    if has_imp:
        module = imp.load_source(path.splitext(path.basename(args.file))[0], args.file)
    else:
        from importlib.machinery import SourceFileLoader
        module = SourceFileLoader(path.splitext(path.basename(args.file))[0], args.file).load_module()