Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Failures #291

Open
dcompiled opened this issue Nov 11, 2022 · 2 comments
Open

Import Failures #291

dcompiled opened this issue Nov 11, 2022 · 2 comments

Comments

@dcompiled
Copy link

dcompiled commented Nov 11, 2022

The code in strategies/python.py masks errors that occur during the import process. I spent several hours looking into why imports were not working on a remotely managed box and it boiled down to problems with a settings file failing to import.

    @staticmethod
    def is_valid_file(file_name):
        try:
            importlib.import_module(file_name)
            return True
        except (ImportError, TypeError):
            return False

Add some logging with the exception to help pinpoint issues.

@igolkotek
Copy link

igolkotek commented Feb 20, 2023

Agree,
Had the same situation.

Even this change could help.

    @staticmethod
    def is_valid_file(file_name):
        try:
            importlib.import_module(file_name)
            return True
        except (ImportError, TypeError) as e:
            logger.error(e)
            logger.info("Cannot load {} as python settings file".format(file_name))
            return False

@gandhis1
Copy link

Exactly - it ends up hiding import error information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants