value error

Francesco Pietra chiendarret at gmail.com
Thu Apr 23 10:59:31 EDT 2009


hi:
with script

data = open('134-176_rectified_edited.pdb', 'r')
outp = open('134-176_renumbered.pdb', 'w')

for L in data:
   if L[3] == 'M':
     L = L[:24] + "%4d" % (int(L[24-28])+133) + L[28:]
   outp.write(L)


i wanted to modify lines of the type:
ATOM      1 HH31 ACE     1       1.573   1.961   0.769  1.00  0.00           H

to add 133 to column 25, getting 134 there, and so on for next lines 2
-> 135, 3 -> 136, etc.


i must have heavily messed things because the file was not even read:

$ python renumber.py 134-176_rectified.pdb
Traceback (most recent call last):
  File "renumber.py", line 6, in <module>
    L = L[:24] + "%4d" % (int(L[24-28])+133) + L[28:]
ValueError: invalid literal for int() with base 10: ''



thanks for having an expert look

chiendarret



More information about the Python-list mailing list