title: Error - ValueError: invalid literal for int() with base 10: ' '
body: <p>I am making an online game using the sockets module and pygame in python.</p>
  
  <pre><code>def read_pos(str):
      if str is not None:
          string = str.split(",")
          return int(string[0]), int(string[1])
      else:
          pass
  
  def make_pos(tup):
      return str(tup[0]) + "," + str(tup[1])
  
  
  def redrawWindow(win,player, player2):
      win.fill((255,255,255))
      player.draw(win)
      player2.draw(win)
      pygame.display.update()
  
  
  def main():
      run = True
      n = Network()
      startPos = read_pos(n.getPos())
      p = Player(startPos[0],startPos[1],100,100,(0,255,0))
      p2 = Player(0,0,100,100,(255,0,0))
      clock = pygame.time.Clock()
  
      while run:
          clock.tick(60)
          p2Pos = read_pos(n.send(make_pos((p.x, p.y))))
          p2.x = p2Pos[0]
          p2.y = p2Pos[1]
          p2.update()
  </code></pre>
  
  <p>This is the code I'm using in my client. in my server, the code is as follows</p>
  
  <pre><code>def convertPos(str):
      if str is not None:
          str = str.split(",")
          return int(str[0]), int(str[1])
      else:
          pass
  
  def make_pos(tup):
      return str(tup[0]) + "," + str(tup[1])
  
  
  pos = [(0,0),(100,100)]
  
  
  def threaded_client(conn,player):
      conn.send(str.encode(make_pos(pos[player])))
      reply = " "
      while True:
          try:
              data = conn.recv(2048).decode()
              pos[player] = data
  
              if not data:
                  print("Disconnected")
                  break
              else:
                  if player == 1:
                      reply = (pos[0])
                  else:
                      reply = (pos[1])
                  print("Received: ", data)
                  print("Sending : ", reply)
  
              conn.sendall(str.encode(make_pos(reply)))
          except:
              break
  
      print("Lost connection")
      conn.close()
  </code></pre>
  
  <p>I am getting the error of <code>ValueError: invalid literal for int() with base 10: ' '.</code></p>
  
  <p>Can someone tell me why this is happening? The value of <code>str</code> in the function of <code>convertPos()</code> is coming in as a tuple which I am converting into a string and after that into an integer.</p>