Discussion:
[python-win32] pythoncom
John Sampson
2014-10-14 13:37:32 UTC
Permalink
I have a proprietary program with a command interface implemented as an
ActiveX DLL. Importing win32com.client and pythoncom, I can call
functions from Python scripts. Some of these work properly in 32-bit
Windows 7, but others only in 64-bit Windows. Is this because pythoncom
is designed to work with Windows 64-bit only? Is there a version that
works with 32-bit Windows?

Regards

John Sampson
Tim Roberts
2014-10-14 17:15:09 UTC
Permalink
Post by John Sampson
I have a proprietary program with a command interface implemented as an
ActiveX DLL. Importing win32com.client and pythoncom, I can call
functions from Python scripts. Some of these work properly in 32-bit
Windows 7, but others only in 64-bit Windows. Is this because pythoncom
is designed to work with Windows 64-bit only? Is there a version that
works with 32-bit Windows?
Python is available is both 32-bit and 64-bit forms. You can use either
one on a 64-bit operating system.

However, a 64-bit process cannot call a 32-bit DLL, nor the reverse. If
your proprietary program is a 32-bit application, then you need to
install and use a 32-bit Python in order to use it.

You can't install 64-bit product on a 32-bit Windows system, so if you
are having trouble on a 32-bit Windows system, then there is something
else going on.
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
John Sampson
2014-10-15 13:50:04 UTC
Permalink
Post by Tim Roberts
Post by John Sampson
I have a proprietary program with a command interface implemented as an
ActiveX DLL. Importing win32com.client and pythoncom, I can call
functions from Python scripts. Some of these work properly in 32-bit
Windows 7, but others only in 64-bit Windows. Is this because pythoncom
is designed to work with Windows 64-bit only? Is there a version that
works with 32-bit Windows?
Python is available is both 32-bit and 64-bit forms. You can use either
one on a 64-bit operating system.
However, a 64-bit process cannot call a 32-bit DLL, nor the reverse. If
your proprietary program is a 32-bit application, then you need to
install and use a 32-bit Python in order to use it.
You can't install 64-bit product on a 32-bit Windows system, so if you
are having trouble on a 32-bit Windows system, then there is something
else going on.
The interface has a function which returns a string from an array of
strings as it is supposed to
in Windows 64-bit, or if called from VBA.
In 32-bit Windows Python it returns the number of the item in the array
instead.

Regards

John Sampson
Mark Hammond
2014-10-16 06:48:44 UTC
Permalink
Post by John Sampson
The interface has a function which returns a string from an array of
strings as it is supposed to
in Windows 64-bit, or if called from VBA.
In 32-bit Windows Python it returns the number of the item in the array
instead.
So to be clear - you have a 64bit version of Windows, and you've
installed python and pywin32 in both 32 and 64bit variants, *and* you've
installed the COM object in both 64 and 32bit variants - is that correct?

If so, I suspect the problem might be that you've run makepy (or
previously called EnsureDispatch etc) in the 64bit version but not in
the 32bit version - check the lib\site-packages\win32com\gen_py
directory and you might find the generated support in the 64bit version
and not the other.

HTH,

Mark
John Sampson
2014-10-16 09:25:10 UTC
Permalink
Post by Mark Hammond
Post by John Sampson
The interface has a function which returns a string from an array of
strings as it is supposed to
in Windows 64-bit, or if called from VBA.
In 32-bit Windows Python it returns the number of the item in the array
instead.
So to be clear - you have a 64bit version of Windows, and you've
installed python and pywin32 in both 32 and 64bit variants, *and*
you've installed the COM object in both 64 and 32bit variants - is
that correct?
If so, I suspect the problem might be that you've run makepy (or
previously called EnsureDispatch etc) in the 64bit version but not in
the 32bit version - check the lib\site-packages\win32com\gen_py
directory and you might find the generated support in the 64bit
version and not the other.
HTH,
Mark
I have the 32-bit version of Python on both computers (64-bit Windows
and 32-bit Windows), installed from the MSI file, so I have not
personally run makepy on either.
The COM object is part of the same software package, installed on both
computers. They are different versions, but I thought I had excluded
that this was where the problem lay. I will have to review this. Looking
at lib\site-packages\win32com\gen_py I see more files in the version
causing trouble than in the version that works OK.
How would I recognise the generated support you mention?

Regards

John Sampson
Mark Hammond
2014-10-20 10:27:40 UTC
Permalink
Post by John Sampson
at lib\site-packages\win32com\gen_py I see more files in the version
causing trouble than in the version that works OK.
How would I recognise the generated support you mention?
Those files *are* the generated support. Try removing all files in that
dir.

Mark
John Sampson
2014-10-20 20:17:41 UTC
Permalink
Post by Mark Hammond
Post by John Sampson
at lib\site-packages\win32com\gen_py I see more files in the version
causing trouble than in the version that works OK.
How would I recognise the generated support you mention?
Those files *are* the generated support. Try removing all files in
that dir.
Mark
Many thanks - yes, removing these files seems to have enabled the
functions that were not working.

Regards

John

Loading...