pyspeech icon indicating copy to clipboard operation
pyspeech copied to clipboard

ImportError: DLL load failed: win32api, sys, os

Open GoogleCodeExporter opened this issue 10 years ago • 14 comments

What steps will reproduce the problem?
1.Installed easy_install, set its path variable(C:\Python25\Scripts), installed 
the .egg by opening cmd from C:\Python25\Scripts, executing the command 
"easy_install speech-0.5.2-py2.5" (because that command didn't work from 
anywhere else, even after setting the PATH variable as mentioned above)
Tried "import speech" and got some win32com error.. I saw the instructions 
again, realised i didn't have pywin32.
And so i installed "pywin32-216.win32-py2.5.exe", just click click click.. done.

2. tried "import speech" on Python Shell. Worked. Arighty! *Le me happy*

3. Copied the first program on Project Home :
##################
import speech

while True:
    phrase = speech.input()
    speech.say("You said %s" % phrase)
    if phrase == "turn off":
        break
##################

and executed it, and got this:

###################################
Traceback (most recent call last):
  File "C:\Python25\speech\myPyListener.py", line 1, in <module>
    import speech
  File "C:\Python25\lib\site-packages\speech-0.5.2-py2.5.egg\speech.py", line 55, in <module>
  File "C:\Python25\Lib\site-packages\win32com\__init__.py", line 5, in <module>
    import win32api, sys, os
ImportError: DLL load failed: The specified module could not be found.
###################################

What version of the product are you using? On what operating system?

I'm using python python 2.5.4 (i also have python 2.7.2 but in your project 
page it said python 2.4 or 2.5 so i'm using 2.5)
My OS is Windows Vista Home Premium SP1 32 bit, with SR already installed. I 
mean i get that little rectangle asking me to "say start listening" etc when i 
have to execute SR, so i guess i don't need SAPI or any related download


Original issue reported on code.google.com by [email protected] on 19 Jan 2012 at 2:33

GoogleCodeExporter avatar Mar 19 '15 13:03 GoogleCodeExporter

okay, just had a last moment doubt that i hadn't researched my problem well..

i found this:
http://code.activestate.com/lists/python-win32/10519/

and it seemed that win32*.pyd (which really are DLLs) could not be found, as 
according to that guy Frekin John

So i copied the 30 *.pyd files and placed them right next to 
C:\Python25\python.exe
and i tried the program again. It worked.

For all others out there just starting out:
30 files i copied constituted of 28 "win32*.pyd" name-form files, and remaining 
2 were "winxpgui.pyd" and "win2kras.pyd"

Happy programming!
BTW, authors of this wrapping, great work! This work of accessing the SAPI in C 
is really hectic (my friend is actually making a project on SR based action 
executor) and i wanted to show him he can drastically reduce his efforts by 
using python

Original comment by [email protected] on 19 Jan 2012 at 2:50

GoogleCodeExporter avatar Mar 19 '15 13:03 GoogleCodeExporter

Original comment by [email protected] on 19 Nov 2012 at 4:19

GoogleCodeExporter avatar Mar 19 '15 13:03 GoogleCodeExporter

Original comment by [email protected] on 19 Nov 2012 at 4:19

GoogleCodeExporter avatar Mar 19 '15 13:03 GoogleCodeExporter

Trying the same same copy-paste .pyd files solution on Windows Server 2012 R2 with Python 3.5.0 and it does not work. I still get the same "DLL load failed" error.

vadimFRG avatar Oct 05 '16 23:10 vadimFRG

@vadimFRG it may be realted to MSVCR100.dll, "Microsoft Visual C++ 2010 Redistributable Package" incase its not installed, here is a link:

http://www.faqforge.com/windows/fix-the-program-cant-start-because-msvcr100-dll-is-missing-from-your-computer-error-on-windows/

smohtasib avatar Dec 06 '16 13:12 smohtasib

I have the same problem for days, but one day I solved it. After you installed the pywin32 libs, there is a directory "Lib/site-packages/pywin32_system32", which including three dll libs, copy them to the "/Lib/site-packages/win32" directory, which including the win32api.pyd or win32api.pyc. There will be no ImportError Exception any more

lmingzhi618 avatar Feb 19 '17 12:02 lmingzhi618

@mingzhi198 谢谢,这是pywin32.exe的bug。

gshmu avatar Apr 06 '17 03:04 gshmu

After you installed the pywin32 libs, there is a directory "Lib/site-packages/pywin32_system32", which including three dll libs, copy them to the "/Lib/site-packages/win32" directory, which including the win32api.pyd or win32api.pyc.

This works for me. For Python 3.6.1, there are 2 dll files to copy. Thanks, @mingzhi198.

great-analyzer avatar Apr 18 '17 03:04 great-analyzer

@great-analyzer I am glad to help. And my environment is python 2.7.13.

lmingzhi618 avatar May 01 '17 15:05 lmingzhi618

thanks @mingzhi198 @great-analyzer , I get the same error, too, and now solved.

TrumanCai avatar Jan 29 '18 06:01 TrumanCai

It solves the issue for me in python3.6.4. There were only 2 DLLs to be copied.

joshiji avatar Feb 13 '18 10:02 joshiji

Mine didn't work after a vanilla Python 2.7 install on Windows. Just ran > pip install pywin32

and now everything works as expected

pojda avatar Apr 16 '18 17:04 pojda

I have the same problem for days, but one day I solved it. After you installed the pywin32 libs, there is a directory "Lib/site-packages/pywin32_system32", which including three dll libs, copy them to the "/Lib/site-packages/win32" directory, which including the win32api.pyd or win32api.pyc. There will be no ImportError Exception any more

Thanks a lot.I was stuck at this problem for a real long time.Saviour :)

SUSHMITAH avatar Sep 13 '19 04:09 SUSHMITAH

okay, just had a last moment doubt that i hadn't researched my problem well..

i found this:
http://code.activestate.com/lists/python-win32/10519/

and it seemed that win32*.pyd (which really are DLLs) could not be found, as 
according to that guy Frekin John

So i copied the 30 *.pyd files and placed them right next to 
C:\Python25\python.exe
and i tried the program again. It worked.

For all others out there just starting out:
30 files i copied constituted of 28 "win32*.pyd" name-form files, and remaining 
2 were "winxpgui.pyd" and "win2kras.pyd"

Happy programming!
BTW, authors of this wrapping, great work! This work of accessing the SAPI in C 
is really hectic (my friend is actually making a project on SR based action 
executor) and i wanted to show him he can drastically reduce his efforts by 
using python

Original comment by [email protected] on 19 Jan 2012 at 2:50

How can I get those DLL?I am newly learning .So bit confused here. Also what are "winxpgui.pyd" and "win2kras.pyd" ??

rakaliku avatar Oct 09 '19 04:10 rakaliku