Author: jerome
Date: 2009-12-08 11:45:38 +0100 (Tue, 08 Dec 2009)
New Revision: 5947

Modified:
   
software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/utils.py
Log:
* Changed the way to check for Skype client Windows process.

Modified: 
software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/utils.py
===================================================================
--- 
software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/utils.py
  2009-12-07 14:27:59 UTC (rev 5946)
+++ 
software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/utils.py
  2009-12-08 10:45:38 UTC (rev 5947)
@@ -62,18 +62,15 @@
     
     
     def __is_running_windows__(self):
-        '''
         '''
-        try:
-            cmd = ["tasklist", "/FI", "IMAGENAME eq skype.exe"]
-            process = subprocess.Popen(cmd, stdin = subprocess.PIPE, stdout = 
subprocess.PIPE)
-            values = process.stdout.read().lower()
-            values = values.split()
-            return ( "skype.exe" in values ) or ( 'Skype.exe' in values )
-        except:
-            return False
+        Check for Skype client process.
+        '''
+        from win32com.client import GetObject
+        WMI = GetObject('winmgmts:')
+        processes = WMI.InstancesOf('Win32_Process')
+        return ( "skype.exe" in processes ) or ( 'Skype.exe' in processes )
+        
     
-    
     def __start_skype_linux__(self):
         '''
         Start skype on linux.
@@ -164,7 +161,8 @@
     def isSkypeClientInstalled():
         '''
         Return true is skype client is installed, false otherwise.
-        '''
+        '''
+
         if os.name != 'nt':
             #Checking path for skype.
             for path in ( os.environ['PATH'].split(':') ):
@@ -180,7 +178,8 @@
             if ( 'skype' in res ) or ( 'Skype' in res ):
                 return True
              
-        return False
+        return False
+        
 
 
     isSkypeClientInstalled = staticmethod(isSkypeClientInstalled)


------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to