title: How to fix twint error "CRITICAL:root:twint.get:User:replace() argument 2 must be str, not None"
body: <p>I'm trying to use the twint module to get some information from twitter, in particular the bio. The code example works just fine:</p>
  
  <pre><code>import twint
  
  c = twint.Config()
  c.Username = "twitter"
  
  twint.run.Lookup(c)
  </code></pre>
  
  <p>yields</p>
  
  <pre><code>783214 | Twitter | @Twitter | Private: 0 | Verified: 1 | Bio: What’s happening?! | Location: Everywhere | Url: https://about.twitter.com/ | Joined: 20 Feb 2007 6:35 AM | Tweets: 10816 | Following: 140 | Followers: 56328970 | Likes: 5960 | Media: 1932 | Avatar: https://pbs.twimg.com/profile_images/1111729635610382336/_65QFl7B_400x400.png
  </code></pre>
  
  <p>Thing is, I only need the bio data. According to the site, you can use</p>
  
  <pre><code>c.Format = 'bio: {bio}'
  </code></pre>
  
  <p>Unfortunately, this yields</p>
  
  <pre><code>CRITICAL:root:twint.get:User:replace() argument 2 must be str, not None
  </code></pre>
  
  <p>I think this may be due to the following code line (from <a href="https://github.com/twintproject/twint/blob/master/twint/format.py" rel="nofollow noreferrer">here</a>):</p>
  
  <pre><code>output += output.replace("{bio}", u.bio)
  </code></pre>
  
  <p>Where the u.bio value is assigned <a href="https://github.com/twintproject/twint/blob/master/twint/user.py" rel="nofollow noreferrer">here</a>:</p>
  
  <pre><code>u.bio = card(ur, "bio")
  </code></pre>
  
  <p>The card function does the following when our type is "bio":</p>
  
  <pre><code>if _type == "bio":
      try:
          ret = ur.find("p", "ProfileHeaderCard-bio u-dir").text.replace("\n", " ")
      except:
          ret = None
  </code></pre>
  
  <p>I think the problem may lie in the second part, where a value is assigned to u.bio, either not even being called or returning None for some reason. Unfortunately, I do not know how to fix that or call the function. </p>
  
  <p>I've had a similar problem before with a different function, twint.run.Following(c), but was able to solve it by not setting c.User_full = true</p>
  
  <p>Could anyone help me out?</p>