Visitar URL original
Update ftplib.rst documentation by pinguin999 · Pull Request #11023 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20260217194002/https://github.com/python/cpython/pull/11023
Skip to content
/ cpython Public

Update ftplib.rst documentation#11023

Closed
pinguin999 wants to merge 2 commits intopython:masterfrom
pinguin999:patch-2
Closed

Update ftplib.rst documentation#11023
pinguin999 wants to merge 2 commits intopython:masterfrom
pinguin999:patch-2

Conversation

@pinguin999
Copy link

Update docs for FTP lib

The docs only showed how to download a file via FTP but not how to upload a file.

Now the docs have an example for download and upload files via ftp.

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for your contribution, we look forward to reviewing it!

drwxr-xr-x 3 1176 1176 4096 Oct 10 2012 tools
'226 Directory send OK.'
>>> ftp.retrbinary('RETR README', open('README', 'wb').write)
>>> ftp.retrbinary('RETR README', open('README', 'wb').write) # Download the file README

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pinguin999, thanks for improving the documentation!

It seems to me that the file you open here is not closed before doing the upload next line. Shouldn't you close it before opening it again and reading from it?

Maybe we should use context managers here, after all, it probably isn't great to encourage beginners to keep their files open.

@JulienPalard
Copy link
Member

Hi @pinguin999, thanks for trying to enhance the documentation. IIRC this has already been proposed (can't find where though), and was refused because it make the example unrealistic (a user have a high chance not having the rights to write on ftp.debian.org).

I think the example is enough demoing the lib, it's short and readable, I don't think we need to add every ftplib function in it. And the storbinary is documented a few lines after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review docs Documentation in the Doc dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants