Cope 2.5.0
My personal "standard library" of all the generally useful code I've written for various projects over the years
|
def Cope.imports.try_import | ( | str | name, |
str | pip_name = ... , |
||
bool | err = False |
||
) |
Try to import a package, if it exists.
If err
is True, then it raises an error telling the user what package needs to be installed. The package is assumed to be the same name as name
. If it's not, be sure to set pip_name
to the proper value. If err
is False, it just returns None. If err
is False, pip_name
is not used.
Definition at line 50 of file imports.py.