Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

!/usr/bin/env python

import sys import ToBuildOrNot

repoArray = ["MSS_sims","PCS_CCS"]

def main(argv): for repo in repoArray:

    needsBuild = ToBuildOrNot.ToBuildOrNot(repo)

    if needsBuild == True:
        print "\n",repo,"Needs To rebuilt\n"
        print "---------------------------------------------------------------"

    elif needsBuild == False:
        print "\n", repo,"does NOT Need to be Rebuilt\n"
        print "---------------------------------------------------------------"

    else:
        print "error"

if name == 'main': main(sys.argv[1:])

share|improve this question
2  
needsBuild / not needsBuild is presumably sufficient (unless you're expecting more than two possible values) - but do you have a question? – Jon Clements Jun 26 at 17:16
Yes my question is how do i scan the ToBuildOrNot.run('MSS_sims') for the true or false return value? – Barry Taylor Jun 26 at 17:21
Why this question now - instead of elaborating on your previous question – Jon Clements Jun 26 at 17:23
1  
What do you mean by "scan"? You've stored the result in needsBuild. You can then use if needsBuild: or if not needsBuild: like you would for any other if block – recursive Jun 26 at 17:23

put on hold as unclear what you're asking by Haidro, Rachel Gallen, Justin, maksimov, Radim Köhler 2 days ago

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 0 down vote accepted

Use == for equality check not is, is is used for identity check.

if needsBuild == True:
    print "The MSS_sims Needs To rebuilt"

elif needsBuild == False:
    print "The MSS_sims does NOT Need to be Rebuilt"

else:
    print "error

Related : Is there a difference between `==` and `is` in python?

share|improve this answer
Additionally, it's better to raise an exception for an error, probably, instead of returning True, False, or "something else". – Wooble Jun 26 at 17:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.