Skip to content

[Question] __file__ is not defined #4683

Closed Answered by mwichmann
anzhi0708 asked this question in Q&A
Discussion options

You must be logged in to vote

Strictly speaking, they're not standalone Python scripts - if they were, you'd have to be importing all of the things that form the SCons API. Instead, they are snippets (potentially very large ones) written in Python that are evaluated (actually, compiled then exec'd) in the context of SCons. While the result you get surprises me (not defined), you won't get what you are looking for here: the context while the SConstruct/SConscript is being run is actually .../SCons/Script/SConscript.py.

If you're looking for a way to generate a list of files in a particular directory, SCons provides some ways that might help - see, in particular:

https://scons.org/doc/production/HTML/scons-man.html#f-Glob

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@anzhi0708
Comment options

Answer selected by anzhi0708
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants