<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I am trying to access LogParser 2.2 through the COM
interface provided and I am having a bit of a problem.&nbsp; Here is what is going
on:&nbsp; First up is the VBScript version of the code then comes the Python version.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Set objLogParser = CreateObject(&quot;MSUtil.LogQuery&quot;)
Set objInputFormat =<br>
_<br>
CreateObject(&quot;MSUtil.LogQuery.FileSystemInputFormat&quot;)<br>
objInputFormat.recurse = 0<br>
Set objOutputFormat = _<br>
CreateObject(&quot;MSUtil.LogQuery.NativeOutputFormat&quot;)<br>
objOutputFormat.rtp = -1<br>
strQuery = &quot;SELECT Name, Size FROM 'C:\Program Files\Log Parser 2.2\*.*'<br>
<br>
ORDER BY Name ASC&quot;<br>
objLogParser.ExecuteBatch strQuery, objInputFormat, objOutputFormat<br>
<br>
When I installed Log Parsers 2.2 on WinXP home edition SP1 version 2002<br>
it went in c:\Program Files\Log Parser 2.2 and then I ran regsvr32<br>
LogParser.dll from that directory. The error I get is :<br>
<br>
Error executing query:Error while writing to file: The handle is<br>
invalid.<br>
<br>
NOW!! This occurs when I run the script from the command line just by typing
the script name and letting XP load cscript. However if I type:<br>
cscript test.vbs from the command line it runs ok. Now what I am trying to do
is program this interface from ActiveState python 2.3 with win32com extentions.
Everything works fine but when I run the script I get the same error I get when
I type 'test.vbs' at the command line. Python is my main language and I would
really like to make it work. It seems like there is some condition of having
the script directly called from 'cscript' for the COM interface to work. Does
anyone know the workings of the COM interface. I understand the API, but how
are the calls being made. Here is the python code for the same example:<br>
<br>
&gt;&gt;&gt; import win32com.client<br>
&gt;&gt;&gt; objLogParser =
win32com.client.Dispatch(&quot;MSUtil.LogQuery&quot;)<br>
&gt;&gt;&gt; objOutput =
win32com.client.Dispatch(&quot;MSUtil.LogQuery.NativeOutputFormat&quot;)<br>
&gt;&gt;&gt; objOutput.rtp = -1<br>
&gt;&gt;&gt; objInput = win32com.client.Dispatch(&quot;MSUtil.LogQuery.FileSystemInputFormat&quot;)<br>
&gt;&gt;&gt; objInput.recurse = 0<br>
&gt;&gt;&gt; myquery = &quot;SELECT Name, Size FROM 'C:/lame/misc/*.*' ORDER BY
Name ASC&quot;<br>
&gt;&gt;&gt; objLogParser.ExecuteBatch(myquery, objInput, objOutput)<br>
<br>
Traceback (most recent call last):<br>
File &quot;<INTERACTIVE input>&quot;, line 1, in ?<br>
File
&quot;C:\Python23\Lib\site-packages\win32com\gen_py\A7E75D86-41CD-4B6E-B4BD-CC2ED34B3FB0x0x1x0.py&quot;,
line 819, in ExecuteBatch<br>
return self._oleobj_.InvokeTypes(2, LCID, 1, (11, 0), ((8, 1), (13, 49), (13,
49)),szQuery, pObjectInputContext, pObjectOutputContext)<br>
com_error: (-2147352567, 'Exception occurred.', (0, 'CLogQueryClass', 'Error
executing query: Error while writing to file: The handle is invalid. [The
handle is invalid.]', None, 0, -2147024890), None)<br>
<br>
<br>
Any ideas would be appreciated. I can run the select command at the<br>
command line using LogParser.exe and all is well but not with COM.<br>
<br>
Thank you,<br>
<br>
Ronnie Jones</span><o:p></o:p></span></font></p>

</div>

</body>

</html>