[Rich sent me his credentials via a private email.]

As soon as I tried FTP to Rich's server, I recognized the problem. The
server is using Pure-FTPd, which reuses SSL connections. The Python library
has a bug
<https://stackoverflow.com/questions/46633536/getting-a-oserror-when-trying-to-list-ftp-directories-in-python/53456626>
that prevents this. WeeWX V4.1.0 and greater have a workaround for the bug.
To activate, add option reuse_ssl and set it to true.

    [[FTP]]
        ...
        reuse_ssl = True

See if that helps.

-tk

On Mon, Jan 18, 2021 at 9:39 AM Rich Strle <[email protected]> wrote:

> Status: Resolving address of www.cliffandbuster.com
> Status: Connecting to 107.180.51.77:21...
> Status: Connection established, waiting for welcome message...
> Status: Initializing TLS...
> Status: Verifying certificate...
> Status: TLS connection established.
> Status: Logged in
> Status: Retrieving directory listing of "/"...
> Status: Directory listing of "/" successful
> Status: Resolving address of www.cliffandbuster.com
> Status: Connecting to 107.180.51.77:21...
> Status: Connection established, waiting for welcome message...
> Status: Initializing TLS...
> Status: Verifying certificate...
> Status: TLS connection established.
> Status: Logged in
> Status: Starting upload of /var/www/html/weewx/image.jpg
> Status: File transfer successful, transferred 49,150 bytes in 1 second
> Status: Retrieving directory listing of "/"...
> Status: Directory listing of "/" successful
>
> I disconnected and reconnected. Does filezilla trust the site now so we're
> not seeing all of the connection comments?
>
> On Monday, January 18, 2021 at 10:37:24 AM UTC-6 [email protected] wrote:
>
>> That's pretty much what I'm thinking, but I'm trying to get the evidence
>> from Filezilla. It should say that as it negotiates with the server.
>>
>> FTP is 40 year old technology. It's amazing that there are still so many
>> incompatible versions out there.
>>
>> On Mon, Jan 18, 2021 at 8:34 AM Les Niles <[email protected]> wrote:
>>
>>> The server is responding to the PASV command by entering extended
>>> passive mode EPSV, which apparently is a legal response but which
>>> weewx/ftplib is not handling correctly. (I don’t have access to the code
>>> right now so can’t be more precise about where to fix.) The difference is
>>> that in EPSV mode the server doesn’t return an IP, just a port number. (The
>>> line “host, port = self.makepasv()” is not going to work.)
>>>
>>> Apparently passive mode has been the default for ftplib since python
>>> 2.1, so maybe just skip trying to change to PASV entirely?
>>>
>>>   -Les
>>>
>>>
>>> On Jan 18, 2021, at 7:21 AM, Rich Strle <[email protected]> wrote:
>>>
>>> 
>>> Command: TYPE I
>>> Trace: CFtpControlSocket::OnReceive()
>>> Response: 200 TYPE is now 8-bit binary
>>> Trace: CFtpRawTransferOpData::ParseResponse() in state 1
>>> Trace: CControlSocket::SendNextCommand()
>>> Trace: CFtpRawTransferOpData::Send() in state 2
>>> Command: PASV
>>> Trace: CFtpControlSocket::OnReceive()
>>> Response: 200 TYPE is now 8-bit binary
>>> Trace: CFtpRawTransferOpData::ParseResponse() in state 1
>>> Trace: CControlSocket::SendNextCommand()
>>> Trace: CFtpRawTransferOpData::Send() in state 2
>>> Command: PASV
>>> Trace: CFtpControlSocket::OnReceive()
>>> Response: 227 Entering Passive Mode (107,180,51,77,196,142)
>>> Trace: CFtpRawTransferOpData::ParseResponse() in state 2
>>> Trace: CControlSocket::SendNextCommand()
>>> Trace: CFtpRawTransferOpData::Send() in state 4
>>> Trace: Binding data connection source IP to control connection source
>>> IP 192.168.12.117
>>> Command: STOR yearbarometer.png
>>> Trace: CTransferSocket::OnConnect
>>> Trace: CTlsSocketImpl::Handshake()
>>> Trace: Trying to resume existing TLS session.
>>> Trace: CTlsSocketImpl::ContinueHandshake()
>>> Trace: CFtpControlSocket::OnReceive()
>>> Response: 227 Entering Passive Mode (107,180,51,77,197,217)
>>> Trace: CFtpRawTransferOpData::ParseResponse() in state 2
>>> Trace: CControlSocket::SendNextCommand()
>>> Trace: CFtpRawTransferOpData::Send() in state 4
>>> Trace: Binding data connection source IP to control connection source
>>> IP 192.168.12.117
>>> Command: STOR yearhilow.png
>>>
>>> On Monday, January 18, 2021 at 7:16:26 AM UTC-6 [email protected] wrote:
>>>
>>>> Good to hear that Filezilla is working. We can use it to understand
>>>> what the server is doing.
>>>>
>>>> Using Filezilla, go into its "Settings" (under the "Edit" menu). Then
>>>> the "Debug" tab. There's a drop down list of message levels. Default is "0
>>>> - None". Set it to "3- Verbose". Then click "OK".
>>>>
>>>> [image: image.png]
>>>>
>>>> Then use Filezilla again to transfer some files. This time, watch the
>>>> window at top that tells you what Filezilla is doing. See if the client
>>>> (Filezilla, in this case) is negotiating with the server. Tell us what you
>>>> see, or, better, copy and paste it into a post.
>>>>
>>>>
>>>>
>>>> On Sun, Jan 17, 2021 at 7:33 PM Rich Strle <[email protected]> wrote:
>>>>
>>>>> Jan 17 21:30:44 pi-weather weewx[429] ERROR weeutil.ftpupload: Failed
>>>>> uploading /var/www/html/weewx/yearradiation.png to server
>>>>> www.cliffandbuster.com. Reason: '229 Extended Passive Mode Entered
>>>>> (|||50458|)'
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>> ftpgenerator: (2): caught exception '<class 'ftplib.error_reply'>': 229
>>>>> Extended Passive Mode Entered (|||50458|)
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****  Traceback (most recent call last):
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****    File "/usr/share/weewx/weewx/reportengine.py", line 331, in run
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****      n = ftp_data.run()
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****    File "/usr/share/weewx/weeutil/ftpupload.py", line 163, in run
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****      ftp_server.storbinary(stor_cmd, fd)
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****    File "/usr/lib/python3.7/ftplib.py", line 504, in storbinary
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****      with self.transfercmd(cmd, rest) as conn:
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****    File "/usr/lib/python3.7/ftplib.py", line 399, in transfercmd
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****      return self.ntransfercmd(cmd, rest)[0]
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****    File "/usr/lib/python3.7/ftplib.py", line 359, in ntransfercmd
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****      host, port = self.makepasv()
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****    File "/usr/lib/python3.7/ftplib.py", line 337, in makepasv
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****      host, port = parse227(self.sendcmd('PASV'))
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****    File "/usr/lib/python3.7/ftplib.py", line 845, in parse227
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****      raise error_reply(resp)
>>>>> Jan 17 21:30:45 pi-weather weewx[429] ERROR weewx.reportengine:
>>>>>  ****  ftplib.error_reply: 229 Extended Passive Mode Entered (|||50458|)
>>>>> Jan 17 21:30:45 pi-weather weewx[429] DEBUG weewx.reportengine: Report
>>>>> 'RSYNC' not enabled. Skipping.
>>>>>
>>>>>
>>>>> On Sunday, January 17, 2021 at 9:28:38 PM UTC-6 Rich Strle wrote:
>>>>>
>>>>>> I installed FileZilla and was able to use the same user name and
>>>>>> password to upload files from /var/www/html/weewx/ to the same spot on my
>>>>>> webserver. I did get an error message Hostname does not match certificate
>>>>>> but I've gotten that before...
>>>>>>
>>>>>> On Sunday, January 17, 2021 at 7:24:45 PM UTC-6 [email protected]
>>>>>> wrote:
>>>>>>
>>>>>>> Can you FTP using Filezilla? The goal here is to see if it's some
>>>>>>> firewall / network/ provider issue, or a problem peculiar to the Python 
>>>>>>> FTP
>>>>>>> library.
>>>>>>>
>>>>>>> On Sun, Jan 17, 2021 at 10:04 AM Rich Strle <[email protected]> wrote:
>>>>>>>
>>>>>>>> My bad, the ftp in whew still doesn't work. The Access Point only
>>>>>>>> has an IPv6 number listed, it doesn't have an IPv4 number listed. My
>>>>>>>> website provider only allows 1 sftp account at the root level and I was
>>>>>>>> trying to avoid using that.
>>>>>>>>
>>>>>>>> On Sunday, January 17, 2021 at 11:41:18 AM UTC-6 Rich Strle wrote:
>>>>>>>>
>>>>>>>>> I spoke with t-mobile again. They didn't say they did anything but
>>>>>>>>> all of a sudden ftp started working. I will continue to monitor.
>>>>>>>>>
>>>>>>>>> On Sunday, January 17, 2021 at 10:50:19 AM UTC-6 galfert wrote:
>>>>>>>>>
>>>>>>>>>> Anyone care to google "T-Mobile FTP" ???? You'll see that this is
>>>>>>>>>> an issue for everyone! My recommendation is to try to instead use 
>>>>>>>>>> SFTP.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Sunday, January 17, 2021 at 11:41:25 AM UTC-5 Rich Strle wrote:
>>>>>>>>>>
>>>>>>>>>>> I did as instructed. Attached is the log file after I made the
>>>>>>>>>>> change. I have a call into my provider to see if they are IPV6.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Sunday, January 17, 2021 at 10:17:33 AM UTC-6
>>>>>>>>>>> [email protected] wrote:
>>>>>>>>>>>
>>>>>>>>>>>> You definitely want passive mode (passive=1).
>>>>>>>>>>>>
>>>>>>>>>>>> Two things:
>>>>>>>>>>>>
>>>>>>>>>>>> 1. By any chance, is your new provider using IPV6 (instead of
>>>>>>>>>>>> the traditional IPV4)?
>>>>>>>>>>>>
>>>>>>>>>>>> 2. Set debug=2 in weewx.conf, then retry. This will put lots of
>>>>>>>>>>>> information in the log about what FTP is doing.
>>>>>>>>>>>>
>>>>>>>>>>>> -tk
>>>>>>>>>>>>
>>>>>>>>>>>> On Sun, Jan 17, 2021 at 7:46 AM Rich Strle <[email protected]>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks for your response David but that didn't fix my issue.
>>>>>>>>>>>>>
>>>>>>>>>>>>> It was set at 1. I stopped the weewx process, set the ftp to
>>>>>>>>>>>>> 0, restarted weewx and it did not help. I changed it back to 1.
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Sunday, January 17, 2021 at 6:21:02 AM UTC-6
>>>>>>>>>>>>> [email protected] wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Check out http://weewx.com/docs/usersguide.htm#config_FTP and
>>>>>>>>>>>>>> look to add/adjust the passive setting in your weewx.conf config.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> David
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Saturday, January 16, 2021 at 10:11:56 PM UTC-5 Rich Strle
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I changed out my internet provider to t-mobile home internet
>>>>>>>>>>>>>>> service and now I'm getting ftp errors. I tried connecting to 
>>>>>>>>>>>>>>> the ftp from
>>>>>>>>>>>>>>> another computer and that worked. When my raspberry pi tries to 
>>>>>>>>>>>>>>> connect I
>>>>>>>>>>>>>>> get errors. This was working fine before I switched providers. 
>>>>>>>>>>>>>>> Any ideas?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Jan 16 21:01:25 pi-weather weewx[30706] DEBUG
>>>>>>>>>>>>>>> weeutil.ftpupload: Attempting connection to
>>>>>>>>>>>>>>> www.cliffandbuster.com
>>>>>>>>>>>>>>> Jan 16 21:01:26 pi-weather weewx[30706] DEBUG
>>>>>>>>>>>>>>> weeutil.ftpupload: Connected to www.cliffandbuster.com
>>>>>>>>>>>>>>> Jan 16 21:01:26 pi-weather weewx[30706] ERROR
>>>>>>>>>>>>>>> weeutil.ftpupload: Failed uploading 
>>>>>>>>>>>>>>> /var/www/html/weewx/seasons.css to
>>>>>>>>>>>>>>> server www.cliffandbuster.com. Reason: '229 Extended
>>>>>>>>>>>>>>> Passive Mode Entered (|||50207|)'
>>>>>>>>>>>>>>> Jan 16 21:01:27 pi-weather weewx[30706] ERROR
>>>>>>>>>>>>>>> weewx.reportengine: ftpgenerator: (1): caught exception '<class
>>>>>>>>>>>>>>> 'ftplib.error_reply'>': 229 Extended Passive Mode Entered 
>>>>>>>>>>>>>>> (|||50207|)
>>>>>>>>>>>>>>> Jan 16 21:01:27 pi-weather weewx[30706] ERROR
>>>>>>>>>>>>>>> weewx.reportengine:         ****  Traceback (most recent call 
>>>>>>>>>>>>>>> last):
>>>>>>>>>>>>>>> Jan 16 21:01:27 pi-weather weewx[30706] ERROR
>>>>>>>>>>>>>>> weewx.reportengine:         ****    File
>>>>>>>>>>>>>>> "/usr/share/weewx/weewx/reportengine.py", line 331, in run
>>>>>>>>>>>>>>> Jan 16 21:01:27 pi-weather weewx[30706] ERROR
>>>>>>>>>>>>>>> weewx.reportengine:         ****      n = ftp_data.run()
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>>>> Google Groups "weewx-user" group.
>>>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from
>>>>>>>>>>>>> it, send an email to [email protected].
>>>>>>>>>>>>> To view this discussion on the web visit
>>>>>>>>>>>>> https://groups.google.com/d/msgid/weewx-user/ba3b1d83-b48b-4578-b7a5-85b3fe2e4fden%40googlegroups.com
>>>>>>>>>>>>> <https://groups.google.com/d/msgid/weewx-user/ba3b1d83-b48b-4578-b7a5-85b3fe2e4fden%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>>>>>> .
>>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "weewx-user" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>> send an email to [email protected].
>>>>>>>>
>>>>>>> To view this discussion on the web visit
>>>>>>>> https://groups.google.com/d/msgid/weewx-user/08999a97-41a4-4436-b59d-2f8793532fb6n%40googlegroups.com
>>>>>>>> <https://groups.google.com/d/msgid/weewx-user/08999a97-41a4-4436-b59d-2f8793532fb6n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "weewx-user" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>>
>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/weewx-user/74ddbc8e-2a66-4ff4-b7d0-712939105d15n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/weewx-user/74ddbc8e-2a66-4ff4-b7d0-712939105d15n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "weewx-user" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/weewx-user/7915453a-fa1a-4aa1-b04b-2e102626c35bn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/weewx-user/7915453a-fa1a-4aa1-b04b-2e102626c35bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "weewx-user" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/weewx-user/E07ACE72-CDA3-47AB-9C4B-FDA3293777C6%40gmail.com
>>> <https://groups.google.com/d/msgid/weewx-user/E07ACE72-CDA3-47AB-9C4B-FDA3293777C6%40gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/2bc3700f-0a95-4fa4-904f-d5f974159befn%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/2bc3700f-0a95-4fa4-904f-d5f974159befn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEAPdHuPM7BPmytPq5JPoB1JsuQY_PEHAuTqEWw41pKdQQ%40mail.gmail.com.

Reply via email to