Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I figured out what the problem is when I was trying to see why the print statement I suggested in the comments didnt work.</p> <p>First of all, an efficient way in Python to print all the strings in a list of strings is like this:</p> <pre><code>', '.join(Sources) </code></pre> <p>The part in the quotes <code>', '</code> is the separator between elements in the list of strings.</p> <p>I realized the problem with the following SConstruct excerpt:</p> <pre><code>sources = (Glob('src/dir1/*.cc') +Glob('src/dir2/*.cc') +Glob('src/dir3/*.cc')) print sources print ', '.join(sources) </code></pre> <p>Which gives this output:</p> <pre><code>scons: Reading SConscript files ... [&lt;SCons.Node.FS.File object at 0x122e4d0&gt;, &lt;SCons.Node.FS.File object at 0x122e710&gt;, &lt;SCons.Node.FS.File object at 0x122e950&gt;] TypeError: sequence item 0: expected string, File found: File "/home/notroot/projects/sandbox/SconsGlob/SConstruct", line 10: print ', '.join(sources) </code></pre> <p>That's when I remembered that the SCons Glob() function returns a list of Nodes (Files), not a list of strings. According to the <a href="http://www.scons.org/doc/production/HTML/scons-man.html" rel="nofollow">SCons man page</a> (search for 'glob(' ) the usage is as follows:</p> <pre><code>Glob(pattern, [ondisk, source, strings]) </code></pre> <p>And the strings argument does the following:</p> <blockquote> <p>The strings argument may be set to True (or any equivalent value) to have the Glob() function return strings, not Nodes, that represent the matched files or directories...</p> </blockquote> <p>The MSVSProject() builder is expecting a list of strings, not Nodes. So, it works as you are expecting if you do the following:</p> <pre><code>sources = (Glob('src/dir1/*.cc', strings=True) +Glob('src/dir2/*.cc', strings=True) +Glob('src/dir3/*.cc', strings=True)) print ', '.join(sources) </code></pre> <p>Which gives the following output:</p> <pre><code>scons: Reading SConscript files ... src/dir1/main.cc, src/dir2/func2.cc, src/dir3/func3.cc scons: done reading SConscript files. scons: Building targets ... scons: `.' is up to date. scons: done building targets. </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload