Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53579 > unrolled thread

Re: can't find win32api from embedded pyrun call

Started by"David M. Cotter" <me@davecotter.com>
First post2013-09-03 13:50 -0700
Last post2013-09-04 08:50 +0100
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: can't find win32api from embedded pyrun call "David M. Cotter" <me@davecotter.com> - 2013-09-03 13:50 -0700
    Re: can't find win32api from embedded pyrun call "David M. Cotter" <me@davecotter.com> - 2013-09-03 21:32 -0700
    Re: can't find win32api from embedded pyrun call Tim Golden <mail@timgolden.me.uk> - 2013-09-04 08:50 +0100

#53579 — Re: can't find win32api from embedded pyrun call

From"David M. Cotter" <me@davecotter.com>
Date2013-09-03 13:50 -0700
SubjectRe: can't find win32api from embedded pyrun call
Message-ID<f6b9a3a7-8733-42bd-9af0-e348562aa1b5@googlegroups.com>
I find i'm having this problem, but the solution you found isn't quite specific enough for me to be able to follow it. 

I'm embedding Python27 in my app.  I have users install ActivePython27 in order to take advantage of python in my app, so the python installation can't be touched as it's on a user's machine.

When I attempt to do:
>import win32api

i get this:
>Traceback (most recent call last):
>  File "startup.py", line 5, in <module>
>ImportError: DLL load failed: The specified module could not be found.

I someone suggested i manually load the dependent libraries in the correct order, like this:

>import pywintypes
>import pythoncom
>import win32api

but then i get this:
>Traceback (most recent call last):
>  File "startup.py", line 3, in <module>
>  File "C:\Python27\lib\site-packages\win32\lib\pywintypes.py", line 124, in <module>
>    __import_pywin32_system_module__("pywintypes", globals())
>  File "C:\Python27\lib\site-packages\win32\lib\pywintypes.py", line 64, in __import_pywin32_system_module__
>    import _win32sysloader
ImportError: DLL load failed: The specified module could not be found.

the ultimate goal here is actually to do this:
>from win32com.client.gencache import EnsureDispatch

which currently yields:
>Traceback (most recent call last):
>  File "startup.py", line 3, in <module>
>  File "C:\Python27\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.

So, if anyone has any idea, that would be super duper great.  thanks so much!

notes: my paths are definitely set correctly

[toc] | [next] | [standalone]


#53596

From"David M. Cotter" <me@davecotter.com>
Date2013-09-03 21:32 -0700
Message-ID<36a4e567-e3d9-4bc3-99d7-42f22020ca0b@googlegroups.com>
In reply to#53579
note that when the script is called, i DO see this in the output window:

> 'kJams 2 Debug.exe': Loaded 'C:\Python27\Lib\site-packages\win32\win32api.pyd'
> 'kJams 2 Debug.exe': Loaded 'C:\Windows\SysWOW64\pywintypes27.dll'
> 'kJams 2 Debug.exe': Unloaded 'C:\Python27\Lib\site-packages\win32\win32api.pyd'
> 'kJams 2 Debug.exe': Unloaded 'C:\Windows\SysWOW64\pywintypes27.dll'

[toc] | [prev] | [next] | [standalone]


#53605

FromTim Golden <mail@timgolden.me.uk>
Date2013-09-04 08:50 +0100
Message-ID<mailman.31.1378281062.5461.python-list@python.org>
In reply to#53579
On 03/09/2013 21:50, David M. Cotter wrote:
> I find i'm having this problem, but the solution you found isn't
> quite specific enough for me to be able to follow it.
> 
> I'm embedding Python27 in my app.  I have users install
> ActivePython27 in order to take advantage of python in my app, so the
> python installation can't be touched as it's on a user's machine.
> 
> When I attempt to do:
>> import win32api
> 
> i get this:
>> Traceback (most recent call last): File "startup.py", line 5, in
>> <module> ImportError: DLL load failed: The specified module could
>> not be found.

You'll likely get more input from the guys on the python-win32 list.

Most times I've come across this issue it's been because the pywin32
package (or the whole Python distribution if you're using ActiveState)
was not installed as an administrator / elevated. I'm not sure I've ever
fathomed why, and the investigation isn't helped by the import dance
which the pywin32 code does. I don't remember solving it without a
reinstall on the user's machine.

TJG

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web