[Scons-users] untar builder fails with error
daggs
daggs at gmx.com
Tue Nov 8 10:57:13 EST 2022
> > I've decided to debug it on my home setup, it uses scons 4.4.0 and python 3.10.8
> > the code I'm using is this: https://dpaste.com/CA5CGYWNC and I'm getting this:
> > dagg at NCC-5001D ~/workspace/scons_untar $ scons .
> > scons: Reading SConscript files ...
> > AttributeError: 'map' object has no attribute 'side_effect':
> > File "/home/dagg/workspace/scons_untar/SConstruct", line 40:
> > thirdPartyEnvironment.UnTar(source="apr-1.3.3")
> > File "/usr/lib/python3.10/site-packages/SCons/Environment.py", line 238:
> > return super().__call__(target, source, *args, **kw)
> > File "/usr/lib/python3.10/site-packages/SCons/Util.py", line 737:
> > return self.method(*nargs, **kwargs)
> > File "/usr/lib/python3.10/site-packages/SCons/Builder.py", line 663:
> > return self._execute(env, target, source, OverrideWarner(kw), ekw)
> > File "/usr/lib/python3.10/site-packages/SCons/Builder.py", line 579:
> > _node_errors(self, env, tlist, slist)
> > File "/usr/lib/python3.10/site-packages/SCons/Builder.py", line 291:
> > if t.side_effect:
>
> In Python 3, the map function returns a map object, which is an
> iterable, not a list. You can iterate over it - which is the usual
> operation - but not otherwise do much with it. You will have to create a
> list out of the result of mapping (we could argue that SCons' logic
> should accept any iterable here but that's a different story).
>
> >>> x = [1, 2, 3]
> >>> y = map(str, x)
> >>> print(y)
> <map object at 0x7ff5e5590d00>
> >>> print(list(y))
> ['1', '2', '3']
>
>
> So probably this will help:
>
> newTargets = list(map(tarInfoToNode, tarFileContents))
thanks, that worked.
funny thing, I've encountered the same issue when migrating a old python 2.7 script to python 3.
I forgot about that.
Dagg
More information about the Scons-users
mailing list