title: TypeError: a bytes-like object is required, not 'str' for Python Code
body: <p>I get this when I try to run a code called NUT_check.py and this comes from line 69. I'm very unsure of what is happening as I didn't make this code myself, nor have I really used Python extensively. Line 69 is ending with a line of hyphens to mark it</p>
  
  <pre><code>import sys
  import struct
  from struct import pack
  import os
  from util import *
  import string
  import math
  
  nut = open(sys.argv[1], "rb+")
  
  NTWU = readu32be(nut)
  Version = readu16be(nut)
  fileTotal = readu16be(nut)
  nut.seek(0x10)
  paddingFix = 0
  for i in range(fileTotal):
      if i &gt; 0:
              paddingFix = paddingFix + headerSize
      fullSize = readu32be(nut)
      nut.seek(4,1)
      size = readu32be(nut)
      headerSize = readu16be(nut)
      nut.seek(2,1)
      mipsFlag = readu16be(nut)
      gfxFormat = readu16be(nut)
      if NTWU == 0x4E545755:
              width = readu16be(nut)
              height = readu16be(nut)
      if NTWU == 0x4E545033:
              width2 = readByte(nut)
              width1 = readByte(nut)
              height2 = readByte(nut)
              height1 = readByte(nut)
      numOfMips = readu32be(nut)
      nut.seek(4,1)
      offset1 = (readu32be(nut) + 16)
      offset2 = (readu32be(nut) + 16)
      offset3 = (readu32be(nut) + 16)
      nut.seek(4,1)
      if headerSize == 0x60:
              size1 = readu32be(nut)
              nut.seek(12,1)
      if headerSize == 0x70:
              size1 = readu32be(nut)
              nut.seek(0x1C,1)
      if headerSize == 0x80:
              size1 = readu32be(nut)
              nut.seek(0x2C,1)
      if headerSize == 0x90:
              size1 = readu32be(nut)
              nut.seek(0x3C,1)
      eXt = readu32be(nut)
      nut.seek(12,1)
      GIDX = readu32be(nut)
      nut.seek(6,1)
      skinNum = readByte(nut)
      fileNum = readByte(nut)
      nut.seek(4,1)
      print("Slot Number %i Texture id %s,%i has %i mipmaps. Format is %i" % (skinNum/4,hex(fileNum),fileNum,mipsFlag,gfxFormat))
      if i == 0:
              offsetHeader = offset3
      if i &gt; 0:
              offset1 += paddingFix
              offsetHeader += 0x80
      backNTime = nut.tell()
      nut.seek(offsetHeader)
      fileStr = ("%d"  % fileNum)
      outfile = open("Convert" + "/" + fileStr + ".gtx", "wb")
      outfile.write("\x47\x66\x78\x32\x00\x00\x00\x20\x00\x00\x00\x07\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x42\x4C\x4B\x7B\x00\x00\x00\x20\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x0B\x00\x00\x00\x9C\x00\x00\x00\x00\x00\x00\x00\x00") ----------------------------------------------
      outfile.write(nut.read(0x80))
      outfile.write("\x00\x00\x00\x01\x00\x01\x02\x03\x1F\xF8\x7F\x21\xC4\x00\x03\xFF\x06\x88\x80\x00\x00\x00\x00\x0A\x80\x00\x00\x10\x42\x4C\x4B\x7B\x00\x00\x00\x20\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x0C\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00")
      outfile.seek(0x50)
      outfile.write(struct.pack("&gt;I",1))
      outfile.seek(0xf0)
      outfile.write(struct.pack("&gt;I",size))
      outfile.seek(8,1)
      nut.seek(offset1)
      outfile.write(nut.read(size))
      outfile.write("\x42\x4C\x4B\x7B\x00\x00\x00\x20\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00")
      outfile.close()
      nut.seek(backNTime)
  nut.close()
  </code></pre>