title: EOFError in Python script
body: <p>I have  the following code fragment:</p>
  
  <pre><code>def database(self):
      databasename=""
      host=""
      user=""
      password=""
      try:
          self.fp=file("detailing.dat","rb")
      except IOError:
          self.fp=file("detailing.dat","wb")
          pickle.dump([databasename,host,user,password],self.fp,-1)
          self.fp.close()
          selffp=file("detailing.dat","rb")
          [databasename,host,user,password]=pickle.load(self.fp)
  
      return
  </code></pre>
  
  <p>It has the error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "detailing.py", line 91, in ?
      app=myApp()
    File "detailing.py", line 20, in __init__
      wx.App.__init__(self,redirect,filename,useBestVisual,clearSigInt)
    File "/usr/lib64/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", line 7473, in __init__
      self._BootstrapApp()
    File "/usr/lib64/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", line 7125, in _BootstrapApp
      return _core_.PyApp__BootstrapApp(*args, **kwargs)
    File "detailing.py", line 33, in OnInit
      self.database()
    File "detailing.py", line 87, in database
      [databasename,host,user,password]=pickle.load(self.fp)
    File "/usr/lib64/python2.4/pickle.py", line 1390, in load
      return Unpickler(file).load()
    File "/usr/lib64/python2.4/pickle.py", line 872, in load
      dispatch[key](self)
    File "/usr/lib64/python2.4/pickle.py", line 894, in load_eof
      raise EOFError
  EOFError
  </code></pre>
  
  <p>What am I doing wrong?</p>