Discussion:
[Scons-users] SCons 3.0.0 and Util.py
Bassem Girgis
2017-10-03 21:46:47 UTC
Permalink
Hi All,

I'm trying to migrate to SCons 3.0.0 to use python 3.6 as my only python
installation. In doing so I ran into the issue shown below. It lookd like
the to_str() function in Util.py is not expecting None and it got one. From
my end, it looks like a directory install is what caused it. Editing the
to_str() function to return empty str in that case solved the issue.
However, I'm not sure if the issue is rather in the Install() builder that
returned a None from the executer.

Install directory: "to/project/runtime/linx64" as
"to/install/linx64/lib/linx64"
--------------> None
scons: *** [to/install/linx64/lib/linx64] TypeError : decoding to str: need
a bytes-like object, NoneType found
Traceback (most recent call last):
File "/usr/lib/scons-3.0.0/SCons/Taskmaster.py", line 255, in execute
self.targets[0].build()
File "/usr/lib/scons-3.0.0/SCons/Node/__init__.py", line 750, in build
self.get_executor()(self, **kw)
File "/usr/lib/scons-3.0.0/SCons/Executor.py", line 396, in __call__
return _do_execute_map[self._do_execute](self, target, kw)
File "/usr/lib/scons-3.0.0/SCons/Executor.py", line 127, in
execute_action_list
status = act(*args, **kw)
File "/usr/lib/scons-3.0.0/SCons/Action.py", line 709, in __call__
stat = self.execute(target, source, env, executor=executor)
File "/usr/lib/scons-3.0.0/SCons/Action.py", line 1207, in execute
result = SCons.Errors.convert_to_BuildError(result, exc_info)
File "/usr/lib/scons-3.0.0/SCons/Errors.py", line 203, in
convert_to_BuildError
exc_info=exc_info)
File "/usr/lib/scons-3.0.0/SCons/Errors.py", line 98, in __init__
self.errstr = SCons.Util.to_str(errstr)
File "/usr/lib/scons-3.0.0/SCons/Util.py", line 1624, in to_str
return str (s, 'utf-8')
TypeError: decoding to str: need a bytes-like object, NoneType found
scons: building terminated because of errors.


Bassem Girgis, PhD

Email: ***@gmail.com
Bill Deegan
2017-10-03 23:52:02 UTC
Permalink
Any chance you can give us a simple SConstruct that demonstrates the issue
so we can add to our test suite when we fix the bug?
Do you get the same error if you run SCons 3.0 with python 2.7.x ?
Post by Bassem Girgis
Hi All,
I'm trying to migrate to SCons 3.0.0 to use python 3.6 as my only python
installation. In doing so I ran into the issue shown below. It lookd like
the to_str() function in Util.py is not expecting None and it got one. From
my end, it looks like a directory install is what caused it. Editing the
to_str() function to return empty str in that case solved the issue.
However, I'm not sure if the issue is rather in the Install() builder that
returned a None from the executer.
Install directory: "to/project/runtime/linx64" as
"to/install/linx64/lib/linx64"
--------------> None
need a bytes-like object, NoneType found
File "/usr/lib/scons-3.0.0/SCons/Taskmaster.py", line 255, in execute
self.targets[0].build()
File "/usr/lib/scons-3.0.0/SCons/Node/__init__.py", line 750, in build
self.get_executor()(self, **kw)
File "/usr/lib/scons-3.0.0/SCons/Executor.py", line 396, in __call__
return _do_execute_map[self._do_execute](self, target, kw)
File "/usr/lib/scons-3.0.0/SCons/Executor.py", line 127, in
execute_action_list
status = act(*args, **kw)
File "/usr/lib/scons-3.0.0/SCons/Action.py", line 709, in __call__
stat = self.execute(target, source, env, executor=executor)
File "/usr/lib/scons-3.0.0/SCons/Action.py", line 1207, in execute
result = SCons.Errors.convert_to_BuildError(result, exc_info)
File "/usr/lib/scons-3.0.0/SCons/Errors.py", line 203, in
convert_to_BuildError
exc_info=exc_info)
File "/usr/lib/scons-3.0.0/SCons/Errors.py", line 98, in __init__
self.errstr = SCons.Util.to_str(errstr)
File "/usr/lib/scons-3.0.0/SCons/Util.py", line 1624, in to_str
return str (s, 'utf-8')
TypeError: decoding to str: need a bytes-like object, NoneType found
scons: building terminated because of errors.
Bassem Girgis, PhD
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Bassem Girgis
2017-10-05 00:09:21 UTC
Permalink
It looks like I had a bad link in the path I was trying to install. SCons
3.0.0 would give the following error with Python 2.7.13, which is
informative.
Post by Bassem Girgis
scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
Install directory: "bin" as "install/bin"
scons: *** [install/bin] CopytreeError : [('bin/badlink',
'install/bin/badlink', "[Errno 2] No such file or directory:
'bin/badlink'")]

And the following error with Python 3.6.2, which doesn't tell much.
Post by Bassem Girgis
scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
Install directory: "bin" as "install/default/bin"
scons: *** [install/default/bin] TypeError : decoding to str: need a
bytes-like object, NoneType found
Traceback (most recent call last):
File "/usr/lib/scons-3.0.0/SCons/Taskmaster.py", line 255, in execute
self.targets[0].build()
File "/usr/lib/scons-3.0.0/SCons/Node/__init__.py", line 750, in build
self.get_executor()(self, **kw)
File "/usr/lib/scons-3.0.0/SCons/Executor.py", line 396, in __call__
return _do_execute_map[self._do_execute](self, target, kw)
File "/usr/lib/scons-3.0.0/SCons/Executor.py", line 127, in
execute_action_list
status = act(*args, **kw)
File "/usr/lib/scons-3.0.0/SCons/Action.py", line 709, in __call__
stat = self.execute(target, source, env, executor=executor)
File "/usr/lib/scons-3.0.0/SCons/Action.py", line 1207, in execute
result = SCons.Errors.convert_to_BuildError(result, exc_info)
File "/usr/lib/scons-3.0.0/SCons/Errors.py", line 203, in
convert_to_BuildError
exc_info=exc_info)
File "/usr/lib/scons-3.0.0/SCons/Errors.py", line 98, in __init__
self.errstr = SCons.Util.to_str(errstr)
File "/usr/lib/scons-3.0.0/SCons/Util.py", line 1623, in to_str
return str (s, 'utf-8')
TypeError: decoding to str: need a bytes-like object, NoneType found
scons: building terminated because of errors.

Please find attached a simple project to replicate this issue. Some how
scons 2.5.1 had no problem ignoring the bad links silently. Not sure what
is the intended behavior here would be. But I like the scons 3.0.0 with
python 2.7.13 the best because it pinned point the issue for me and didn't
let such a dead link go unnotced like scons 2.5.1.

Best regards,
Bassem


Bassem Girgis, PhD
Post by Bassem Girgis
Hi All,
I'm trying to migrate to SCons 3.0.0 to use python 3.6 as my only python
installation. In doing so I ran into the issue shown below. It lookd like
the to_str() function in Util.py is not expecting None and it got one. From
my end, it looks like a directory install is what caused it. Editing the
to_str() function to return empty str in that case solved the issue.
However, I'm not sure if the issue is rather in the Install() builder that
returned a None from the executer.
Install directory: "to/project/runtime/linx64" as
"to/install/linx64/lib/linx64"
--------------> None
need a bytes-like object, NoneType found
File "/usr/lib/scons-3.0.0/SCons/Taskmaster.py", line 255, in execute
self.targets[0].build()
File "/usr/lib/scons-3.0.0/SCons/Node/__init__.py", line 750, in build
self.get_executor()(self, **kw)
File "/usr/lib/scons-3.0.0/SCons/Executor.py", line 396, in __call__
return _do_execute_map[self._do_execute](self, target, kw)
File "/usr/lib/scons-3.0.0/SCons/Executor.py", line 127, in
execute_action_list
status = act(*args, **kw)
File "/usr/lib/scons-3.0.0/SCons/Action.py", line 709, in __call__
stat = self.execute(target, source, env, executor=executor)
File "/usr/lib/scons-3.0.0/SCons/Action.py", line 1207, in execute
result = SCons.Errors.convert_to_BuildError(result, exc_info)
File "/usr/lib/scons-3.0.0/SCons/Errors.py", line 203, in
convert_to_BuildError
exc_info=exc_info)
File "/usr/lib/scons-3.0.0/SCons/Errors.py", line 98, in __init__
self.errstr = SCons.Util.to_str(errstr)
File "/usr/lib/scons-3.0.0/SCons/Util.py", line 1624, in to_str
return str (s, 'utf-8')
TypeError: decoding to str: need a bytes-like object, NoneType found
scons: building terminated because of errors.
Bassem Girgis, PhD
Bassem Girgis
2017-11-25 00:55:52 UTC
Permalink
I can confirm that this issue does not exist in SCons 3.0.1 Thanks for
fixing it, Bill!

Bassem Girgis, PhD
Post by Bassem Girgis
Hi All,
I'm trying to migrate to SCons 3.0.0 to use python 3.6 as my only python
installation. In doing so I ran into the issue shown below. It lookd like
the to_str() function in Util.py is not expecting None and it got one. From
my end, it looks like a directory install is what caused it. Editing the
to_str() function to return empty str in that case solved the issue.
However, I'm not sure if the issue is rather in the Install() builder that
returned a None from the executer.
Install directory: "to/project/runtime/linx64" as
"to/install/linx64/lib/linx64"
--------------> None
need a bytes-like object, NoneType found
File "/usr/lib/scons-3.0.0/SCons/Taskmaster.py", line 255, in execute
self.targets[0].build()
File "/usr/lib/scons-3.0.0/SCons/Node/__init__.py", line 750, in build
self.get_executor()(self, **kw)
File "/usr/lib/scons-3.0.0/SCons/Executor.py", line 396, in __call__
return _do_execute_map[self._do_execute](self, target, kw)
File "/usr/lib/scons-3.0.0/SCons/Executor.py", line 127, in
execute_action_list
status = act(*args, **kw)
File "/usr/lib/scons-3.0.0/SCons/Action.py", line 709, in __call__
stat = self.execute(target, source, env, executor=executor)
File "/usr/lib/scons-3.0.0/SCons/Action.py", line 1207, in execute
result = SCons.Errors.convert_to_BuildError(result, exc_info)
File "/usr/lib/scons-3.0.0/SCons/Errors.py", line 203, in
convert_to_BuildError
exc_info=exc_info)
File "/usr/lib/scons-3.0.0/SCons/Errors.py", line 98, in __init__
self.errstr = SCons.Util.to_str(errstr)
File "/usr/lib/scons-3.0.0/SCons/Util.py", line 1624, in to_str
return str (s, 'utf-8')
TypeError: decoding to str: need a bytes-like object, NoneType found
scons: building terminated because of errors.
Bassem Girgis, PhD
Loading...