Importing ABC directly from collections module was removed in Python 3.9

Bug #1986971 reported by Stefan Fleischmann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-lesscpy (Ubuntu)
New
Undecided
Unassigned

Bug Description

I believe the package is currently broken in Ubuntu 22.04 due to the python3 version (3.10). To make the package compatible with Python >=3.9 one needs a patch like this:

 https://github.com/lesscpy/lesscpy/pull/105/commits/0bbcf058e9ca6715c73f8e438529a837476978c3

The upstream bug report: https://github.com/lesscpy/lesscpy/issues/104

How to reproduce:
Download simple css file, e.g.
 $ wget https://gist.githubusercontent.com/eirikbakke/1059266/raw/d81dba46c76169c2b253de0baed790677883c221/gistfile1.css
Then run the module on the file:
 $ python3 -m lesscpy -x gistfile1.css

expected output (works for example with Ubuntu 20.04):
 body{margin:25px;background-color:#f0f0f0;font-family:arial,sans-serif;font-size:14px;}
h1{font-size:35px;font-weight:normal;margin-top:5px;}
.someclass{color:red;}
#someid{color:green;}

Actual output/error:
$ python3 -m lesscpy -x gistfile1.css
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/lesscpy/__main__.py", line 4, in <module>
    run()
  File "/usr/lib/python3/dist-packages/lesscpy/scripts/compiler.py", line 176, in run
    p.parse(filename=args.target, debuglevel=args.debug)
  File "/usr/lib/python3/dist-packages/lesscpy/lessc/parser.py", line 153, in parse
    self.result = self.parser.parse(
  File "/usr/lib/python3/dist-packages/ply/yacc.py", line 333, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
  File "/usr/lib/python3/dist-packages/ply/yacc.py", line 1120, in parseopt_notrack
    p.callable(pslice)
  File "/usr/lib/python3/dist-packages/lesscpy/lessc/parser.py", line 298, in p_block_open
    p[1].parse(self.scope)
  File "/usr/lib/python3/dist-packages/lesscpy/plib/identifier.py", line 55, in parse
    for n in utility.flatten(self.tokens):
  File "/usr/lib/python3/dist-packages/lesscpy/lessc/utility.py", line 28, in flatten
    if isinstance(elm, collections.Iterable) and not isinstance(elm, string_types):
AttributeError: module 'collections' has no attribute 'Iterable'

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.