How can I make sure my python exit

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • yinglcs@gmail.com

    How can I make sure my python exit

    Hi,

    I have a python script:
    At the end of the script, I have:

    print "Build Done!"

    my question is does that mean my python script exits after it prints
    "Build done!"

    I have a java program which calls this python script. But i run into a
    problem in which the python script never returns to the java program
    after it performs a system call to execute that python script.

  • kyosohma@gmail.com

    #2
    Re: How can I make sure my python exit

    On Apr 4, 2:58 pm, "ying...@gmail. com" <ying...@gmail. comwrote:
    Hi,
    >
    I have a python script:
    At the end of the script, I have:
    >
    print "Build Done!"
    >
    my question is does that mean my python script exits after it prints
    "Build done!"
    >
    I have a java program which calls this python script. But i run into a
    problem in which the python script never returns to the java program
    after it performs a system call to execute that python script.

    Typically when the last piece of code executes, the program ends. You
    could import sys and explicitly exit by calling sys.exit(0).

    Mike

    Comment

    • bearophileHUGS@lycos.com

      #3
      Re: How can I make sure my python exit

      Typically when the last piece of code executes, the program ends. You
      could import sys and explicitly exit by calling sys.exit(0).
      Mike
      raise SystemExit
      works too.

      Bye,
      bearophile

      Comment

      Working...