Re: ChatGPT

Posted by OmegaKV on
URL: https://mikraite.arkian.net/ChatGPT-tp3051p3069.html

I run a translation wiki and am using pywikibot to write a script for importing data from another site. I needed to know how to how to replace an existing page with a given text. Surprisingly none of its documented functions do this. I Googled my question and the only instance of someone asking it that I found is here:

https://lists.wikimedia.org/hyperkitty/list/pywikibot@lists.wikimedia.org/thread/Y6FSITSRH256RQKQOWDALO36M4FNLBOW/

The moron who responded recommends first deleting a page, which in my opinion is a bad solution since it requires admin privileges, whereas none should be needed to do this. The other solution he gave was to write a regex expression to replace the entire page, but in my opinion this is horrible since writing a regex expression requires one to think whereas thinking shouldn't be required for this.

Unsatisfied with these answers I looked through the source code of pywikibot and found there is a "save" function of the page class, which replaces a page with given text. This straightforward and does exactly what I want.

Afterwards I decided to test ChatGPT to see if it would figure this out on its own, even though the answer to this problem doesn't seem to exist online. So I asked ChatGPT to write a script using pywikibot that replaces a page with a given text. And it did it. It provided a simple and correct solution, which basically just uses the "save" function.

I spent a good half hour or so on this, which could have been avoided if I had used ChatGPT.