Modify

Opened 7 months ago

Last modified 7 months ago

#14155 new defect

Cannot install CollapsiblePlugin in Trac 1.5 / Python 3

Reported by: anonymous Owned by: codingking
Priority: normal Component: CollapsiblePlugin
Severity: normal Keywords: python3
Cc: Trac Release:

Description

I get the following error when trying to install the plugin in Python 3:

# python3 setup.py install

Traceback (most recent call last):
  File "/root/TracPlugins/collapsibleplugin/0.12/setup.py", line 93, in <module>
    package_dir = dict([p, i[0]] for p, i in PKG_INFO.iteritems()),
AttributeError: 'dict' object has no attribute 'iteritems'

Seems iteritems was renamed to items. If I make that change in setup.py, then I can install.

When Trac 1.5 loads this, it complains as follows:

2022-09-08 15:50:06,545 Trac[loader] ERROR: Skipping "traccollapsible = traccollapsible":
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/Trac-1.5.4.dev0-py3.10.egg/trac/loader.py", line 80, in _load_eggs
    entry.load(require=True)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2471, in load
    return self.resolve()
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2477, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1002, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 945, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1439, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1411, in _get_spec
  File "<frozen zipimport>", line 170, in find_spec
  File "<frozen importlib._bootstrap>", line 431, in spec_from_loader
  File "<frozen importlib._bootstrap_external>", line 741, in spec_from_file_location
  File "<frozen zipimport>", line 229, in get_filename
  File "<frozen zipimport>", line 760, in _get_module_code
  File "<frozen zipimport>", line 689, in _compile_source
  File "/usr/lib/python3.10/site-packages/TracCollapsiblePlugin-0.1-py3.10.egg/traccollapsible/__init__.py", line 34
    except Exception, exc:
           ^^^^^^^^^^^^^^
SyntaxError: multiple exception types must be parenthesized (__init__.py, line 34)

So, changing except Exception, exc: to except (Exception, exc): is needed. Then the plugin works in Python 3.

Attachments (0)

Change History (1)

comment:1 Changed 7 months ago by Jun Omae

Keywords: python removed

So, changing except Exception, exc: to except (Exception, exc): is needed.

No. That should be except Exception as exc:.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain codingking.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.