title: TypeError: sequence item 0: expected a bytes-like object, str found
body: <p>I am trying to extract Indonesia titles from a wiki titles dump that's in a text file using word2vec-gensim in Python 3. The wiki dump contains titles in other languages also and some symbols. Below is my code:</p>
  
  <pre><code>    if len(sys.argv) != 3: 
      namaFileInput = "idwiki-latest-pages-articles.xml.bz2"
      namaFileOutput = "wiki.id.case.text"
      sys.exit(1)
  inp, outp = sys.argv[1:3]
  space = " "
  i = 0
  
  output = open(namaFileOutput, 'w')
  
  # lower=False: huruf kecil dan besar dibedakan
  wiki = WikiCorpus(namaFileInput, lemmatize=False, dictionary={}, lower=False)
  for text in wiki.get_texts():
      if six.PY3:
          output.write(b' '.join(text).encode('utf-8') + '\n')
      else:
          output.write(space.join(text) + "\n")
      i = i + 1
      if i % 10000 == 0:
          logger.info("Saved " + str(i) + " articles")
  
  output.close()
  logger.info("Finished Saved " + str(i) + " articles")
  </code></pre>
  
  <p>But I am getting and error:</p>
  
  <pre><code>    TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-17-d4c686a9093a&gt; in &lt;module&gt;
       29 for text in wiki.get_texts():
       30     if six.PY3:
  ---&gt; 31         output.write(b' '.join(text).encode('utf-8') + '\n')
       32     else:
       33         output.write(space.join(text) + "\n")
  
  TypeError: sequence item 0: expected a bytes-like object, str found
  </code></pre>
  
  <p>I have searched online but could not succeed. Any help will be appreciated.</p>