Discussion:
[python-win32] Using "WEAP" API in Python
Kasra Keshavarz
2015-08-04 10:04:04 UTC
Permalink
Hi,
I'm facing problem in using WEAP <http://www.weap21.org> API in python. I
have installed WEAP correctly and have a 3.4.3 version python and also
PythonWin (all of them are 32-bit). I'm not sure why this is happening.
w = win32com.client.Dispatch("Weap.WeapApplication")
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python34\lib\site-packages\win32com\client\__init__.py", line
95, in Dispatch
dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "C:\Python34\lib\site-packages\win32com\client\dynamic.py", line
114, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python34\lib\site-packages\win32com\client\dynamic.py", line 91,
in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)


Thanks for cooperation :)
Sincerely,
Kasra Keshavarz
Tim Roberts
2015-08-04 16:41:47 UTC
Permalink
Post by Kasra Keshavarz
I'm facing problem in using WEAP <http://www.weap21.org> API in
python. I have installed WEAP correctly and have a 3.4.3 version
python and also PythonWin (all of them are 32-bit). I'm not sure why
this is happening.
w = win32com.client.Dispatch("Weap.WeapApplication")
File "<interactive input>", line 1, in <module>
File "C:\Python34\lib\site-packages\win32com\client\__init__.py",
line 95, in Dispatch
dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "C:\Python34\lib\site-packages\win32com\client\dynamic.py",
line 114, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python34\lib\site-packages\win32com\client\dynamic.py",
line 91, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)
Are you absolutely sure of the bittedness? Exactly this kind of thing
can happen if WEAP is a 32-bit application but you installed the 64-bit
Python, or vice versa.

Are you sure that the app ID is "Weap.WeapApplication"? Do you know how
to troll the registry to verify that?
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
Tim Roberts
2015-08-04 17:07:58 UTC
Permalink
Post by Tim Roberts
Are you sure that the app ID is "Weap.WeapApplication"? Do you know how
to troll the registry to verify that?
I see in the code samples that this is the correct App ID, so that's not
the issue. You might try this from VBScript and see if it works.
Create a file called test.vbs that contains:

Set WEAP = CreateObject("WEAP.WEAPApplication")
WEAP.Verbose = 4
WEAP.Logfile = "logfile.txt"

then run it.
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
Kasra Keshavarz
2015-08-04 17:35:09 UTC
Permalink
Firstly Thank you sir for helping.
I have a 64-bit Windows 8.1 Installed. Already checked with python 3.4 and
2.7. Also tried with both 64-bit and 32-bit versions of python. WEAP itself
didn't say much thing about its bit things. But I believe it's a 32-bit
program. Also, I have tried this on a 32-bit Windows 7 OS as well, but no
progress.
Well I have no idea about using Windows Registry. In some sites, they
suggest to check if there is a something in CLSID and ProgID (in windows
registry) but I couldn't find them.
As you said I created the file and again(!) I faced an error. I attach the
error pic for you.

The error message is this:


Script: C:\Users\Kasra\Desktop\test.vbs
Line: 1
Char: 1
Error: ActiveX component can't create object: "WEAP.WEAPApplication"
Code: 800A01AD
Source: Microsoft VBScript runtime error

Sorry by mistake, I sent it twice.
Post by Tim Roberts
Post by Tim Roberts
Are you sure that the app ID is "Weap.WeapApplication"? Do you know how
to troll the registry to verify that?
I see in the code samples that this is the correct App ID, so that's not
the issue. You might try this from VBScript and see if it works.
Set WEAP = CreateObject("WEAP.WEAPApplication")
WEAP.Verbose = 4
WEAP.Logfile = "logfile.txt"
then run it.
--
Providenza & Boekelheide, Inc.
_______________________________________________
python-win32 mailing list
https://mail.python.org/mailman/listinfo/python-win32
Tim Roberts
2015-08-04 17:59:30 UTC
Permalink
Post by Kasra Keshavarz
Firstly Thank you sir for helping.
I have a 64-bit Windows 8.1 Installed. Already checked with python 3.4
and 2.7. Also tried with both 64-bit and 32-bit versions of python.
WEAP itself didn't say much thing about its bit things. But I believe
it's a 32-bit program. Also, I have tried this on a 32-bit Windows 7
OS as well, but no progress.
Well I have no idea about using Windows Registry. In some sites, they
suggest to check if there is a something in CLSID and ProgID (in
windows registry) but I couldn't find them.
As you said I created the file and again(!) I faced an error. I attach
the error pic for you.
I think you're going to have to go to WEAP with this question. It
certainly looks like the WEAP installer did not register its COM
services. Does the WEAP GUI run OK?
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
Kasra Keshavarz
2015-08-04 18:03:59 UTC
Permalink
Yes, fully installed and successfully licensed. I do not think there are
enough experts in WEAP support.
Post by Tim Roberts
Post by Kasra Keshavarz
Firstly Thank you sir for helping.
I have a 64-bit Windows 8.1 Installed. Already checked with python 3.4
and 2.7. Also tried with both 64-bit and 32-bit versions of python.
WEAP itself didn't say much thing about its bit things. But I believe
it's a 32-bit program. Also, I have tried this on a 32-bit Windows 7
OS as well, but no progress.
Well I have no idea about using Windows Registry. In some sites, they
suggest to check if there is a something in CLSID and ProgID (in
windows registry) but I couldn't find them.
As you said I created the file and again(!) I faced an error. I attach
the error pic for you.
I think you're going to have to go to WEAP with this question. It
certainly looks like the WEAP installer did not register its COM
services. Does the WEAP GUI run OK?
--
Providenza & Boekelheide, Inc.
_______________________________________________
python-win32 mailing list
https://mail.python.org/mailman/listinfo/python-win32
Kasra Keshavarz
2015-08-04 18:56:48 UTC
Permalink
Well, finally find the solution. You were right. Needed to be registered.
With "WEAP /regserver" it will register itself. Then, API run successfully.
Just sending this message for archiving, for those who might face this
problem in future.
Post by Kasra Keshavarz
Yes, fully installed and successfully licensed. I do not think there are
enough experts in WEAP support.
Post by Tim Roberts
Post by Kasra Keshavarz
Firstly Thank you sir for helping.
I have a 64-bit Windows 8.1 Installed. Already checked with python 3.4
and 2.7. Also tried with both 64-bit and 32-bit versions of python.
WEAP itself didn't say much thing about its bit things. But I believe
it's a 32-bit program. Also, I have tried this on a 32-bit Windows 7
OS as well, but no progress.
Well I have no idea about using Windows Registry. In some sites, they
suggest to check if there is a something in CLSID and ProgID (in
windows registry) but I couldn't find them.
As you said I created the file and again(!) I faced an error. I attach
the error pic for you.
I think you're going to have to go to WEAP with this question. It
certainly looks like the WEAP installer did not register its COM
services. Does the WEAP GUI run OK?
--
Providenza & Boekelheide, Inc.
_______________________________________________
python-win32 mailing list
https://mail.python.org/mailman/listinfo/python-win32
Loading...