ankraft / ACME-oneM2M-CSE

An open source CSE Middleware for Education.
https://acmecse.net/
BSD 3-Clause "New" or "Revised" License
23 stars 16 forks source link

Trouble starting with python 3.10: SyntaxError: f-string: unmatched '(' #145

Closed mathiasp closed 5 months ago

mathiasp commented 5 months ago

I just cloned ACME master and ran it with python 3.10.13 on my FreeBSD machine in an venv and got above error.

I had to change two lines in Console.py

diff --git a/acme/services/Console.py b/acme/services/Console.py
index 50e207df..8b5b695c 100644
--- a/acme/services/Console.py
+++ b/acme/services/Console.py
@@ -758,7 +758,7 @@ Available under the BSD 3-Clause License
            count = 0

            # Create a temporary directory for the export
-           outdir = f'{CSE.Configuration.get('baseDirectory')}/tmp'
+           outdir = f'{CSE.Configuration.get("baseDirectory")}/tmp'
            os.makedirs(outdir, exist_ok = True)

            filename = f'export-{getResourceDate().rsplit(",", 1)[0]}.sh'
@@ -862,7 +862,7 @@ function createResource() {{
                L.console(f'No instances found under {ri}', isError = True)
            else:
                # Create a temporary directory for the export
-               outdir = f'{CSE.Configuration.get('baseDirectory')}/tmp'
+               outdir = f'{CSE.Configuration.get("baseDirectory")}/tmp'
                os.makedirs(outdir, exist_ok = True)

                # get the filename and open the file for writing

Anyway, thanks for ACME, this is a great help in understanding oneM2M!

Cheers, Mathias

ankraft commented 5 months ago

Thanks a lot for reporting this. I missed that using the same quote type in f-strings is allowed in Python >=3.12 only.

Would you mind to create a pull request for this? Otherwise I can make the change myself.

mathiasp commented 5 months ago

Could you do this? I'm away from my desk for today.

Otherwise I can do it tomorrow (CET).

ankraft commented 5 months ago

PR done. Again, thanks for reporting!

mathiasp commented 5 months ago

Andreas, thanks for your work on ACME, and for responding so quickly!