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

PR: Fix setting user environment variables on Windows #22075

Merged
merged 3 commits into from
May 20, 2024

Conversation

mrclary
Copy link
Contributor

@mrclary mrclary commented May 13, 2024

Description of Changes

When adding user environment variables to Windows registry, the value must be a string. Under some circumstances, the user provided value may be numeric resulting in ValueError: Could not convert the data to the specified type.. Applying clean_env resolves this issue.

Also, a user warning UserWarning: A SpyderConfigurationObserver must define a `CONF_SECTION` class attribute! was encountered when launching the User environment variable widget. This was fixed by adding CONF_SECTION = 'main' to the CollectionsEditorWidget class.

Issue(s) Resolved

Fixes #21771

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct:

@mrclary mrclary self-assigned this May 13, 2024
@mrclary
Copy link
Contributor Author

mrclary commented May 13, 2024

I encountered another issue when investigating this. When removing an environment variable, it is not removed from the registry. I think some discussion and more work would be required to fix this issue, since this requires more than just over-writing existing variables. Also related may be #3891.

@ccordoba12 ccordoba12 added this to the v6.0beta2 milestone May 13, 2024
@mrclary mrclary marked this pull request as ready for review May 16, 2024 20:55
@mrclary mrclary requested a review from ccordoba12 May 16, 2024 20:55
…fine a `CONF_SECTION` class attribute! Hint: <spyder.widgets.collectionseditor.CollectionsEditorWidget object at 0x0000021679642320> or its parent should define the section."
…ype."

When inserting new variable in user environment variables on Windows, the value may not be a string and results in the error above.
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Thanks for your help with this @mrclary! Just a clarifying suggestion for you, the rest looks good to me.

spyder/widgets/collectionseditor.py Outdated Show resolved Hide resolved
Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Thanks @mrclary!

Note: The failure in our tests is unrelated to this.

@ccordoba12 ccordoba12 merged commit b827ca6 into spyder-ide:master May 20, 2024
13 of 14 checks passed
@mrclary mrclary deleted the issue-21771 branch May 21, 2024 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding "User environment variables in Windows registry"
2 participants