title: Font file loaded from temp file seems incorrect
body: <pre><code>for key in fnt.keys():
  
      str1 = base64.b64decode(fnt[key])
      strA = XOR(str1, coder)
  
      temp = tempfile.TemporaryFile()
      temp.seek(0)
      temp.write(strA)
      temp.seek(0)
  
      if key == "calibri.ttf":
          FONT = temp
      if key == "calibrib.ttf":
          FONTB = temp
          temp.close()
  return (FONT, FONTB)
  </code></pre>
  
  <p>In the above code I have retrieved fonts saved as a string in a dictionary. When I use this code it returns an error - RuntimeError: Can't seek in stream.
  With the code below it works perfectly. Someone please explain how to use the temp file method to get the fonts rather than write to file. Is that possible?</p>
  
  <pre><code>for key in fnt.keys():
  
      str1 = base64.b64decode(fnt[key])
      strA = XOR(str1, coder)
  
      with open(home + "\\" + key, "wb") as to_disk:
          to_disk.write(strA)
          FONT = "calibri.ttf"
          FONTB = "calibrib.ttf"
  
  return (FONT, FONTB)
  </code></pre>
  
  <p>I am adding the full code below. See if this helps in giving me a viable answer.</p>
  
  <pre><code>import string
  import base64
  import os
  from fnt import fnt
  import string
  import tempfile
  from itertools import cycle, izip
  
  def XOR(message, key):
      cryptedMessage = ''.join(chr(ord(c)^ord(k)) for c,k in izip(message, cycle(key)))
  
      return cryptedMessage
  
  #----------------------------------------------------------------------
  def main():
      """extracts and returns the font files from fnt.py"""
      coder ="PHdzDER+@k7pcm!LX8gufh=y9A^UaMsn-oW6"
      home = os.getcwd()
      for key in fnt.keys():
  
          str1 = base64.b64decode(fnt[key])
          strA = XOR(str1, coder)
  
          #temp = tempfile.TemporaryFile()
          #temp.seek(0)
          #temp.write(strA)
          #temp.seek(0)
  
  
          #if key == "calibri.ttf":
              #FONT = temp
  
          #if key == "calibrib.ttf":
              #FONTB = temp
  
  
          with open(home + "\\" + key, "wb") as to_disk:
              to_disk.write(strA)
              FONT = "calibri.ttf"
              FONTB = "calibrib.ttf"
  
      return (FONT, FONTB)
  
  if __name__=='__main__':
      main()
  </code></pre>