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: Avoid iterating over non-dict objects if conda responds with errors #21997

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

dpizetta
Copy link
Contributor

@dpizetta dpizetta commented Apr 15, 2024

Description of Changes

  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable)
  • Included a screenshot or animation (if affecting the UI, see Licecap)

Issue(s) Resolved

Fixes #22007.

Traceback (most recent call last):
  File "/XXX/lib/python3.11/site-packages/spyder/workers/updates.py", line 119, in start
    channel, channel_url = get_spyder_conda_channel()
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/XXX/lib/python3.11/site-packages/spyder/utils/conda.py", line 235, in get_spyder_conda_channel
    if package_info["name"] == 'spyder':
       ~~~~~~~~~~~~^^^^^^^^
TypeError: string indices must be integers, not 'str'

Reponse from conda:

{'caused_by': 'None', 'error': "CondaError: Expected exactly one egg-infodirectory in 'XXX', via egg-link 'lib/python3.11/site-packages/XXX.egg-link'. Instead found: ('XXX.egg-info', 'XXX.egg-info'). These are often left over from legacy operations that did not clean up correctly. Please remove all but one of these.", 'exception_name': 'CondaError', 'exception_type': "<class 'conda.CondaError'>", 'message': "Expected exactly oneegg-info directory in '/XXX', via egg-link 'lib/python3.11/site-packages/XXX.egg-link'. Instead found: ('XXX.egg-info', 'XXX.egg-info'). These are often left over from legacy operations that did not clean up correctly. Please remove all but one of these."}

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: dpizetta

@ccordoba12 ccordoba12 changed the base branch from master to 5.x April 16, 2024 04:38
@ccordoba12 ccordoba12 changed the base branch from 5.x to master April 16, 2024 04:38
@ccordoba12
Copy link
Member

Hey @dpizetta, thanks for your help with this! You did this change against our master branch but it seems you're using Spyder 5. So, you probably would like to see it in our next version (5.5.5), right?

If that's the case, would you be ok with us moving this change to our 5.x branch?

@ccordoba12 ccordoba12 added this to the v5.5.5 milestone Apr 16, 2024
@dpizetta
Copy link
Contributor Author

Hey @ccordoba12, sure, would be great to have in the v5 for our use here. Thanks for the heads up

@ccordoba12 ccordoba12 changed the title Avoids iterating over non-dict objects if conda responds with errors PR: Avoid iterating over non-dict objects if conda responds with errors Apr 18, 2024
Original source problem:

Traceback (most recent call last):
  File "/home/pizetta/miniconda3/envs/ciermag-develop/lib/python3.11/site-packages/spyder/workers/updates.py", line 119, in start
    channel, channel_url = get_spyder_conda_channel()
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pizetta/miniconda3/envs/ciermag-develop/lib/python3.11/site-packages/spyder/utils/conda.py", line 235, in get_spyder_conda_channel
    if package_info["name"] == 'spyder':
       ~~~~~~~~~~~~^^^^^^^^
TypeError: string indices must be integers, not 'str'
@ccordoba12 ccordoba12 changed the base branch from master to 5.x April 18, 2024 22:20
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 @dpizetta!

@ccordoba12 ccordoba12 merged commit 1d17d91 into spyder-ide:5.x Apr 19, 2024
23 checks passed
ccordoba12 added a commit that referenced this pull request Apr 19, 2024
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.

TypeError: string indices must be integers, not 'str'
2 participants