title: Can any one help me understand and solve this error?
body: <p>I would like to plot a distribution of <code>alpha-cabon</code> to <code>nitrogen</code> bond distances of ubiquitin protein. So I downloaded the <a href="http://rcsb.org/pdb/download/downloadFile.do?fileFormat=pdb&amp;compression=NO&amp;structureId=1UBQ" rel="nofollow">1UBQ.pdb from RCSB website</a>. Now using <code>biopython</code>, I am trying to find the distances between all <code>alpha-cabon(CA)</code> to <code>nitrogen(N)</code> bonds. </p>
  
  <p>I have tried doing a code like below:</p>
  
  <pre><code>import sys
  #from Bio.PDB import *
  from Bio.PDB.PDBParser import PDBParser 
  from numpy import loadtxt
  
  pdb1 ='/home/devanandt/Documents/VMD/1UBQ.pdb'
  sys.stdout = open('file_ubq', 'w')
  parser=PDBParser(PERMISSIVE=1)
  
  #file=open('1UBQ.pdb','r')
  #header_dict=parse_pdb_header(file)
  #file.close()
  i=1
  structure = parser.get_structure('1UBQ',pdb1)
  for model in structure:
      for chain in model:
          for residue in chain:
              for atom in residue:
                  model = structure[0] 
                  chain = model['A'] 
                  residue_1 = chain[i] 
                  atom_1 = residue_1['N'] 
                  atom_2 = residue_1['CA'] 
                  distance = atom_1-atom_2 
                  #print atom.get_vector(),atom.name,distance
                  print distance
                  i=i+1
  
  #lines = loadtxt("file_ubq")
  </code></pre>
  
  <p>And I got the output in the file 'file_ubq' like below:</p>
  
  <pre><code>1.47369
  1.4966
  1.47547
  1.51187
  1.44885
  1.50423
  1.47052
  1.48006
  1.50265
  .
  .
  .
  .
  1.48417
  1.47194
  1.45661
  1.47023
  </code></pre>
  
  <p>But alongside this, I got error too like as below:</p>
  
  <pre><code>    return self.child_dict[id]
  KeyError: (' ', 77, ' ')
  
  ----------------------------------------------
  Program exited successfully with errcode (1)
  Press the Enter key to close this terminal ... 
  EXECUTING:
  /home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py 
  ----------------------------------------------
  Traceback (most recent call last):
    File "/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py", line 38, in &lt;module&gt;
      residue_1 = chain[i] 
    File "/usr/lib/pymodules/python2.7/Bio/PDB/Chain.py", line 67, in __getitem__
      return Entity.__getitem__(self, id)
    File "/usr/lib/pymodules/python2.7/Bio/PDB/Entity.py", line 38, in __getitem__
      return self.child_dict[id]
  KeyError: (' ', 77, ' ')
  
  ----------------------------------------------
  Program exited successfully with errcode (1)
  Press the Enter key to close this terminal ... 
  
  EXECUTING:
  /home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py 
  ----------------------------------------------
  Traceback (most recent call last):
    File "/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py", line 38, in &lt;module&gt;
      residue_1 = chain[i] 
    File "/usr/lib/pymodules/python2.7/Bio/PDB/Chain.py", line 67, in __getitem__
      return Entity.__getitem__(self, id)
    File "/usr/lib/pymodules/python2.7/Bio/PDB/Entity.py", line 38, in __getitem__
      return self.child_dict[id]
  KeyError: (' ', 77, ' ')
  
  ----------------------------------------------
  Program exited successfully with errcode (1)
  Press the Enter key to close this terminal ... 
  ^CEXECUTING:
  /home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py 
  ----------------------------------------------
  Traceback (most recent call last):
    File "/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py", line 38, in &lt;module&gt;
      residue_1 = chain[i] 
    File "/usr/lib/pymodules/python2.7/Bio/PDB/Chain.py", line 67, in __getitem__
      return Entity.__getitem__(self, id)
    File "/usr/lib/pymodules/python2.7/Bio/PDB/Entity.py", line 38, in __getitem__
      return self.child_dict[id]
  KeyError: (' ', 77, ' ')
  
  ----------------------------------------------
  Program exited successfully with errcode (1)
  Press the Enter key to close this terminal ... 
  EXECUTING:
  /home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py 
  ----------------------------------------------
  Traceback (most recent call last):
    File "/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py", line 38, in &lt;module&gt;
      residue_1 = chain[i] 
    File "/usr/lib/pymodules/python2.7/Bio/PDB/Chain.py", line 67, in __getitem__
      return Entity.__getitem__(self, id)
    File "/usr/lib/pymodules/python2.7/Bio/PDB/Entity.py", line 38, in __getitem__
      return self.child_dict[id]
  KeyError: (' ', 77, ' ')
  
  ----------------------------------------------
  Program exited successfully with errcode (1)
  Press the Enter key to close this terminal ... 
  
  EXECUTING:
  /home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py 
  ----------------------------------------------
  Traceback (most recent call last):
    File "/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py", line 38, in &lt;module&gt;
      residue_1 = chain[i] 
    File "/usr/lib/pymodules/python2.7/Bio/PDB/Chain.py", line 67, in __getitem__
      return Entity.__getitem__(self, id)
    File "/usr/lib/pymodules/python2.7/Bio/PDB/Entity.py", line 38, in __getitem__
      return self.child_dict[id]
  KeyError: (' ', 77, ' ')
  
  ----------------------------------------------
  Program exited successfully with errcode (1)
  Press the Enter key to close this terminal ... 
  
  EXECUTING:
  /home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py 
  ----------------------------------------------
  Traceback (most recent call last):
    File "/home/devanandt/Documents/PYTHON/ubq/src/ubq_dist_pdf.py", line 38, in &lt;module&gt;
      residue_1 = chain[i] 
    File "/usr/lib/pymodules/python2.7/Bio/PDB/Chain.py", line 67, in __getitem__
      return Entity.__getitem__(self, id)
    File "/usr/lib/pymodules/python2.7/Bio/PDB/Entity.py", line 38, in __getitem__
      return self.child_dict[id]
  KeyError: (' ', 77, ' ')
  
  ----------------------------------------------
  Program exited successfully with errcode (1)
  Press the Enter key to close this terminal ... 
  </code></pre>
  
  <p>Can any one help me understand and solve this error?</p>