Opened 6 months ago

Last modified 5 months ago

#14254 closed defect

Python 3 says SyntaxError: multiple exception types must be parenthesized — at Initial Version

Reported by: clemens Owned by: Álvaro Iradier
Priority: normal Component: SearchAllPlugin
Severity: blocker Keywords:
Cc: clemens, stei Trac Release: 1.6

Description

Running the SearchAllPlugin (revision r18446) on TRAC 1.6 with Python 3 makes problems.

In the log file we can see the error:

2023-11-19 15:58:08,012 Trac[env] INFO: -------------------------------- environment startup [Trac 1.6] --------------------------------
2023-11-19 15:58:08,190 Trac[loader] ERROR: Skipping "tracsearchall = tracsearchall.searchall": 
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/trac/loader.py", line 80, in _load_eggs
    entry.load(require=True)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2468, in load
    return self.resolve()
           ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2474, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/tracsearchall/searchall.py", line 120
    except Exception, ex:
           ^^^^^^^^^^^^^
SyntaxError: multiple exception types must be parenthesized (searchall.py, line 120)

I am not a Python expert, but source:/searchallplugin/0.11/tracsearchall/searchall.py#L120 contains except Exception, ex: where it should rather be except Exception as ex:. As I learned from here.

Change History (0)

Note: See TracTickets for help on using tickets.