EvilZone

Programming and Scripting => Scripting Languages => : pyte December 09, 2012, 08:21:08 AM

: missing python modules
: pyte December 09, 2012, 08:21:08 AM
hello residents,
im geting this kind of errors:

:
"import wmi
c = wmi.WMI ("some_other_machine")


Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import wmi
  File "C:\Python27\lib\site-packages\wmi.py", line 88, in <module>
    from win32com.client import GetObject, Dispatch
  File "C:\Python27\lib\site-packages\win32com\__init__.py", line 5, in <module>
    import win32api, sys, os
ImportError: No module named win32api
>>> "

im geting xo fucked up .. where do i get modules for this python dear??
: Re: missing python modules
: s3my0n December 09, 2012, 09:20:57 AM
This is double post lol :P

http://sourceforge.net/projects/pywin32/
: Re: missing python modules
: pyte December 09, 2012, 09:25:13 AM
been there severally n nothing seems to work for me.
could it be my windows 7 32 bit?
: Re: missing python modules
: s3my0n December 09, 2012, 11:33:23 AM
So after you install that module, you still get that error?
: Re: missing python modules
: pyte December 09, 2012, 01:12:58 PM
yap! its simply not going away
is there a way to update all modules coz i wonder if the others are still ok.
: Re: missing python modules
: Kulverstukas December 09, 2012, 05:21:02 PM
You probably did it wrong.
Extract your libs in %python_dir%/lib/site-packages
Or have it in the same folder as the script.
: Re: missing python modules
: pyte December 09, 2012, 05:26:00 PM
now i see where i'm loosing it all!
a few corrections on where i was placing it and it now works like charm!
thanx a lot Residents lets code on..
: Re: missing python modules
: IrishYoga January 25, 2013, 03:40:02 AM
Same thing is happening with me. I've located where my python sys.py script is and i try to put my modules in there, but they don't work. I thought it was just not accepting any module i would throw at it, so i decided to copy the code of a pre-existing module and name it something else and try to run it. when i imported "test" it would work,but not when i would make my own scripts. Is there anything different needed to insert into my python script when storing modules?
: Re: missing python modules
: vezzy January 25, 2013, 03:55:40 AM
Same thing is happening with me. I've located where my python sys.py script is and i try to put my modules in there, but they don't work. I thought it was just not accepting any module i would throw at it, so i decided to copy the code of a pre-existing module and name it something else and try to run it. when i imported "test" it would work,but not when i would make my own scripts. Is there anything different needed to insert into my python script when storing modules?

Wait, are you using your own scripts as modules?

If so, you need a (typically blank) file by the name of __init__.py in the directory where your scripts are located, so that Python will read it as a package container, allowing you to import modules.

See here (http://docs.python.org/2/tutorial/modules.html#packages).
: Re: missing python modules
: IrishYoga February 05, 2013, 06:55:43 AM
Thanks! Sorry i answered so late, but it worked, thanks a lot!
: Re: missing python modules
: techb February 05, 2013, 09:35:24 PM
I would also recommend using setup.py or easy_install instead of cp to the site-packages