import - Python ImportError: No module named wmi -


I followed the instructions for downloading WMI for Python

When I try to run the code for C.Win32_Service (StartMode = "Auto", state = "Stopped")

  import wmi c = wmi.WMI (): if Raw_input ("restart% s?"% S.Caption) .upper () == "Y": s.StartService ()  

I got the error

 < Code> traceback (most recent call end): file ". \", Line 1,  

edit:

I am using Python 2.7.6

EDIT2:

I am running 64-bit Windows 2008 R2, and I've downloaded WMI-1.4.9.zip (md5). I removed the content and put it in D: Python \ Tools \ Scripts I executed

  dragon setup.py.install  

I said D : \ Python \ tools \ scripts to% PATH% and when I execute the code for C.Win32_Service (StartMode = "Auto", state = "Stopped")

  import wmi c = Wmi.WMI (): If raw_input ("Restart% s?"% S. Caption). () == "Y": s.StartService ()  

error me Gets

  traceback (most recent call final): File ". See \", line 1, & lt; Module & gt; Import wmi file "D: \ Python \ lib \ site-packages \ wi.py", line 88, & lt; Module & gt; GetObject import from Win32com.client Import, Dispatch Import: There is no module named win32com.client  

EDIT3:

Now I have Python 2.7.6 and installation is D : \ Python 27

I removed WMI-1.4.9.zip in the D drive and performed the following

  PSD: \ WMI-1.4.9> Python \ Setup.py install  

and

  Creating ongoing build_py build build build build \ lib create creating \ lib copy Wmi.py - & gt; Build \ lib builds build_scripts running \ scripts-2.7 copy wmitest.py - & gt; Build \ scripts-2.7 copy wmiweb.py - & gt; Build \ scripts-2.7 copy wmitest.cmd - & gt; Build \ scripts-2.7 copy wmitest.master.ini - & gt; Build \ scripts-2.7 running install_lib copy build \ lib \ wi.py - & gt; Running install_scripts to install D: \ Python27 \ Lib \ site-package byte-compiling D: \ Python 27 \ LibSite-package \ wi.py wi.pyc D: \ Python 27 \ scripting copy of scripts- 2.7 \ wmitest.cmd - & gt; D: \ Python27 \ Scripts copying script- 2.7 \ wmitest.master.ini - & gt; D: \ Python27 \ Duplicate scripts \ script- 2.7 \ wmitest.py - & gt; D: \ Python27 \ Scripts that copy the scripts- 2.7 \ wmiweb.py - & gt; D: \ Python27 \ scriptwriting is running an install_data alert: install_data: Setup script did not provide a directory for 'readme.txt' - the right 'D: \ Python27' running_egg_info write D: \ Python27 \ Lib \ site- Packages \ WMI-1.4.9-py2.7.egg-info  

But when I execute my original code, I get the same error

  PS D: \ SymantecDLP \ defense & gt; Python. \ See_wmi.pyTestback (the most recent call final): File ". \" View_wmi.py ", line 1, & lt; Module & gt; Import wmi file "D: \ Python27 \ lib \ site-packages \ wi.py", line 88, & lt; Module & gt; GetObject, Dispatch Import from Win32com.client Import: There is no module named Win32com.client  

EDIT4:

and I have the following% PATH%

< Previous> D: \ Python27; D: \ Python27 \ Lib \, D: \ Python27 \ Lib \ site-packages

I got it.

I need to install Python for Windows extension

Since I am using Python 2.7.6 on 64 -bit server I have installed pywin32-218. win-amd64-py2.7.exe


Comments

Popular posts from this blog

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -