omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Help with FTP

    Pythonista
    3
    7
    4245
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • TQA
      TQA last edited by

      I want to read lines from a text document. But I can't seem to get the FTP connection working..

      from ftplib import FTP
      ftp=FTP('ftp.mydomain.com')
      ftp.login('username','password')
      ftp.retrlines('LIST')
      

      I know this will list the directories.

      1 Reply Last reply Reply Quote 0
      • dvader9
        dvader9 last edited by

        I haven't tested this myself, but seeing that you're using the same lines given as an example on the ftplib documentation site, I noticed that you forgot the parentheses for the prot_p() call. You need this to explicitly secure the connection. I'd give that a shot...

        1 Reply Last reply Reply Quote 0
        • TQA
          TQA last edited by

          @dvader9: I have those in my program. was a typo when I wrote this post.

          1 Reply Last reply Reply Quote 0
          • dvader9
            dvader9 last edited by

            Are you sure your server accepts TLS connections, as opposed to FTP over SSH (SFTP)?
            What error message do you get?

            1 Reply Last reply Reply Quote 0
            • TQA
              TQA last edited by

              I do not get any error messages.. just appears to by idle. Doesnt move on through the program. Sorry for short responses, as I am on my phone.

              1 Reply Last reply Reply Quote 0
              • TQA
                TQA last edited by

                Am I using anything wrong? I pretty much copied the example program..

                EDIT: Trying it again I get "error_perm: 500 AUTH not understood"

                EDIT: Sorry for the edits! It seems to be working now..? I switched to just FTP. Is it possible to read/write to a specific file via FTP?

                1 Reply Last reply Reply Quote 0
                • ccc
                  ccc last edited by

                  If you do a Google search on python ftplib example, near the top of the results, you will see two hits from effbot and from pythonforbeginners that read and write files.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Powered by NodeBB Forums | Contributors