Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

win32serviceutil: ImportError: DLL load failed: The specified module could not be found

743 views
Skip to first unread message

Nagy László Zsolt

unread,
May 25, 2014, 1:40:56 PM5/25/14
to pytho...@python.org
>>> import win32service
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found

I have no problem loading the same module with Python 2.7.

Strange thing is that win32serviceutil.py is part of the pywin32
distribution, so I guess I should be able to import it, right?

Terry Reedy

unread,
May 25, 2014, 5:49:32 PM5/25/14
to pytho...@python.org
On 5/25/2014 1:40 PM, Nagy László Zsolt wrote:
> >>> import win32service
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: DLL load failed: The specified module could not be found
>
> I have no problem loading the same module with Python 2.7.

So the above is with ???

> Strange thing is that win32serviceutil.py is part of the pywin32
> distribution, so I guess I should be able to import it, right?

Make sure you have a pywin32 that matches ???. Matching includes python
version and bitness.

--
Terry Jan Reedy


Nagy László Zsolt

unread,
May 26, 2014, 2:20:26 AM5/26/14
to pytho...@python.org

2014.05.25. 23:49 keltezéssel, Terry Reedy írta:
> On 5/25/2014 1:40 PM, Nagy László Zsolt wrote:
>> >>> import win32service
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> ImportError: DLL load failed: The specified module could not be found
>>
>> I have no problem loading the same module with Python 2.7.
>
> So the above is with ???
Is with 3.4 amd64
>
>> Strange thing is that win32serviceutil.py is part of the pywin32
>> distribution, so I guess I should be able to import it, right?
>
> Make sure you have a pywin32 that matches ???. Matching includes
> python version and bitness.
It does. Installed Python 3.4.1 (64-bit) and pywin32-219 (64-bit) taken
from here:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32


Albert-Jan Roskam

unread,
May 26, 2014, 8:57:54 AM5/26/14
to Terry Reedy, pytho...@python.org
---- Original Message -----
> From: Terry Reedy <tjr...@udel.edu>
> To: pytho...@python.org
> Cc:
> Sent: Sunday, May 25, 2014 11:49 PM
> Subject: Re: win32serviceutil: ImportError: DLL load failed: The specified module could not be found
>
> On 5/25/2014 1:40 PM, Nagy László Zsolt wrote:
>>   >>> import win32service
>> Traceback (most recent call last):
>>     File "<stdin>", line 1, in <module>
>> ImportError: DLL load failed: The specified module could not be found
>>
>> I have no problem loading the same module with Python 2.7.
>
> So the above is with ???
>
>> Strange thing is that win32serviceutil.py is part of the pywin32
>> distribution, so I guess I should be able to import it, right?
>
> Make sure you have a pywin32 that matches ???. Matching includes python
> version and bitness.

In addition, c:\python27\DLLs should also be on your %PATH%:
setx PATH "%PATH%;c:\python27\DLLs"

Nagy László Zsolt

unread,
May 26, 2014, 9:24:35 AM5/26/14
to pytho...@python.org

>>> Strange thing is that win32serviceutil.py is part of the pywin32
>>> distribution, so I guess I should be able to import it, right?
>> Make sure you have a pywin32 that matches ???. Matching includes python
>> version and bitness.
> In addition, c:\python27\DLLs should also be on your %PATH%:
> setx PATH "%PATH%;c:\python27\DLLs"
Just curious: what if I don't have python2.7 installed at all? How on
earth python3.4 + pywin32 requires DLL files from python2.7 ?

BTW it did not help. Here is my path:

Path=C:\Python34\;C:\Python34\Scripts;C:\Program Files (x86)\NVIDIA
Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
Files\SlikSvn\bin;C:\texlive\2013\bin\win32;c:\Python34\DLLs;c:\Python27\DLLs

I have both Python27 and Python34 installed.

Python 3.4: "import win32service" still throws ImportError: DLL load
failed.
Python 2.7: "import win32service" succeeds

Build information:

Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64
bit (AMD64)] on win32

It is the official latest. pywin32 is also the latest (build 219).


Tim Golden

unread,
May 26, 2014, 9:32:19 AM5/26/14
to pytho...@python.org
Nagy -- could you post to the python-win32 list? There's nothing wrong
with putting it out here, but I don't know if the pywin32 guys hang out
here, and I know they definitely do there. (Which is also lower volume).

I'm not seeing any changes to the win32service code, but a "missing DLL"
error is almost always about some combination of permissions / UAC on
install. Adding anything to your PATH is unlikely to help (unless you
have a truly outlandish PATH).

I'll try to reproduce later if I can but I don't have time right now.

TJG

cjgo...@gmail.com

unread,
May 26, 2014, 11:06:07 AM5/26/14
to
On Monday, May 26, 2014 6:32:19 AM UTC-7, Tim Golden wrote:
Python 3.4 does not run any bdist_wininst postinstall scripts. Try to run `C:\Python34\python.exe C:\Python34\Scripts\pywin32_postinstall.py -install` manually from an elevated command prompt.

Christoph

Nagy László Zsolt

unread,
May 26, 2014, 3:18:10 PM5/26/14
to pytho...@python.org

> Python 3.4 does not run any bdist_wininst postinstall scripts. Try to run `C:\Python34\python.exe C:\Python34\Scripts\pywin32_postinstall.py -install` manually from an elevated command prompt.
>
> Christoph
C:\>C:\Python34\python.exe C:\Python34\Scripts\pywin32_postinstall.py
-install
Copied pythoncom34.dll to C:\Python34\pythoncom34.dll
Copied pywintypes34.dll to C:\Python34\pywintypes34.dll
You do not have the permissions to install COM objects.
The sample COM objects were not registered.
-> Software\Python\PythonCore\3.4\Help[None]=None
-> Software\Python\PythonCore\3.4\Help\Pythonwin
Reference[None]='C:\\Python34\\
Lib\\site-packages\\PyWin32.chm'
Pythonwin has been registered in context menu
Creating directory C:\Python34\Lib\site-packages\win32com\gen_py
Can't install shortcuts -
'C:\\Users\\Laci\\AppData\\Roaming\\Microsoft\\Windows
\\Start Menu\\Programs\\Python 3.4' is not a folder
The pywin32 extensions were successfully installed.

C:\>python
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64
bit (AM
D64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import win32service
>>>

Thanks!

Nagy László Zsolt

unread,
May 26, 2014, 3:22:10 PM5/26/14
to pytho...@python.org

> Python 3.4 does not run any bdist_wininst postinstall scripts. Try to run `C:\Python34\python.exe C:\Python34\Scripts\pywin32_postinstall.py -install` manually from an elevated command prompt.
Much better when ran as an administrator:

C:\Python\Projects\test>C:\Python34\python.exe
C:\Python34\Scripts\pywin32_postinstall.py -install
Copied pythoncom34.dll to C:\Windows\system32\pythoncom34.dll
Copied pywintypes34.dll to C:\Windows\system32\pywintypes34.dll
Registered: Python.Interpreter
Registered: Python.Dictionary
Registered: Python
-> Software\Python\PythonCore\3.4\Help[None]=None
-> Software\Python\PythonCore\3.4\Help\Pythonwin
Reference[None]='C:\\Python34\\Lib\\site-packages\\PyWin32.chm'
Pythonwin has been registered in context menu
Shortcut for Pythonwin created
Shortcut to documentation created
The pywin32 extensions were successfully installed.


I wonder why is a difference between 2.7 and 3.4 in this?
0 new messages