Hi,
i creates this program:

import wmi

c = wmi.WMI()
for i in c.Win32_Processor ():
    cputype = i.Name
print cputype

for i in c.Win32_ComputerSystem():
    mem = int(i.TotalPhysicalMemory)

print mem/1000000, "mb"

I make exe file with py2exe.
When i run program, i see this error:

D:\py\dist>cpu.exe
Traceback (most recent call last):
  File "cpu.py", line 1, in <module>
  File "zipextimporter.pyc", line 82, in load_module
  File "wmi.pyc", line 88, in <module>
  File "zipextimporter.pyc", line 82, in load_module
  File "win32com\__init__.pyc", line 5, in <module>
  File "zipextimporter.pyc", line 98, in load_module
ImportError: MemoryLoadLibrary failed loading win32api.pyd

What wrong?

whats the code you used to compile your code to an exe?

Compile code:

#!/usr/bin/env python
from distutils.core import setup
import py2exe

setup(
    console=["cpu.py"],
    zipfile=None
)

Program code:

import wmi

c = wmi.WMI()
for i in c.Win32_Processor ():
    cputype = i.Name
print cputype

for i in c.Win32_ComputerSystem():
    mem = int(i.TotalPhysicalMemory)

print mem/1000000, "mb"

I have to install Pywin32.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.