How to publish HTML from weewx to WordPress

132 views
Skip to first unread message

Tex Drone

unread,
Jun 9, 2024, 3:04:42 PMJun 9
to weewx-user
I have been running WeeWx 4.x. on a Pi3 for several years. Now, I am trying to publish the HTML files to my WP website. I have mathewwall/weewx-sftp installed and it can login to my WP server account, but then I get the following errors. Any ideas what I am doing wrong? Thanks!

  Jun  9 13:07:15 raspberrypi weewx[5969] INFO weewx.engine: Starting main packet loop.
Jun  9 13:07:16 raspberrypi weewx[5969] INFO weewx.restx: Wunderground-PWS: Published record 2024-06-09 13:05:00 CDT (1717956300)
Jun  9 13:07:16 raspberrypi weewx[5969] INFO weewx.restx: PWSWeather: Published record 2024-06-09 13:05:00 CDT (1717956300)
Jun  9 13:07:16 raspberrypi weewx[5969] INFO weewx.restx: CWOP: Published record 2024-06-09 13:05:00 CDT (1717956300)
Jun  9 13:07:16 raspberrypi weewx[5969] INFO weewx.restx: PWSWeather: Published record 2024-06-09 13:06:00 CDT (1717956360)
Jun  9 13:07:16 raspberrypi weewx[5969] INFO weewx.restx: Wunderground-PWS: Published record 2024-06-09 13:06:00 CDT (1717956360)
Jun  9 13:07:16 raspberrypi weewx[5969] INFO weewx.restx: PWSWeather: Published record 2024-06-09 13:07:00 CDT (1717956420)
Jun  9 13:07:16 raspberrypi weewx[5969] INFO weewx.restx: Wunderground-PWS: Published record 2024-06-09 13:07:00 CDT (1717956420)
Jun  9 13:08:15 raspberrypi weewx[5969] INFO weewx.manager: Added record 2024-06-09 13:08:00 CDT (1717956480) to database 'weewx.sdb'
Jun  9 13:08:15 raspberrypi weewx[5969] INFO weewx.manager: Added record 2024-06-09 13:08:00 CDT (1717956480) to daily summary in 'weewx.sdb'
Jun  9 13:08:16 raspberrypi weewx[5969] INFO weewx.restx: PWSWeather: Published record 2024-06-09 13:08:00 CDT (1717956480)
Jun  9 13:08:16 raspberrypi weewx[5969] INFO weewx.restx: Wunderground-PWS: Published record 2024-06-09 13:08:00 CDT (1717956480)
Jun  9 13:08:20 raspberrypi weewx[5969] INFO weewx.cheetahgenerator: Generated 13 files for report StandardReport in 4.86 seconds
Jun  9 13:08:22 raspberrypi weewx[5969] INFO weewx.imagegenerator: Generated 12 images for report StandardReport in 1.38 seconds
Jun  9 13:08:22 raspberrypi weewx[5969] INFO weewx.reportengine: Copied 14 files to /var/www/html/weewx
Jun  9 13:08:22 raspberrypi weewx[5969] INFO paramiko.transport: Connected (version 2.0, client Atomic)
Jun  9 13:08:23 raspberrypi weewx[5969] INFO paramiko.transport: Authentication (password) successful!
Jun  9 13:08:24 raspberrypi weewx[5969] INFO paramiko.transport.sftp: [chan 0] Opened sftp connection (server version 3)
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine: Caught unrecoverable exception in generator 'user.sftp.SFTPGenerator'
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****  [Errno 2] No such file
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****  Traceback (most recent call last):
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weewx/reportengine.py", line 197, in run
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****      obj.start()
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weewx/reportengine.py", line 385, in start
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****      self.run()
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/user/sftp.py", line 259, in run
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****      n = uploader.run()
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/user/sftp.py", line 122, in run
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****      self._make_remote_dir(con, remote_dir_path)
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/user/sftp.py", line 185, in _make_remote_dir
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****      con.mkdir(remote_dir_path)
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****    File "/usr/local/lib/python2.7/dist-packages/pysftp/__init__.py", line 626, in mkdir
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****      self._sftp.mkdir(remotepath, mode=int(str(mode), 8))
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****    File "/usr/local/lib/python2.7/dist-packages/paramiko/sftp_client.py", line 460, in mkdir
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****      self._request(CMD_MKDIR, path, attr)
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****    File "/usr/local/lib/python2.7/dist-packages/paramiko/sftp_client.py", line 822, in _request
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****      return self._read_response(num)
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****    File "/usr/local/lib/python2.7/dist-packages/paramiko/sftp_client.py", line 874, in _read_response
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****      self._convert_status(msg)
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****    File "/usr/local/lib/python2.7/dist-packages/paramiko/sftp_client.py", line 903, in _convert_status
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****      raise IOError(errno.ENOENT, text)
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****  IOError: [Errno 2] No such file
Jun  9 13:08:24 raspberrypi weewx[5969] ERROR weewx.reportengine:         ****  Generator terminated
Jun  9 13:08:24 raspberrypi weewx[5969] INFO paramiko.transport.sftp: [chan 0] sftp session closed.

vince

unread,
Jun 9, 2024, 3:47:57 PMJun 9
to weewx-user
 IOError: [Errno 2] No such file - you are likely trying to write to a directory that does not exist on the remote system....

Impossible to suggest more unless you provide your FTP section of weewx.conf (please do not post your username nor password of course)

Tex Drone

unread,
Jun 9, 2024, 4:37:57 PMJun 9
to weewx-user
Sure thing. I have also tried using this path.  /wp-content/themes/ 
I am including the entire StdReport section for good measure. Thanks for taking a look!


[StdReport]

    # Where the skins reside, relative to WEEWX_ROOT
    SKIN_ROOT = /etc/weewx/skins

    # Where the generated reports should go, relative to WEEWX_ROOT
    HTML_ROOT = /var/www/html/weewx

    # The database binding indicates which data should be used in reports.
    data_binding = wx_binding

    # Whether to log a successful operation
    log_success = True

    # Whether to log an unsuccessful operation
    log_failure = True

    # Each of the following subsections defines a report that will be run.
    # See the customizing guide to change the units, plot types and line
    # colors, modify the fonts, display additional sensor data, and other
    # customizations. Many of those changes can be made here by overriding
    # parameters, or by modifying templates within the skin itself.

    [[SeasonsReport]]
        # The SeasonsReport uses the 'Seasons' skin, which contains the
        # images, templates and plots for the report.
        skin = Seasons
        enable = true

    [[SmartphoneReport]]
        # The SmartphoneReport uses the 'Smartphone' skin, and the images and
        # files are placed in a dedicated subdirectory.
        skin = Smartphone
        enable = true
        HTML_ROOT = /var/www/html/weewx/smartphone

    [[MobileReport]]
        # The MobileReport uses the 'Mobile' skin, and the images and files
        # are placed in a dedicated subdirectory.
        skin = Mobile
        enable = true
        HTML_ROOT = /var/www/html/weewx/mobile

[[StandardReport]]
        # This is the old "Standard" skin. By default, it is not enabled.
        skin = Standard
        enable = true


    [[sftp]]
        skin = sftp
        user = my.username.com
        password = "mypassword"
        server = sftp.wp.com
        port = 22
        path = /wp-content/media/uploads

    [[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 = false
        user = ""
        password = ""
        server = ""
        path = ""

        # Set to True for an FTP over TLS (FTPS) connection. Not all servers
        # support this.
        secure_ftp = false
        # 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

vince

unread,
Jun 9, 2024, 6:59:33 PMJun 9
to weewx-user
If you're really using sftp.wp.com then their docs suggest you might try a path of just / and perhaps that will work.  You might need to interactively login and try 'pwd' to see what the server side thinks your path is on that side.   If that doesn't work then I have no idea how specifically their hosting works, but my guess is they have some kind of forums there you can ask on.  This one has to have come up before.

Cameron D

unread,
Jun 11, 2024, 12:40:08 AMJun 11
to weewx-user
I think you are not using the correct remote path - wordpress root, server root and sftp root folders can all be different, and can also change depending on provider.
Wordpress.com help looks like they use /htdocs/wp-content/... which suggests their sftp server does a chroot to your account login dir.
What I suggest you should do is start with either a gui sftp client  or the sftp command line client and manually upload a first version - make sure that works in your wordpress site.
That way you can also determine how WP have configured the root for sftp.

Tex Drone

unread,
Jun 17, 2024, 3:37:35 PMJun 17
to weewx-user
Vince and Cameron - You are both correct. I was using an incorrect path. Thank you!
Reply all
Reply to author
Forward
0 new messages