Results 1 to 2 of 2

Thread: Python help

  1. #1
    Join Date
    Apr 2011
    Location
    Chittagong,Bangladesh
    Beans
    149
    Distro
    Ubuntu 14.04 Trusty Tahr

    Python help

    [CODE/]from sys import platform
    from os import system ,listdir
    import subprocess
    def Platform():
    if platform == "win32":
    system("notepad")
    elif platform == "linux2" or "linux":
    subprocess.Popen("gnome-terminal -e nano", shell=True)

    def main():
    Platform()
    a=listdir()
    length=len(a)
    print(length,a)
    if __name__ == "__main__":main()][/CODE] ; In that code how can i capture when text editor is closed ? so is there any way to capture editor close signal ? actually i want to run listdir() after editor is close
    Last edited by prismctg; October 8th, 2012 at 10:00 AM.

  2. #2
    Join Date
    Nov 2004
    Beans
    560
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Python help

    subprocess.call() (check http://docs.python.org/library/subprocess.html) waits for the process to finish.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •