I'm using the ClearCase Automation Library and I'm getting different
behaviors between Python (via the PyWin32 library) and PERL (via the OLE
library). In the examples below, I'm trying to get a list of views and
purposely ensuring that I am not in a directory associated with a view.
So, starting in new command window and in the same non-view directory,
when I execute the PERL example from IBM , I get a list of views
(command is "perl C:\Python31\view.pl"). When I execute the Python
script from the same directory and with command of "C:\Python31\python
C:\Python31\comtest.py", I get the following exception:
Traceback (most recent call last):
File "C:\Python31\comtest.py", line 13, in <module>
allViews = ccApp.Views("False", "local")
File "C:\Python31\lib\site-packages\win32com\client\__init__.py", line
463, in __getattr__
return self._ApplyTypes_(*args)
File "C:\Python31\lib\site-packages\win32com\client\__init__.py", line
456, in _ApplyTypes_
self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes,
*args),
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0,
'ClearCase.Application.1', 'No view is set, and current working
directory is not in a view.\r\n', None, 0, -2147
467259), None)
So, is there a difference/limitation using the COM interface via Python
windows extensions and the OLE interface in PERL?
===============================================================
use Win32::OLE;
$DEBUG = 1;
print "Instantiating CAL CC\n" if $DEBUG;
my $cal_cc = Win32::OLE->new('ClearCase.Application')
or die "Could not create the ClearCase Application object\n";
$cclsview = $cal_cc->Views("False","local");
$Views_Entries = $cclsview->Count;
print "nbViews $Views_Entries\n";
$Views_Index = 1;
while ($Views_Index <= $Views_Entries) {
print "Processing View entry $CS_Index\n" if $DEBUG;
$View = $cclsview->Item($Views_Index);
$ViewName = $View->TagName;
$ViewIsSnapshot = $View->IsSnapShot;
print "View $ViewName $ViewIsSnapshot\n";
$Views_Index++;
}
And use the following Python (ver 3.1, using Python extensions version
214) script,
import win32com.client
import sys
ccApp = win32com.client.Dispatch("ClearCase.Application")
allViews = ccApp.Views("False", "local")
vob = ccApp.VOB("\MYVOB")
print ("TagName = ", vob.TagName)
print ("IsMounted = ", vob.IsMounted)
view = ccApp.View
print ("Tag = ", view.TagName)
list = view.ConfigSpec
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32