Fix AttributeError in calcHydrophobic from nested select() call #2197
+2
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
calcHydrophobic()crashes withAttributeError: Selection object has no attribute 'strip'when a Selection object is passed to.select()instead of a string.Root Cause
Line 1508 contains a nested
.select()call that passes a Selection object as an argument:The inner
sele2.select()returns a Selection object, but.select()expects a string argument.Changes
.select()call on line 1508 to pass the string directly, matching the pattern on line 1505:*.npyto.gitignoreto prevent test artifacts from being committedWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
files.rcsb.org/usr/bin/python3 python3(dns block)ftp.wwpdb.org/usr/bin/python3 python3(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>AttributeError: Selection object has no attribute
stripand 'strip' is not a valid selection string</issue_title><issue_description>
Description of the bug.
When I tried to calculate the protein interaction for the pdb file 4i77 in the following way, I encountered the following error: "AttributeError: Selection object has no attribute strip and 'strip' is not a valid selection string."
After checking the logs, I found that there seems to be a duplicate select operation, and the select method is expected to receive a string type. I suspect this might be an accidental coding mistake, and removing the redundant select step allows the process to complete normally. Since this is my first time using ProDy, I am not very sure if this modification is correct.
ProDy/prody/proteins/interactions.py
Line 1508 in 79c6641
Do you have any error messages or logs?
What is your setup?
First test at My MacBook
Then test at My Ubuntu Server
How did you install ProDy?
Installed by
uv add prodywith version 2.6.1.What ...
stripand 'strip' is not a valid selection string #2188💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.