get process id...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SpreadTooThin

    #1

    get process id...

    How does one get the process id?
    Is there a method for windows and unix (mac os x etc...)

  • georgeryoung@gmail.com

    #2
    Re: get process id...

    SpreadTooThin wrote:
    How does one get the process id?
    Is there a method for windows and unix (mac os x etc...)
    under linux, do:
    import os
    os.getpid()

    Comment

    • billie

      #3
      Re: get process id...


      georgeryoung@gm ail.com ha scritto:
      SpreadTooThin wrote:
      How does one get the process id?
      Is there a method for windows and unix (mac os x etc...)
      >
      under linux, do:
      import os
      os.getpid()
      Under Windows:
      import ctypes
      ctypes.windll.k ernel32.GetCurr entProcessId()

      Comment

      • Tim Golden

        #4
        Re: get process id...

        billie wrote:
        georgeryoung@gm ail.com ha scritto:
        >
        SpreadTooThin wrote:
        How does one get the process id?
        Is there a method for windows and unix (mac os x etc...)
        under linux, do:
        import os
        os.getpid()
        >
        Under Windows:
        import ctypes
        ctypes.windll.k ernel32.GetCurr entProcessId()
        Anything wrong with os.getpid () under Windows, too?

        <dump>
        Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
        on win32
        Type "help", "copyright" , "credits" or "license" for more information.
        >>import os
        >>os.getpid ()
        3504
        >>>
        </dump>

        TJG

        Comment

        • Fredrik Lundh

          #5
          Re: get process id...

          billie wrote:
          >under linux, do:
          >
          > import os
          > os.getpid()
          >
          Under Windows:
          >
          import ctypes
          ctypes.windll.k ernel32.GetCurr entProcessId()
          getpid() works just fine on Windows too:
          >>import ctypes
          >>ctypes.windll .kernel32.GetCu rrentProcessId( )
          1916
          >>import os
          >>os.getpid()
          1916

          </F>

          Comment

          • Chris

            #6
            Re: get process id...

            SpreadTooThin wrote:
            How does one get the process id?
            Is there a method for windows and unix (mac os x etc...)
            >


            hth

            Comment

            • billie

              #7
              Re: get process id...


              Fredrik Lundh ha scritto:
              billie wrote:
              >
              under linux, do:
              >
              import os
              os.getpid()
              Under Windows:
              >
              import ctypes
              ctypes.windll.k ernel32.GetCurr entProcessId()
              >
              getpid() works just fine on Windows too:
              >
              >>import ctypes
              >>ctypes.windll .kernel32.GetCu rrentProcessId( )
              1916
              >>import os
              >>os.getpid()
              1916
              I tought it doesn't work. Good

              Comment

              Working...