Stephen,

Not looking at the code, but shouldn't there be some prefix to these paths?
Nobody is going to let you write to root (/).

> *put* 'MKD /\r\n'
> *put* 'STOR /yearrain.png\r\n'
> *put* 'MKD /font\r\n'
> *put* 'MKD /font\r\n'
> *put* 'MKD /font\r\n'

Regards,
\Leon
--
Leon Shaner :: Dearborn, Michigan (iPad)

> On May 11, 2020, at 1:30 PM, Stephen <[email protected]> wrote:
> 
> 
> 
> Hi
> 
> My WeeWX installation is failing to upload files to my website.  I'm using 
> FTPS and from the logs it looks like the connection to the server is made OK 
> but things go wrong as soon as the first file transfer is attempted.  Using 
> an ftp client I can connect manually and write files successfully using FTPS. 
>  The debug output and logs below are from running wee_reports but it also 
> fails when running as a daemon.
> 
> There is another error when it tries to make the directory /font on the 
> server but I suspect that is a consequence of the earlier failure. At the 
> start the "MKD /" command behaves as expected. In addition there appears to 
> be a problem with the exception handling.
> 
> This is a fresh install using apt-get on Ubuntu 19.10 but I have had the same 
> problem with WeeWX 3.9.2 on Ubuntu 16.04 LTS. Python is version 3.7.5.
> 
> Can anyone help?
> 
> Thanks
> 
> Stephen
> 
> ------------------
> wee_reports output
> ------------------
> Using configuration file /etc/weewx/weewx.conf
> Generating for all time
> *get* '220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------\n'
> *get* '220-You are user number 1 of 50 allowed.\n'
> *get* '220-Local time is now 22:49. Server port: 21.\n'
> *get* '220-This is a private system - No anonymous login\n'
> *get* '220-IPv6 connections are also welcome on this server.\n'
> *get* '220 You will be disconnected after 15 minutes of inactivity.\n'
> *resp* '220---------- Welcome to Pure-FTPd [privsep] [TLS] 
> ----------\n220-You are user number 1 of 50 allowed.\n220-Local time is now 
> 22:49. Server port: 21.\n220-This is a private system - No anonymous 
> login\n220-IPv6 connections are also welcome on this server.\n220 You will be 
> disconnected after 15 minutes of inactivity.'
> *cmd* 'AUTH TLS'
> *put* 'AUTH TLS\r\n'
> *get* '234 AUTH TLS OK.\n'
> *resp* '234 AUTH TLS OK.'
> *cmd* 'USER [email protected]'
> *put* 'USER [email protected]\r\n'
> *get* '331 User [email protected] OK. Password required\n'
> *resp* '331 User [email protected] OK. Password required'
> *cmd* 'PASS ************'
> *put* 'PASS ************\r\n'
> *get* '230 OK. Current restricted directory is /\n'
> *resp* '230 OK. Current restricted directory is /'
> *cmd* 'PBSZ 0'
> *put* 'PBSZ 0\r\n'
> *get* '200 PBSZ=0\n'
> *resp* '200 PBSZ=0'
> *cmd* 'PROT P'
> *put* 'PROT P\r\n'
> *get* '200 Data protection level set to "private"\n'
> *resp* '200 Data protection level set to "private"'
> *cmd* 'MKD /'
> *put* 'MKD /\r\n'
> *get* "550 Can't create directory: File exists\n"
> *resp* "550 Can't create directory: File exists"
> *cmd* 'TYPE I'
> *put* 'TYPE I\r\n'
> *get* '200 TYPE is now 8-bit binary\n'
> *resp* '200 TYPE is now 8-bit binary'
> *cmd* 'PASV'
> *put* 'PASV\r\n'
> *get* '227 Entering Passive Mode (185,24,98,215,210,73)\n'
> *resp* '227 Entering Passive Mode (185,24,98,215,210,73)'
> *cmd* 'STOR /yearrain.png'
> *put* 'STOR /yearrain.png\r\n'
> *get* '150 Accepted data connection\n'
> *resp* '150 Accepted data connection'
> *cmd* 'TYPE I'
> *put* 'TYPE I\r\n'
> *get* ''
> 
> repeats last three lines > 200 times
> 
> *cmd* 'TYPE I'
> *put* 'TYPE I\r\n'
> *get* ''
> *cmd* 'MKD /font'
> *put* 'MKD /font\r\n'
> *get* ''
> *cmd* 'MKD /font'
> *put* 'MKD /font\r\n'
> *get* ''
> *cmd* 'MKD /font'
> *put* 'MKD /font\r\n'
> *get* ''
> *cmd* 'QUIT'
> *put* 'QUIT\r\n'
> *get* ''
> 
> -----------
> Log extract
> -----------
> May 11 17:15:13 localhost wee_reports[17945] DEBUG weewx.reportengine: 
> Running report 'FTP'
> May 11 17:15:13 localhost wee_reports[17945] DEBUG weewx.reportengine: Found 
> configuration file /etc/weewx/skins/Ftp/skin.conf for report 'FTP'
> May 11 17:15:13 localhost wee_reports[17945] DEBUG weeutil.ftpupload: 
> Attempting secure connection to server.myhost.net
> May 11 17:15:13 localhost wee_reports[17945] DEBUG weeutil.ftpupload: Secure 
> data connection to server.myhost.net
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Attempt 
> #1. Failed uploading /yearrain.png to server.myhost.net. Reason: [Errno 0] 
> Error
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Attempt 
> #2. Failed uploading /yearrain.png to server.myhost.net. Reason: 
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Attempt 
> #3. Failed uploading /yearrain.png to server.myhost.net. Reason: 
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Failed 
> to upload file /yearrain.png
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Attempt 
> #1. Failed uploading /seasons.css to server.myhost.net. Reason: 
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Attempt 
> #2. Failed uploading /seasons.css to server.myhost.net. Reason: 
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Attempt 
> #3. Failed uploading /seasons.css to server.myhost.net. Reason: 
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Failed 
> to upload file /seasons.css
> 
> repeats for >60 files
> 
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Attempt 
> #1. Failed uploading /monthwind.png to server.myhost.net. Reason: 
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Attempt 
> #2. Failed uploading /monthwind.png to server.myhost.net. Reason: 
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Attempt 
> #3. Failed uploading /monthwind.png to server.myhost.net. Reason: 
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Failed 
> to upload file /monthwind.png
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Got 
> error while attempting to make remote directory /font
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload:      
> ****  Error: 
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Got 
> error while attempting to make remote directory /font
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload:      
> ****  Error: 
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Got 
> error while attempting to make remote directory /font
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload:      
> ****  Error: 
> May 11 17:15:13 localhost wee_reports[17945] ERROR weeutil.ftpupload: Unable 
> to create remote directory /font
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine: Caught 
> unrecoverable exception in generator 'weewx.reportengine.FtpGenerator'
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****  catching classes that do not inherit from BaseException is not allowed
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****  Traceback (most recent call last):
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****    File "/usr/share/weewx/weewx/reportengine.py", line 326, in run
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****      n = ftp_data.run()
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****    File "/usr/share/weewx/weeutil/ftpupload.py", line 145, in run
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****      self._make_remote_dir(ftp_server, remote_dir_path)
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****    File "/usr/share/weewx/weeutil/ftpupload.py", line 242, in 
> _make_remote_dir
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****      raise IOError("Unable to create remote directory %s" % 
> remote_dir_path)
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****  OSError: Unable to create remote directory /font
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****  
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****  During handling of the above exception, another exception occurred:
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****  
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****  Traceback (most recent call last):
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****    File "/usr/share/weewx/weewx/reportengine.py", line 197, in run
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****      obj.start()
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****    File "/usr/share/weewx/weewx/reportengine.py", line 280, in start
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****      self.run()
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****    File "/usr/share/weewx/weewx/reportengine.py", line 327, in run
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****      except (socket.timeout, socket.gaierror, ftplib.all_errors, 
> IOError) as e:
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****  TypeError: catching classes that do not inherit from BaseException is 
> not allowed
> May 11 17:15:13 localhost wee_reports[17945] ERROR weewx.reportengine:        
>  ****  Generator terminated
> 
> ---------------------
> Configuration extract
> ---------------------
>     [[FTP]]
>         # FTP'ing the results to a webserver is treated as just another 
> report,
>         # albeit one with an unusual report generator!
>         skin = Ftp
>         
>         # If you wish to use FTP, set "enable" to "true", then
>         # fill out the next four lines.
>         # Use quotes around passwords to guard against parsing errors.
>         enable = true
>         user = XXX obfuscated by wee_debug XXX
>         password = XXX obfuscated by wee_debug XXX
>         server = server.myhost.net
>         path = /    # The destination directory, e.g., /weather
>         
>         # Set to True for an FTP over TLS (FTPS) connection. Not all servers
>         # support this.
>         secure_ftp = True
>         secure_data = True
>         
>         # To upload files from something other than what HTML_ROOT is set
>         # to above, specify a different HTML_ROOT here.
>         #HTML_ROOT = /var/www/html/weewx
>         
>         # Most FTP servers use port 21
>         port = 21
>         
>         # Set to 1 to use passive mode, zero for active mode
>         passive = 1
>         
>         debug = 2
> -- 
> 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/7df3ab25-bcbe-4f82-a392-e4d198cc40f6%40googlegroups.com.

-- 
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/16631D2F-DCD5-4E17-863F-FEA9A0D60917%40isylum.org.

Reply via email to