Skip to content

Commit 1a3c7d1

Browse files
committed
Python 3 fix: uniprot_auto
1 parent 6e321d6 commit 1a3c7d1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: uniprot_features.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ def uniprot_auto(pdb_id, selection='', withss=0, quiet=1):
167167
from urllib.request import urlopen
168168

169169
if len(pdb_id) != 4 or not pdb_id[0].isdigit():
170-
print(' Error: invalid pdb_id:', pdb_id)
171-
raise CmdException
170+
raise CmdException('invalid pdb_id: ' + pdb_id)
172171

173172
if not selection:
174173
selection = pdb_id
@@ -183,6 +182,8 @@ def uniprot_auto(pdb_id, selection='', withss=0, quiet=1):
183182

184183
try:
185184
for line in urlopen(url):
185+
if not isinstance(line, str):
186+
line = line.decode('utf-8')
186187
if not line.startswith(pdb_id):
187188
continue
188189

@@ -202,8 +203,7 @@ def uniprot_auto(pdb_id, selection='', withss=0, quiet=1):
202203

203204
mappings[chain][1][int(number)] = resno
204205
except Exception as e:
205-
print(' Error:', e)
206-
raise CmdException
206+
raise CmdException(str(e))
207207

208208
for chain, (acc, sm) in mappings.items():
209209
uniprot_features(acc, '(%s) and chain %s' % (selection, chain),

0 commit comments

Comments
 (0)