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

Replace imp #260

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Replace imp #260

wants to merge 4 commits into from

Conversation

dirks
Copy link

@dirks dirks commented May 15, 2024

gardar and others added 4 commits October 24, 2023 15:06
Signed-off-by: gardar <gardar@users.noreply.github.com>
Signed-off-by: gardar <gardar@users.noreply.github.com>
imp is removed in python 3.12
@dirks
Copy link
Author

dirks commented May 15, 2024

fixes #259

@@ -145,7 +150,7 @@ def parse_user_params(user_params):
data_dir = get_data_dir()
tpl_dir = os.path.join(data_dir, 'tpl')
static_dir = os.path.join(data_dir, 'static')
version = open(os.path.join(data_dir, 'VERSION')).read().strip()
version = version("ansible-cmdb")
Copy link

@mgedmin mgedmin Sep 10, 2024

Choose a reason for hiding this comment

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

This doesn't work:

UnboundLocalError: cannot access local variable 'version' where it is not associated with a value

You need to give different names to the imported global function and the local variable.

This works: mgedmin@53b5c30

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

Successfully merging this pull request may close these issues.

3 participants