title: Retrieving data of generator object for file listing from FTP.mlsd()
body: <p><a href="https://docs.python.org/3.5/library/ftplib.html#ftplib.FTP.mlsd" rel="nofollow noreferrer">Python documentation for FTP.mlsd()</a> says that it returns a generator object yielding a tuple. Upon running the following code, I get the address of that object. At this point, I assume that I have successfully received the list from my server as it doesn't pop any error (Please correct me if the assumption is wrong).</p>
  
  <p>The answer to <a href="https://stackoverflow.com/q/2419770/5460216">this question</a> suggests that I should use <code>next()</code> to get the values in the object. But, upon doing so it shows the error saying <code>ftplib.error_perm: 501 Option not understood.</code></p>
  
  <blockquote>
    <p>Code</p>
  </blockquote>
  
  <pre><code>from ftplib import FTP
  ftp = FTP('192.168.0.104')
  ftp.login('testing','testing')
  ftp.cwd('FTP_Test_Site')
  
  temp = ftp.mlsd(path="", facts=["type", "size", "perm"])
  print(temp)
  print(next(temp))
  
  ftp.quit()
  </code></pre>
  
  <blockquote>
    <p>Output</p>
  </blockquote>
  
  <pre><code>&lt;generator object FTP.mlsd at 0x7f46f9438518&gt;
  Traceback (most recent call last):
    File "BackUp.py", line 18, in &lt;module&gt;
      print(next(temp))
    File "/usr/lib/python3.5/ftplib.py", line 589, in mlsd
      self.sendcmd("OPTS MLST " + ";".join(facts) + ";")
    File "/usr/lib/python3.5/ftplib.py", line 272, in sendcmd
      return self.getresp()
    File "/usr/lib/python3.5/ftplib.py", line 245, in getresp
      raise error_perm(resp)
  ftplib.error_perm: 501 Option not understood.
  </code></pre>
  
  <p>Any idea about where am I going wrong?</p>