title: Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?
body: <p>I am getting an interesting error while trying to use <code>Unpickler.load()</code>, here is the source code:</p>
  
  <pre><code>open(target, 'a').close()
  scores = {};
  with open(target, "rb") as file:
      unpickler = pickle.Unpickler(file);
      scores = unpickler.load();
      if not isinstance(scores, dict):
          scores = {};
  </code></pre>
  
  <p>Here is the traceback:</p>
  
  <pre><code>Traceback (most recent call last):
  File "G:\python\pendu\user_test.py", line 3, in &lt;module&gt;:
      save_user_points("Magix", 30);
  File "G:\python\pendu\user.py", line 22, in save_user_points:
      scores = unpickler.load();
  EOFError: Ran out of input
  </code></pre>
  
  <p>The file I am trying to read is empty.
  How can I avoid getting this error, and get an empty variable instead?</p>