On Mon, Sep 30, 2024 at 3:45 PM Keith McKenna <keith.mcke...@comcast.net.invalid> wrote:
> Damjan Jovanovic wrote: > > > > > > On Sat, Sep 28, 2024 at 12:11 PM Matthias Seidel > > <matthias.sei...@hamburg.de <mailto:matthias.sei...@hamburg.de>> wrote: > > > > Hi All, > > > > Until now I could run the python scripts here: > > > > https://svn.apache.org/repos/asf/openoffice/devtools/aoo-stats/ > > > > because I still was able to install Python 2 on Ubuntu 22.04. > > > > After upgrading to Ubuntu 24.04 I cannot do this anymore. Running the > > scripts with Python 3 gives me errors. > > > > Could someone with Python knowledge have a look at those scripts, > > please? > > > > Regards, > > > > Matthias > > > > > > Hi > > > > You haven't really given examples of how to run those scripts, but I > > think I fixed one of them. > > > > I just had to: > > * Change the urllib import to urllib.request: > > -import urllib > > +import urllib.request > > * Delete the unused and now invalid urllib.urlencode import: > > -from urllib import urlencode > > * Change urllib.urlopen() to urllib.request.urlopen(): > > - conn = urllib.urlopen(url) > > + conn = urllib.request.urlopen(url) > > * Change every print x to print(x). > > > > The complete patch is attached so you can test it with Python 3. I am > > not sure how to run it or what output it's supposed to give. > > > > Regards > > Damjan > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org > > For additional commands, e-mail: dev-h...@openoffice.apache.org > > > If I remember correctly, it is not the scrips per se, it is that python2 > is unsupported. I believe that the code too implament Python 3 is > already in trunk, and possibly in Version 4.2.0. One of the developers > will hopefully correct any of my erroneous statements. I just help write > the documentation and am not a programmer. > > Regards > Keith N. McKenna > > The Python used within the AOO application for macro scripting has nothing to do with these scripts, which exist in a separate repository, run independently of AOO, and run from the command line. (Having said that, it might be possible to port these scripts to Python macros in a spreadsheet, if people prefer that.) Also IIRC, we only use Python 3 within AOO on *nix, and only when using SYSTEM_PYTHON. Regards Damjan