Skip to content

Fix some but not all undefined names in scripts/__init__.py #589

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion scripts/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import os
import sys
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scripts/init.py

AFAIK, it is not a standalone script. It is used through eval()

Copy link
Contributor Author

@cclauss cclauss Nov 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eval() is evil ;-) but if these imports have already been done then these lines become no-ops but if the imports have not been done then these lines will prevent crashes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cclauss, you mean it prevents crashes in a linting job?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crashes in any situation where os and sys have not already been imported by some other file.

As it says in The Zen of Python", explicit is better than implicit.


PYTHON_EXTENSIONS_PATHS = [
LOADER_DIR
] + PYTHON_EXTENSIONS_PATHS
Expand All @@ -8,7 +11,7 @@
from .version import ci_build, headless

ci_and_not_headless = ci_build and not headless
except:
except ImportError:
pass

# the Qt plugin is included currently only in the pre-built wheels
Expand Down