title: TypeError: write() argument must be str, not int - error continues to appear
body: <p>I am in the process of making a text-based game where the player has to escape an old manor. It seems that every time the program gets to the starting room &quot;R1&quot; in this case, I get an error.</p>
  <p>Here is the code:</p>
  <pre><code>import winsound
  import random
  import sys
  import time
  
  
  # Slowtype function
  
  
  def HandleSounds(SoundToPlay, kplaying):
      if SoundToPlay == 'No':
          return
      else:
          sound2Play = f&quot;./sounds/{SoundToPlay}&quot;
          if kplaying:
              winsound.PlaySound(sound2Play, winsound.SND_ALIAS | winsound.SND_ASYNC)
          else:
              winsound.PlaySound(sound2Play, winsound.SND_ALIAS | winsound.SND_ASYNC)
  
  
  
  def slow_type(t, speed):
  
      HandleSounds(&quot;Typing.wav&quot;, True)
  
      for l in t:
          sys.stdout.write(l)
          sys.stdout.flush()
          time.sleep(.1)
          time.sleep(random.random() * 10.0 / speed)
      winsound.PlaySound(None, winsound.SND_ALIAS)
      print('')
  
  
  
  # loadMap contains the long descriptions which tell the player where they are and what directions/ actions they have. It also contains the actual map.
  # The sound file being played using the playsound module seems to play first before the program runs, just throwing that out there.
  
  
  
  def loadMap():
      slow_type(&quot;Welcome poor lost soul.&quot;, mediumText)
  
      slow_type(&quot;It seems you have been trapped on the grounds of an old estate which has been left to rot and decay within the sands of time.&quot;, mediumText)
  
      slow_type(&quot;You have 13 hours to escape, unlock the doors, solve the puzzles and find your way out.&quot;, mediumText)
  
      slow_type(&quot;Escape or die trying, the choice is yours.&quot;, mediumText)
  
      slow_type(&quot;May the gods be with you...&quot;, mediumText)
  
      R1ld = (&quot;I am in the Parlor, how did I end up in this place? &quot;, mediumText)
  
      (&quot;Available directions are east.&quot;, mediumText)
  
      R2ld = (&quot;R2 - I am currently in the Grand Library, it seems these books haven't been touched in ages. &quot;, mediumText)
  
      (&quot;Available directions are north or south.&quot;, mediumText)
  
      R3ld = (&quot;R3 - I made it to the study. There is old paper everywhere. &quot;, mediumText)
  
      (&quot;Available directions are west or north.&quot;, mediumText)
  
      R4ld = (&quot;R4 -Ah, the old servants quarters. There is an odd looking pedestal in the far corner of the room. &quot;, mediumText)
  
      (&quot;Move the dials or leave the room: &quot;, mediumText)
  
      (&quot;Available directions are east or west&quot;, mediumText)
  
      R5ld = (&quot;R5 - I am in the kitchen, it reeks of food, a century past its expiration date. &quot;, mediumText)
  
      (&quot;Available directions are west or north&quot;, mediumText)
  
      R6ld = (&quot;R6 - This is just a sitting room, There is an odd contraption on the wall. &quot;, mediumText)
  
      (&quot;Available directions are west or south. &quot;, mediumText)
  
      (&quot;Enter the time of moonrise and sunset: &quot;, mediumText)
  
      S7ld = (&quot;R7 - You are now on the second story. &quot;, mediumText)
  
      (&quot;Available directions are west or north&quot;, mediumText)
  
      H8ld = (&quot;Proceed down the hallway or go down a level? &quot;, mediumText)
  
      (&quot;Available directions are north or south.&quot;, mediumText)
  
      R9ld = (&quot;You proceeded down the hall to the bathroom. &quot;, mediumText)
  
      (&quot;Available directions are east or south.&quot;, mediumText)
  
      R10ld = (&quot;Turn around and go into the hall? &quot;, mediumText)
  
      (&quot;There's a code written on the wall, it reads as follows: 1874 &quot;, mediumText)
  
      (&quot;Available directions are east or west.&quot;, mediumText)
  
      R11ld = (&quot;You went back into the hall and entered the Porcelain Doll room. The dolls won't stop blinking. &quot;, mediumText)
  
      (&quot;Available directions are east or west.&quot;, mediumText)
  
      R12ld = (&quot;You exited the Porcelain Doll room and entered the Funeral Parlor/Dining Room. &quot;, mediumText)
  
      (&quot;Available directions are east or west.&quot;, mediumText)
  
      R13ld = (&quot;You left the Funeral Parlor and proceeded to the Laundry Room. &quot;, mediumText)
  
      (&quot;Available directions are south or west.&quot;, mediumText)
  
      R14ld = (&quot;You entered the Storage Room. &quot;, mediumText)
  
      (&quot;Available directions are south or north.&quot;, mediumText)
  
      E15ld = (&quot;Exit the Storage Room? &quot;, mediumText)
  
      (&quot;Available directions are east or west.&quot;, mediumText)
  
      R16ld = (&quot;You exited the Storage Room. &quot;, mediumText)
  
      (&quot;Available directions are  south or north.&quot;, mediumText)
  
      S17ld = (&quot;Go upstairs to the Third Floor? &quot;, mediumText)
  
      (&quot;Available directions are south or east.&quot;, mediumText)
  
      H18ld = (&quot;You went upstairs, you now find yourself on the Third Floor. &quot;, mediumText)
      (&quot;Available directions are north or west.&quot;, mediumText)
  
      R19ld = (&quot;Proceed down the hallway? &quot;, mediumText)
  
      (&quot;Available directions are south and west.&quot;, mediumText)
  
      R20ld = (&quot;You proceeded down the hall, the stench of mildew is overwhelming. &quot;, mediumText)
  
      (&quot;Available directions are north or west.&quot;, mediumText)
  
      R21ld = (&quot;You decided to enter the first bedroom, It reeks of rot and mildew. &quot;, mediumText)
  
      (&quot;Your available directions are south and east.&quot;, mediumText)
  
      R22ld = (&quot;You exited the first bedroom and entered the second bedroom. &quot;, mediumText)
      (&quot;You wrote down a weird combination etched into the plaster of the wall. &quot;, mediumText)
  
      (&quot;Right 1 time (dial 1), Left 3 times (dial 2), Left 2 times (dial 3), Right 4 times (Dial 4). &quot;, mediumText)
  
      (&quot;(Hint: Try this combination at the pedestal in the Servants Quarters.) &quot;, mediumText)
  
      (&quot;Available directions are south or north.&quot;, mediumText)
  
      E23ld = (&quot;Exit the Room? &quot;, mediumText)
      (&quot;Available directions are north or west.&quot;, mediumText)
  
      H24ld = (&quot;You decided to exit the room and headed back into the hallway. &quot;, mediumText)
      (&quot;Available directions are south or east.&quot;, mediumText)
  
      R25ld = (&quot;Enter the Guest Bedroom? &quot;, mediumText)
  
      (&quot;Available directions are south or east&quot;, mediumText)
  
      R26ld = (&quot;You decided the enter the Guest Bedroom, nothing to see here. &quot;, mediumText)
      (&quot;Just old dusty furniture, not worth sitting on. &quot;, mediumText)
  
      (&quot;Available directions are south or north.&quot;, mediumText)
  
      R27ld = (&quot;You left the guest bedroom and proceeded down the hall to the Painting Gallery. &quot;, mediumText)
      (&quot;Available directions are south or east&quot;, mediumText)
  
      R28ld = (&quot;You left the Painting Gallery and entered an Empty Bedroom. &quot;, mediumText)
      (&quot; The room is empty, Aside from a set of numbers. &quot;, mediumText)
  
      (&quot;The numbers represent the moonrise time and the time of sunset: 11:27, 6:12. &quot;, mediumText)
  
      (&quot;These numbers could be a clue to the weird lock contraption in the sitting room on the main floor. &quot;, mediumText)
  
      (&quot;You can go either north or east.&quot;, mediumText)
  
      S29ld = (&quot;Go upstairs? &quot;, mediumText)
      (&quot;Available directions are south or west.&quot;, mediumText)
  
      H30ld = (&quot;You are now in the 4th floor hallway. You can go north or west.&quot;, mediumText)
  
      R31ld = (&quot;You left the hallway and entered the first room you could open. &quot;, mediumText)
      (&quot;You entered the Sitting Room, Maybe you should take a rest. &quot;, mediumText)
  
      (&quot;You can go either east or west.&quot;, mediumText)
  
      R32ld = (&quot;You left the confines of the Sitting Room and entered the Smoking Room. &quot;, mediumText)
      (&quot;It smells like old cigars.&quot;, mediumText)
  
      (&quot;You can go south or east&quot;, mediumText)
  
      R33ld = (&quot;You left the Smoking Room and entered the Game Room&quot;, mediumText)
      (&quot; You can go either south or west.&quot;, mediumText)
  
      R34ld = (&quot;You left the Game Room and opened the Master Bedroom. &quot;, mediumText)
      (&quot;There is another weird puzzle&quot;, mediumText)
  
      (&quot;Your available directions are south or east. &quot;, mediumText)
  
      R35ld = (&quot;You left the Master Bedroom and entered the Balcony. The moon is full. &quot;, mediumText)
      (&quot;Directions are south &amp; east.&quot;, mediumText)
  
      R36ld = (&quot;You left the Balcony and went back to the Parlor. &quot;, mediumText)
      (&quot;You can now leave the manor, proceed? &quot;, mediumText)
  
      (&quot;Please enter the code to escape: &quot;, mediumText)
  
  
  
      # Manor Floor plan
      manorMap = {&quot;R1&quot;: {&quot;LocDesc&quot;: R1ld, &quot;e&quot;: &quot;R2&quot;, &quot;w&quot;: &quot;No&quot;, &quot;n&quot;: &quot;No&quot;, &quot;s&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;, &quot;count&quot;: 0},
  
                  &quot;R2&quot;: {&quot;LocDesc&quot;: R2ld, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;No&quot;, &quot;n&quot;: &quot;R1&quot;, &quot;s&quot;: &quot;R3&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;count&quot;: 0, &quot;lock&quot;: &quot;No&quot;},
  
                  &quot;R3&quot;: {&quot;LocDesc&quot;: R3ld, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;R2&quot;, &quot;n&quot;: &quot;R4&quot;, &quot;s&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                         &quot;count&quot;: 0},
  
                  &quot;R4&quot;: {&quot;LocDesc&quot;: R4ld, &quot;e&quot;: &quot;R5&quot;, &quot;w&quot;: &quot;R3&quot;, &quot;n&quot;: &quot;No&quot;, &quot;s&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;Rewire&quot;,
                         &quot;solution&quot;: &quot;Rewire&quot;, &quot;lock&quot;: &quot;No&quot;,
                         &quot;count&quot;: 0},
  
                  &quot;R5&quot;: {&quot;LocDesc&quot;: R5ld, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;R4&quot;, &quot;n&quot;: &quot;R6&quot;, &quot;s&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;,
                         &quot;lock&quot;: &quot;No&quot;,
                         &quot;count&quot;: 0},
  
                  &quot;R6&quot;: {&quot;LocDesc&quot;: R6ld, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;R5&quot;, &quot;n&quot;: &quot;No&quot;, &quot;s&quot;: &quot;R7&quot;, &quot;Lock&quot;: &quot;The Sun &amp; The Moon&quot;,
                         &quot;Puzzle&quot;: &quot;No&quot;, &quot;count&quot;: 0},
  
                  &quot;R7&quot;: {&quot;LocDesc&quot;: S7ld, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;R6&quot;, &quot;n&quot;: &quot;R8&quot;, &quot;s&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                         &quot;count&quot;: 0},
  
                  &quot;R8&quot;: {&quot;LocDesc&quot;: H8ld, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;No&quot;, &quot;n&quot;: &quot;R9&quot;, &quot;s&quot;: &quot;R7&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                         &quot;count&quot;: 0},
  
                  &quot;R9&quot;: {&quot;LocDesc&quot;: R9ld, &quot;e&quot;: &quot;R10&quot;, &quot;w&quot;: &quot;No&quot;, &quot;s&quot;: &quot;R8&quot;, &quot;n&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                         &quot;count&quot;: 0},
  
                  &quot;R10&quot;: {&quot;LocDesc&quot;: R10ld, &quot;e&quot;: &quot;R11&quot;, &quot;w&quot;: &quot;R9&quot;, &quot;s&quot;: &quot;No&quot;, &quot;n&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R11&quot;: {&quot;LocDesc&quot;: R11ld, &quot;e&quot;: &quot;R12&quot;, &quot;w&quot;: &quot;R10&quot;, &quot;s&quot;: &quot;No&quot;, &quot;n&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R12&quot;: {&quot;LocDesc&quot;: R12ld, &quot;e&quot;: &quot;R13&quot;, &quot;w&quot;: &quot;R11&quot;, &quot;s&quot;: &quot;No&quot;, &quot;n&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R13&quot;: {&quot;LocDesc&quot;: R13ld, &quot;s&quot;: &quot;R12&quot;, &quot;n&quot;: &quot;No&quot;, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;R14&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R14&quot;: {&quot;LocDesc&quot;: R14ld, &quot;s&quot;: &quot;R15&quot;, &quot;n&quot;: &quot;R13&quot;, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R15&quot;: {&quot;LocDesc&quot;: E15ld, &quot;s&quot;: &quot;No&quot;, &quot;n&quot;: &quot;No&quot;, &quot;e&quot;: &quot;R14&quot;, &quot;w&quot;: &quot;R16&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R16&quot;: {&quot;LocDesc&quot;: R16ld, &quot;s&quot;: &quot;R15&quot;, &quot;n&quot;: &quot;R17&quot;, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R17&quot;: {&quot;LocDesc&quot;: S17ld, &quot;s&quot;: &quot;R16&quot;, &quot;n&quot;: &quot;No&quot;, &quot;e&quot;: &quot;R18&quot;, &quot;w&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R18&quot;: {&quot;LocDesc&quot;: H18ld, &quot;s&quot;: &quot;No&quot;, &quot;n&quot;: &quot;R17&quot;, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;R19&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R19&quot;: {&quot;LocDesc&quot;: R19ld, &quot;s&quot;: &quot;R20&quot;, &quot;n&quot;: &quot;No&quot;, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;R18&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R20&quot;: {&quot;LocDesc&quot;: R20ld, &quot;s&quot;: &quot;No&quot;, &quot;n&quot;: &quot;R19&quot;, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;R21&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R21&quot;: {&quot;LocDesc&quot;: R21ld, &quot;s&quot;: &quot;R22&quot;, &quot;n&quot;: &quot;No&quot;, &quot;e&quot;: &quot;R20&quot;, &quot;w&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R22&quot;: {&quot;LocDesc&quot;: R22ld, &quot;s&quot;: &quot;R23&quot;, &quot;n&quot;: &quot;R21&quot;, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;E23&quot;: {&quot;LocDesc&quot;: E23ld, &quot;s&quot;: &quot;No&quot;, &quot;n&quot;: &quot;R22&quot;, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;R24&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R24&quot;: {&quot;LocDesc&quot;: H24ld, &quot;s&quot;: &quot;R25&quot;, &quot;n&quot;: &quot;No&quot;, &quot;e&quot;: &quot;R23&quot;, &quot;w&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R25&quot;: {&quot;LocDesc&quot;: R25ld, &quot;s&quot;: &quot;R24&quot;, &quot;n&quot;: &quot;No&quot;, &quot;e&quot;: &quot;R26&quot;, &quot;w&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R26&quot;: {&quot;LocDesc&quot;: R26ld, &quot;s&quot;: &quot;R27&quot;, &quot;n&quot;: &quot;R25&quot;, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R27&quot;: {&quot;LocDesc&quot;: R27ld, &quot;s&quot;: &quot;R28&quot;, &quot;n&quot;: &quot;No&quot;, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;R26&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R28&quot;: {&quot;LocDesc&quot;: R28ld, &quot;s&quot;: &quot;No&quot;, &quot;n&quot;: &quot;R27&quot;, &quot;e&quot;: &quot;R29&quot;, &quot;w&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R29&quot;: {&quot;LocDesc&quot;: S29ld, &quot;s&quot;: &quot;R28&quot;, &quot;n&quot;: &quot;No&quot;, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;R30&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R30&quot;: {&quot;LocDesc&quot;: H30ld, &quot;s&quot;: &quot;No&quot;, &quot;n&quot;: &quot;R31&quot;, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;R29&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R31&quot;: {&quot;LocDesc&quot;: R31ld, &quot;s&quot;: &quot;No&quot;, &quot;n&quot;: &quot;No&quot;, &quot;e&quot;: &quot;R32&quot;, &quot;w&quot;: &quot;R30&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R32&quot;: {&quot;LocDesc&quot;: R32ld, &quot;s&quot;: &quot;R33&quot;, &quot;n&quot;: &quot;No&quot;, &quot;e&quot;: &quot;R31&quot;, &quot;w&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R33&quot;: {&quot;LocDesc&quot;: R33ld, &quot;s&quot;: &quot;R34&quot;, &quot;n&quot;: &quot;No&quot;, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;R32&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R34&quot;: {&quot;LocDesc&quot;: R34ld, &quot;s&quot;: &quot;R35&quot;, &quot;n&quot;: &quot;No&quot;, &quot;e&quot;: &quot;R33&quot;, &quot;w&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R35&quot;: {&quot;LocDesc&quot;: R35ld, &quot;s&quot;: &quot;R36&quot;, &quot;n&quot;: &quot;No&quot;, &quot;e&quot;: &quot;R34&quot;, &quot;w&quot;: &quot;No&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0},
  
                  &quot;R36&quot;: {&quot;LocDesc&quot;: R36ld, &quot;s&quot;: &quot;No&quot;, &quot;n&quot;: &quot;R1&quot;, &quot;e&quot;: &quot;No&quot;, &quot;w&quot;: &quot;R35&quot;, &quot;puzzle&quot;: &quot;No&quot;, &quot;lock&quot;: &quot;No&quot;,
                          &quot;count&quot;: 0}}
  
      return manorMap
  
  
  def checkDirection(direction, currLock):
      LowerD = direction.casefold()
      newSpot = currLock.get(LowerD)
  
      # print(newSpot)
      if newSpot != &quot;No&quot;:
  
          return newSpot
  
      else:
  
          return None
  
  
  
  slowText = 60
  mediumText = 200
  fastText = 300
  superSlowText = 25
  
  
  
  maplist = loadMap()
  
  startLoc = &quot;R1&quot;
  
  prePlayerLoc = startLoc
  
  playerLoc = startLoc
  
  keepPlaying = True
  
  
  '''def HandleLock1():
      if solvePuzzle == &quot;R36&quot; and input(prompt).isnumeric() == &quot;1874&quot;:
  
          if input(prompt) == &quot;1874&quot;:
              print(&quot;You Escaped, congratulations! (type q to exit.)&quot;)
  
      if solvePuzzle == &quot;R6&quot; and input(prompt).isnumeric() == &quot;11:27, 6:12&quot;:
  
          if input(prompt) == &quot;11:27&quot; &quot;6:12&quot;:
              print(&quot;password accepted&quot;)'''
  
  
  
  '''def HandlePuzzle2():
      if solvePuzzle == &quot;R34&quot; and input(prompt).islower() == &quot;eternity&quot;:
  
          if input(prompt) == &quot;eternity&quot;:
              print(&quot;Password excepted.&quot;)
  
      if solvePuzzle == &quot;R4&quot; and input(prompt).isupper() == &quot;Right , Left , Left, Right&quot;:
  
          if input(prompt) == &quot;Right , Left , Left, Right&quot;:
              print(&quot;Puzzle Complete!&quot;)'''
  
  
  
  while keepPlaying:
  
      currLoc = maplist.get(playerLoc)
  
      lockName = currLoc.get(&quot;lock&quot;)
  
      puzzleName = currLoc.get(&quot;puzzle&quot;)
  
      currLoc[&quot;count&quot;] += 1
  
      print(f&quot;Lock : {lockName} and Puzzle : {puzzleName}&quot;)
  
      '''HandleSounds(&quot;rain_thunder.mp3&quot;, True)'''
  
      slow_type(currLoc.get('LocDesc'), mediumText)
  
      prompt = &quot;\n&quot; + &quot;Lost Soul&quot; + &quot;, What will be your next action? : &quot; + &quot;, Make your choice wisely: &quot;
  
      playerAction = input(prompt)
  
      prevPlayerLoc = currLoc
  
      if playerAction.lower() == &quot;q&quot;:
          keepPlaying = False
  
      else:
  
          newLoc = checkDirection(playerAction.lower(), currLoc)
  
          if playerLoc is not None:
  
              playerLoc = newLoc
  
          else:
              print(&quot;This action cannot be completed! Carry on!&quot;)
  </code></pre>
  <p>The error is display as follows:</p>
  <p>Traceback (most recent call last):</p>
  <pre><code>File &quot;D:/Colin Lewis/Manor_Escape/ManorEscape.py&quot;, line 410, in &lt;module&gt;
      slow_type(currLoc.get('LocDesc'), mediumText)
    File &quot;D:/Colin Lewis/Manor_Escape/ManorEscape.py&quot;, line 34, in slow_type
      sys.stdout.write(l)
  TypeError: write() argument must be str, not int 
  </code></pre>
  <p>How can I fix this error?</p>