Opened 2 years ago
Closed 2 years ago
#124 closed defect (invalid)
Small bug in docs
Reported by: | ftputiluser | Owned by: | schwa |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Library | Version: | |
Keywords: | Cc: |
Description (last modified by )
The very first sample code on the site seems to contain an error: https://ftputil.sschwarzer.net/trac/wiki/Documentation#introduction
with ftp_host.open("index.html", "rb") as source: with ftp_host.open("newdir/index.html", "wb") as target: ftp_host.copyfileobj(source, target) # similar to shutil.copyfileobj
Unless I'm mistaken and my working code is doing something it should not, that should be "with open( ... as source", as a local file, and with "ftp_host.open( ... as target" for the remove file. That is, you're opening the local file as a regular Python file object, not as an ftputil remote object.
Change History (5)
comment:1 Changed 2 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 2 years ago by
Status: | new → assigned |
---|
comment:3 Changed 2 years ago by
My apologies -- somehow I missed the remote file in the comments. Please allow me to hang my head in shame and slink out, while offering thanks for your time and intelligence.
comment:4 Changed 2 years ago by
Now, now, it's fine. We all make mistakes. :-)
I do appreciate that you entered a ticket about a documentation bug! Not many people do this. Of course it's possible that a bug isn't really a bug, but naturally you don't know this in advance. So relax and keep entering such tickets. :-)
comment:5 Changed 2 years ago by
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
Closing this as "invalid" because it's not actually a mistake.
It should be possible to copy a remote file to another remote location, as in the example code. Remote files support reading and writing. So I think the code is intentional as it is.
When you say
what did you try and in which way did it fail?