[python-win32] [Re: getting email adresses from outlook]

2005-06-06 Thread Jürgen Kareta
Hi Tony,



 I've written a python program which loops over an Outlook distribution 
 list, so I can pull off the names of the people on it.
 When my program tries to run Outlook, Outlook pops up a Dialoge
 I'd like to know what CDO is and how to install it.

for installing look at http://www.cdolive.com/asp1.htm. In my case I 
installed it from the Outlook 2000 cd.

For the differences look at
http://www.msexchangefaq.de/code/mapicdo.htm and
http://support.microsoft.com/kb/q200018/

regards,
Jürgen



___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] com object gives a pointer to a C++ struct array back

2005-06-06 Thread Gijs Korremans
Hi

one of the functions in a com object I have to use gives me a pointer to the 
firtst struct in an array back. With Python it's possible to use the first 
truct, but is it possible to use the others as well?

//for example:
PointerToFirstStruct = comObj.GetPackets()
argOne = PointerToFirstStruct.argOne
argTwo = PointerToFirstStruct.argTwo
# Go to the next struct
# PointerToFirstStruct++ doesn't work


Kind regards, 


Gijs 

--
This message has been scanned for viruses and
dangerous content by Network Sentry, and is
believed to be clean.
http://www.networksentry.co.za

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] getting global addressbook with extended mapi

2005-06-06 Thread Jürgen Kareta
Hello,

I followed Marks hint and tried to get my global addressbook entries 
with extended mapi.

from win32com.mapi import mapiutil
from win32com.mapi import exchange
import pprint,pythoncom
profileName = Test
session = mapi.MAPIInitialize(None)
session =mapi.MAPILogonEx(0,'test',None, mapi.MAPI_EXTENDED | 
mapi.MAPI_LOGON_UI |\
 mapi.MAPI_NO_MAIL |mapi.MAPI_USE_DEFAULT)
hr=session.OpenAddressBook(0,None,mapi.AB_NO_DIALOG)
gal = exchange.HrFindExchangeGlobalAddressList (hr)

raise:
gal = exchange.HrFindExchangeGlobalAddressList (hr)
NotImplementedError: Not available with this version of the Exchange SDK

So it seems to be that our exchange5.5 SP3 Server don't provide all 
extended mapi features. But the
DumpTopLevelFolders funktion of the class MAPIDriver in spambayes 
sandbox works fine.

How can I find a workaround to access the gal entries ?

The final solution should work like the following cdo code:
from win32com.client.dynamic import Dispatch
s=Dispatch(Mapi.session)
s.Logon(, , False, True, 0, True,\

ProfileInfo=/o=myserver/ou=myside/cn=Configuration/cn=myserver\n\nanon)
entries=s.AddressLists('Globales Adressbuch').AddressEntries.Item(my 
distribution list).Members
for entr in entries:
print entr.Name,entr.Fields(0x39fe001e).Value,entr.Fields(0x3a1e)
   
 Any hints ?

regards,
Jürgen
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Problem with gencache.EnsureModule

2005-06-06 Thread Johannes Brunen
Hi,

First, I'm new to this list as well as new to python/pythonCom.
I have tried to connect to a COM server installed on my machine
with this little script:

import win32com.client

from win32com.client import gencache

def main():
gencache.EnsureModule('{9C3BB401-114D-11D4-AC72-00105A4925FC}', 0, 1, 2)
gencache.EnsureModule('{F6B548E2-1A91-11D4-AC7B-00105A4925FC}', 0, 1, 2)
gencache.EnsureModule('{2FF5212B-C12E-11D4-AD46-00105A4925FC}', 0, 1, 2)
gencache.EnsureModule('{9C3BB403-114D-11D4-AC72-00105A4925FC}', 0, 1, 2)
gencache.EnsureModule('{D5224AA1-0F95-11D4-AC6E-00105A4925FC}', 0, 1, 2)
gencache.EnsureModule('{83273D63-C3B6-11D6-99B4-00105A492792}', 0, 1, 2)
gencache.EnsureModule('{DA061171-5185-11D4-8B25-00105A49278B}', 0, 1, 2)

theCADdy = win32com.client.Dispatch(CADdy.CADdy)

if __name__ == '__main__':
main()

I have used makepy.py -i to get the guids of the registered type libraries. 
Running
this script yields

[C:/Development/Learn/Python/COM] Test2.py
Traceback (most recent call last):
  File C:\DEVELO~1\Learn\Python\COM\test2.py, line 19, in ?
main()
  File C:\DEVELO~1\Learn\Python\COM\test2.py, line 9, in main
gencache.EnsureModule('{9C3BB401-114D-11D4-AC72-00105A4925FC}', 0, 1, 2)
  File C:\Programme\Python\Lib\site-packages\win32com\client\gencache.py, 
line 525, in EnsureModule
module = MakeModuleForTypelib(typelibCLSID, lcid, major, minor, 
progressInstance, bForDemand = bForDemand, bBuildHid
den = bBuildHidden)
  File C:\Programme\Python\Lib\site-packages\win32com\client\gencache.py, 
line 292, in MakeModuleForTypelib
makepy.GenerateFromTypeLibSpec( (typelibCLSID, lcid, major, minor), 
progressInstance=progressInstance, bForDemand =
bForDemand, bBuildHidden = bBuildHidden)
  File c:\programme\python\lib\site-packages\win32com\client\makepy.py, line 
274, in GenerateFromTypeLibSpec
gencache.AddModuleToCache(info.clsid, info.lcid, info.major, info.minor)
  File C:\Programme\Python\Lib\site-packages\win32com\client\gencache.py, 
line 555, in AddModuleToCache
mod = _GetModule(fname)
  File C:\Programme\Python\Lib\site-packages\win32com\client\gencache.py, 
line 634, in _GetModule
mod = __import__(mod_name)
  File 
C:\DOKUME~1\Arthur\LOKALE~1\Temp\gen_py\2.4\9C3BB401-114D-11D4-AC72-00105A4925FCx0x1x2\__init__.py,
 line 57
'IEnumCADdyAddIn' : '{14F65AE3-4671-11D4-8B1A-00105A49278B}',

  ^
SyntaxError: invalid syntax

Can anyone tell me what I'm doing wrong. Is this a known problem?
I'm using the ActiveState Python 2.4.1.-245 build.

With  kind regards

Johannes





Virus checked by G DATA AntiVirusKit
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Problem with gencache.EnsureModule

2005-06-06 Thread Niki Spahiev
Johannes Brunen wrote:

   File 
 C:\DOKUME~1\Arthur\LOKALE~1\Temp\gen_py\2.4\9C3BB401-114D-11D4-AC72-00105A4925FCx0x1x2\__init__.py,
  line 57

Remove encoding comment from start of this file.

HTH

Niki Spahiev
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] IIS CGI installation

2005-06-06 Thread Tim Roberts
On Sat, 4 Jun 2005 11:27:28 -0700, Robert Brewer [EMAIL PROTECTED] 
wrote

It's probably considered insecure because you are passing params (%s) to
python on the command line. Those clever hackers could find a way to
pass Nasty Things, like del C:

Performance will be intolerable, since each page request has to start
and stop the Python interpreter, which is not a quick process.



This is a dangerous exaggeration.  There are a huge number of web sites 
for which a Python CGI implementation is quite workable.  If you're 
creating a web site that will get 5 hits a minute, no one will either 
care or notice the extra half second from loading Python.  The vast 
majority of the web sites in the world fall into that category.

Now, if you're getting 100 hits a minute, then you need to look at 
another approach.  But don't waste time optimizing unnecessarily.  
First, see if you have a problem.  Then attack it.  The ease of 
developing and debugging using CGI should not be underestimated.

If you used the latter, you could use CherryPy and be on the cutting
edge of Python web development.  :) 


Here, I am in complete agreement.  There's something very appealing 
about CherryPy.  Simple, functional, understandable.

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza  Boekelheide, Inc.

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] Windows LogParser COM interface

2005-06-06 Thread Tim Roberts
On Mon, 6 Jun 2005 08:52:46 -0400, Ronnie Jones 
[EMAIL PROTECTED] wrote:

I am trying to access LogParser 2.2 through the COM interface provided
and I am having a bit of a problem.  Here is what is going on:  First up
is the VBScript version of the code then comes the Python version.

 ...

Here is the python code for the same example:

  

 import win32com.client
 objLogParser = win32com.client.Dispatch(MSUtil.LogQuery)
 objOutput = 
 win32com.client.Dispatch(MSUtil.LogQuery.NativeOutputFormat)


 objOutput.rtp = -1
 objInput = 
 win32com.client.Dispatch(MSUtil.LogQuery.FileSystemInputFormat)


 objInput.recurse = 0
 myquery = SELECT Name, Size FROM 'C:/lame/misc/*.*' ORDER BY Name ASC


 objLogParser.ExecuteBatch(myquery, objInput, objOutput)



Traceback (most recent call last):
File , line 1, in ?
File
C:\Python23\Lib\site-packages\win32com\gen_py\A7E75D86-41CD-4B6E-B4BD-C
C2ED34B3FB0x0x1x0.py, line 819, in ExecuteBatch
return self._oleobj_.InvokeTypes(2, LCID, 1, (11, 0), ((8, 1), (13, 49),
(13, 49)),szQuery, pObjectInputContext, pObjectOutputContext)
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)
  


Well, I cut and pasted your code as-is onto my XP SP2 system, and it 
worked perfectly.

As Mark said, however, you can't run this within a GUI app.  If you put 
this in a pyw file, or if you launch it with pythonw, it won't work, 
because there is no stdout to write to.  The fact that the traceback 
shows file , line 1, in ? tells me that you might be running it from 
inside a GUI, and not from a real command line.

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza  Boekelheide, Inc.

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] COM Events and Type libraries

2005-06-06 Thread Shane Holloway (IEEE)
I've been having a devil of a time trying to get events working in win32com 
with an attached Type library.  It seems like I'm missing something obvious, 
but I haven't been able to figure it out.  So I'd like to ask your collective 
wisdom!

My code is at: http://www.teuton.org/~sholloway/pyTestEvents.zip

IDL compiles into a tlb just fine, and I am able to register the COM server.  
However, when I try to run pyEventsTestUser.py, I keep getting server.policy 
errors creating the control.  (Tracebacks attached)

Thank you very much for any time you spend on this!
-Shane Holloway
[EMAIL PROTECTED] diamond2/pyTestEvents% py pyEventsTestUser.py
creating
pythoncom error: ERROR: server.policy could not create an instance.

Traceback (most recent call last):
  File C:\Python24\Lib\site-packages\win32com\server\policy.py, line 144, in 
CreateInstance
return retObj._CreateInstance_(clsid, reqIID)
  File C:\Python24\Lib\site-packages\win32com\server\policy.py, line 203, in 
_CreateInstance_
self._wrap_(myob)
  File C:\Python24\Lib\site-packages\win32com\server\policy.py, line 468, in 
_wrap_
tlb_major, tlb_minor, interfaces)
  File c:\python24\lib\site-packages\win32com\universal.py, line 35, in 
RegisterInterfaces
attr = type_info.GetTypeAttr()
exceptions.AttributeError: 'NoneType' object has no attribute 'GetTypeAttr'
pythoncom error: Unexpected gateway error

Traceback (most recent call last):
  File C:\Python24\Lib\site-packages\win32com\server\policy.py, line 144, in 
CreateInstance
return retObj._CreateInstance_(clsid, reqIID)
  File C:\Python24\Lib\site-packages\win32com\server\policy.py, line 203, in 
_CreateInstance_
self._wrap_(myob)
  File C:\Python24\Lib\site-packages\win32com\server\policy.py, line 468, in 
_wrap_
tlb_major, tlb_minor, interfaces)
  File c:\python24\lib\site-packages\win32com\universal.py, line 35, in 
RegisterInterfaces
attr = type_info.GetTypeAttr()
exceptions.AttributeError: 'NoneType' object has no attribute 'GetTypeAttr'
pythoncom error: CPyFactory::CreateInstance failed to create instance. 
(80004005)
Traceback (most recent call last):
  File pyEventsTestUser.py, line 23, in ?
oasis = client.DispatchWithEvents('Py.EventTest', PyEventTestEvents)
  File C:\Python24\Lib\site-packages\win32com\client\__init__.py, line 243, 
in DispatchWithEvents
disp = Dispatch(clsid)
  File C:\Python24\Lib\site-packages\win32com\client\__init__.py, line 95, in 
Dispatch
dispatch, userName = 
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File C:\Python24\Lib\site-packages\win32com\client\dynamic.py, line 91, in 
_GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File C:\Python24\Lib\site-packages\win32com\client\dynamic.py, line 79, in 
_GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, 
pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147467259, 'Unspecified error', None, None)

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32