[Scons-users] Scons 2.5.1 crash when building OpenWSN - "AttributeError : 'NoneType' object has no attribute 'get_contents'"

MikeH mh at ashwireless.com
Wed Jul 12 10:31:15 EDT 2017


Using SCons 2.5.1 (or 2.5.0) on Windows 7 to build a variant of OpenWSN, 
I'm seeing a crash with "AttributeError : 'NoneType' object has no 
attribute 'get_contents'".  Is this a bug in SCons itself, or a mistake 
in an SConscript file?

C:\SVN_repos\sw\OpenWSN\openwsn-fw-develop\trunk>c:\Python27\scons.bat 
board=python toolchain=gcc --debug=stacktrace oos_openwsn

...
Compiling build\python_gcc\openstack\03b-IPv6\icmpv6_obj.o
Objectifying       openstack\03b-IPv6\icmpv6echo.c -> icmpv6echo_obj.c
Compiling build\python_gcc\openstack\03b-IPv6\icmpv6echo_obj.o
Objectifying       openstack\03b-IPv6\icmpv6rpl.c -> icmpv6rpl_obj.c
Compiling build\python_gcc\openstack\03b-IPv6\icmpv6rpl_obj.o
Objectifying       openstack\04-TRAN\opencoap.c -> opencoap_obj.c
Compiling build\python_gcc\openstack\04-TRAN\opencoap_obj.o
Objectifying       openstack\04-TRAN\opentcp.c -> opentcp_obj.c
Compiling build\python_gcc\openstack\04-TRAN\opentcp_obj.o
Objectifying       openstack\04-TRAN\openudp.c -> openudp_obj.c
Objectifying       openapps\uinject\uinject.h -> uinject_obj.h
scons: *** [build\python_gcc\openstack\04-TRAN\openudp_obj.o] 
AttributeError : 'NoneType' object has no attribute 'get_contents'
scons: internal stack trace:
   File "c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Job.py", line 
199, in start
     task.prepare()
   File 
"c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Script\Main.py", line 
164, in prepare
     return SCons.Taskmaster.OutOfDateTask.prepare(self)
   File "c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Taskmaster.py", 
line 172, in prepare
     self.exception_raise()
   File "c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Taskmaster.py", 
line 806, in _find_next_ready_node
     children = executor.get_all_children()
   File "c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Executor.py", 
line 322, in get_all_children
     result.extend(target.children())
   File 
"c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Node\__init__.py", line 
1375, in children
     self.scan()
   File 
"c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Node\__init__.py", line 
1051, in scan
     executor.scan_sources(self.builder.source_scanner)
   File "c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Executor.py", 
line 479, in scan_sources
     self.scan(scanner, self.get_all_sources())
   File "c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Executor.py", 
line 496, in scan
     deps.extend(node.get_implicit_deps(env, scanner, path, kw))
   File 
"c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Node\__init__.py", line 
946, in get_implicit_deps
     included_deps = [x for x in node.get_found_includes(env, scanner, 
path) if x not in seen]
   File "c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Node\FS.py", 
line 2893, in get_found_includes
     result = [n.disambiguate() for n in scanner(self, env, path)]
   File 
"c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Scanner\__init__.py", 
line 203, in __call__
     if self.scan_check and not self.scan_check(node, env):
   File 
"c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Scanner\__init__.py", 
line 309, in current_check
     return not node.has_builder() or node.is_up_to_date()
   File "c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Node\FS.py", 
line 3286, in is_up_to_date
     if not self.changed(r):
   File "c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Node\FS.py", 
line 3241, in changed
     has_changed = SCons.Node.Node.changed(self, node)
   File 
"c:\Python27\Lib\site-packages\scons-2.5.1\SCons\Node\__init__.py", line 
1464, in changed
     contents = self.get_executor().get_contents()
scons: building terminated because of errors.


Adding a temporary line of code "print self.get_executor()" just before 
the crashing line gives:

Objectifying       openstack\04-TRAN\opencoap.c -> opencoap_obj.c
self.get_executor() = objectify(target, source, env)
self.get_executor() = $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
Compiling build\python_gcc\openstack\04-TRAN\opencoap_obj.o
self.get_executor() = $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
self.get_executor() = objectify(target, source, env)
self.get_executor() = objectify(target, source, env)
Objectifying       openstack\04-TRAN\opentcp.c -> opentcp_obj.c
self.get_executor() = objectify(target, source, env)
self.get_executor() = $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
Compiling build\python_gcc\openstack\04-TRAN\opentcp_obj.o
self.get_executor() = $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
self.get_executor() = objectify(target, source, env)
self.get_executor() = objectify(target, source, env)
Objectifying       openstack\04-TRAN\openudp.c -> openudp_obj.c
self.get_executor() = objectify(target, source, env)
self.get_executor() = objectify(target, source, env)
self.get_executor() = objectify(target, source, env)
self.get_executor() = objectify(target, source, env)
Objectifying       openapps\uinject\uinject.h -> uinject_obj.h
self.get_executor() = objectify(target, source, env)
self.get_executor() = objectify(target, source, env)
self.get_executor() = objectify(target, source, env)
self.get_executor() = None
self.get_executor() = $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
scons: *** [build\python_gcc\openstack\04-TRAN\openudp_obj.o] 
AttributeError : 'NoneType' object has no attribute 'get_contents'
scons: internal stack trace:.....

(objectify() is a function defined in the SConscript.env file of OpenWSN).

It took me some time to discover the "--debug=stacktrace" option and 
track down the offending line.  If self.get_executor() can return None, 
should that situation be caught and handled more helpfully?

thanks,

Mike H.



More information about the Scons-users mailing list