Open itaneja2 opened 4 years ago
I think it is easier to only test the value that changed:
if nsmall[i] <= 0:
Thanks for catching this.
@intendo -- what happened to the PR to fix this?
Sorry, I made the change from if nsmall <= 0:
to if nsmall[i] <= 0:
in main since it was just a simple logic error.
Great! I'm closing this.
As far as I can see, this is still an issue. I just cloned main git clone https://Electrostatics/apbs
and ran cd apbs/tools/manip; python psize.py ~/my.pdb
and got
Traceback (most recent call last):
File "/home/robin/external/apbs/tools/manip/psize.py", line 541, in <module>
main()
File "/home/robin/external/apbs/tools/manip/psize.py", line 530, in main
psize.runPsize(filename)
File "/home/robin/external/apbs/tools/manip/psize.py", line 289, in runPsize
self.set_all()
File "/home/robin/external/apbs/tools/manip/psize.py", line 233, in set_all
self.setSmallest(n)
File "/home/robin/external/apbs/tools/manip/psize.py", line 174, in setSmallest
if nsmall <= 0:
TypeError: '<=' not supported between instances of 'list' and 'int'
My guess is that you have another psize.py (/home/robin/external/apbs/tools/manip/psize.py) in your path because line 174 of psize.py should be if nsmall[i] <= 0:
What directory did you clone apbs into?
What OS and version of Python are you using?
(base) robin@robin-VirtualBox:~ $ conda create --name snakemake
(base) robin@robin-VirtualBox:~ $ conda activate snakemake
(snakemake) robin@robin-VirtualBox:~ $ mkdir repro
(snakemake) robin@robin-VirtualBox:~ $ cd repro/
(snakemake) robin@robin-VirtualBox:~/repro $ git clone https://github.com/Electrostatics/apbs
Cloning into 'apbs'...
remote: Enumerating objects: 11077, done.
remote: Counting objects: 100% (2539/2539), done.
remote: Compressing objects: 100% (1620/1620), done.
remote: Total 11077 (delta 1403), reused 1936 (delta 893), pack-reused 8538
Receiving objects: 100% (11077/11077), 68.38 MiB | 25.75 MiB/s, done.
Resolving deltas: 100% (6553/6553), done.
(snakemake) robin@robin-VirtualBox:~/repro $ cd apbs/tools/manip/
(snakemake) robin@robin-VirtualBox:~/repro/apbs/tools/manip [master] $ sed -n '174p' psize.py
if nsmall <= 0:
# Os version:
(snakemake) robin@robin-VirtualBox:~/repro/apbs/tools/manip [master] $ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
But also in the git repo I can find this line: https://github.com/Electrostatics/apbs/blob/34fd2bbacb84e1289490fe746ba0cc7553a23ce2/tools/manip/psize.py#L174
@nsoblath can you add this to your list of issues when you work on the code base again?
The fix is to change line 174 of psize.py from if nsmall <= 0:
to if nsmall[i] <= 0:
.
At line 175, a list is compared to an integer. This is ok to do in python2, but not 3:
To fix the issue, consider replacing line 175 with:
if any([val <= 0 for val in nsmall]):