The answer is a little complicated. What you have to do is create a
symbolic link in the skin directory which points to the file you really
want to copy. You then tell CopyGenerator to copy the named link.
CopyGenerator 'looks through' the symbolic link and copies the original
file to the output directory.
On Thursday, July 31, 2025 at 7:21:27 PM UTC-4 Peter Fletcher wrote:
> Using CopyGenerator does not work. It will accept an absolute path, but it
> then tries to copy the file *over itself* - the absolute path is used as
> source *and* destination. Here is the error listing from journalctl:
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> Caught unrecoverable exception in generator
> 'weewx.reportengine.CopyGenerator'
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** '/var/www/html/weewx3/realtime.txt' and
> '/var/www/html/weewx3/realtime.txt' are the same file
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** Traceback (most recent call last):
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** File
> "/home/pi/weewx-venv/lib/python3.11/site-packages/weewx/reportengine.py",
> line 248, in run
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** obj.start()
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** File
> "/home/pi/weewx-venv/lib/python3.11/site-packages/weewx/reportengine.py",
> line 465, in start
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** self.run()
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** File
> "/home/pi/weewx-venv/lib/python3.11/site-packages/weewx/reportengine.py",
> line 621, in run
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** ncopy += weeutil.weeutil.deep_copy_path(path, html_dest_dir)
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** File
> "/home/pi/weewx-venv/lib/python3.11/site-packages/weeutil/weeutil.py", line
> 1811, in deep_copy_path
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** shutil.copy(path, d)
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** File "/usr/lib/python3.11/shutil.py", line 419, in copy
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** copyfile(src, dst, follow_symlinks=follow_symlinks)
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** File "/usr/lib/python3.11/shutil.py", line 236, in copyfile
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** raise SameFileError("{!r} and {!r} are the same
> file".format(src, dst))
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** shutil.SameFileError: '/var/www/html/weewx3/realtime.txt' and
> '/var/www/html/weewx3/realtime.txt' are the same file
> Jul 31 19:05:25 bookwormpi3b weewxd[365083]: ERROR weewx.reportengine:
> **** Generator terminated
>
> On Thursday, July 31, 2025 at 3:48:15 PM UTC-4 Tom Keffer wrote:
>
>> I'm not sure if this answers your question, but I don't see why the files
>> listed under copy_once
>> <https://www.weewx.com/docs/5.1/reference/skin-options/copygenerator/?h=#copy_once>
>>
>> can't include an absolute path.
>>
>> For your second question, it's impossible to say without a log. Set
>> debug=2 (sic), restart weewxd, post the log through the first FTP session.
>>
>> -tk
>>
>> On Thu, Jul 31, 2025 at 12:37 PM 'Peter Fletcher' via weewx-development <
>> [email protected]> wrote:
>>
>>> Also, the attempted FTP of the file to the additional site doesn't seem
>>> to be working, even though weewx is not reporting an error on the FTP.
>>
>>
>>>
>>> On Thursday, July 31, 2025 at 3:19:53 PM UTC-4 Peter Fletcher wrote:
>>>
>>>> Is there a 'built-in' way of copying the latest version of an external
>>>> file (which is actually in a different report output folder but could be
>>>> anywhere else on the system that is running weewx) into a specific report
>>>> output folder at every reporting cycle. I know that you can specify that
>>>> skin files be (re-)copied over at each cycle but this is not what I want
>>>> to
>>>> do. The file in question is actually the Cumulus current weather data text
>>>> file, which I currently have being FTPed to one destination and would like
>>>> to add to the site files being FTPed to a different destination. I am
>>>> currently using an additional FTP stanza to send the Cumulus file to the
>>>> second site, but this seems clumsy.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "weewx-development" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion visit
>>> https://groups.google.com/d/msgid/weewx-development/9fb1171e-f5fa-44a2-99ee-7a58c208d5afn%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/weewx-development/9fb1171e-f5fa-44a2-99ee-7a58c208d5afn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/weewx-development/70b8dca4-dfb1-45b7-b502-2a0d537895abn%40googlegroups.com.