You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if __name__ == "__main__":
logger.setLevel("DEBUG")
parser = argparse.ArgumentParser(
description="""random"""
)
then the autoprogram is unable to see the parser object for that specific file. Moving parser up before the if works, but require all the add_argument to be above the if __name__ == "__main__".
I usually declare the parser only if this is executed as a script or with the -m option of python, and tend to avoid global objects otherwise.
Is there a way to make it work like this?
Thank you,
The text was updated successfully, but these errors were encountered:
@LongnoseRob sorry no, could not find a way to work around it. It should not be too difficult though, the code for getting the parser object seems to be this one but one needs to dig in.
Dear
autoprogram
team,If I have a code like this:
then the
autoprogram
is unable to see theparser
object for that specific file. Movingparser
up before theif
works, but require all theadd_argument
to be above theif __name__ == "__main__"
.I usually declare the
parser
only if this is executed as a script or with the-m
option of python, and tend to avoid global objects otherwise.Is there a way to make it work like this?
Thank you,
The text was updated successfully, but these errors were encountered: