From Greg.Lindstrom at acxiom.com Wed Oct 1 10:51:56 2003 From: Greg.Lindstrom at acxiom.com (Lindstrom Greg - glinds) Date: Wed Oct 1 12:01:52 2003 Subject: [python-win32] Accessing Exchange Server Message-ID: Greetings- I'm new to the win32 list but hope you can help me out. I am connecting to a Microsoft Exchange Server via python from a Windows 2000 "Professional" box using the technique from Mark Hammond's book "Python Programming on Win32". I can read subject lines, get senders, and access the text of messages (all very easily), but I am wanting to mark messages as "read" and delete them to the deleted messages folder. I have attempted to read through the documentation on MAPI, but I can't make heads or tails out of it. Do any of you know how to do the above tasks? Or can you help me understand the MAPI documentation? Thanks for your help --greg lindstrom ********************************************************************** The information contained in this communication is confidential, is intended only for the use of the recipient named above, and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please re-send this communication to the sender and delete the original message or any copy of it from your computer system. Thank You. From simon at meru.org.uk Fri Oct 3 09:33:54 2003 From: simon at meru.org.uk (Simon Judge) Date: Fri Oct 3 09:26:49 2003 Subject: [python-win32] 'No such interface supported' error after makepy Message-ID: Hi, I am trying to use win32all to export some information to word. I tried a simple program e.g: http://p-nand-q.com/python/ms_office.html which worked... and TestMSOffice.py which also worked. I then used makepy.py and testmakepy.py ... after this the examples stopped working! Why?! (error below). I've tried removing the gen_py folder, however this makes no difference... Help! Thanks. Simon --- Error: None: (-2147467262, 'No such interface supported', None, None) Traceback (innermost last): File "", line 1, in ? File "\\Server\meru documents\Project Files\Interface Centre\Python\Dialog Test\word.py", line 6, in ? word = win32com.client.Dispatch("Word.Application") File "C:\Program Files\Python\231\Lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File "C:\Program Files\Python\231\Lib\site-packages\win32com\client\dynamic.py", line 84, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "C:\Program Files\Python\231\Lib\site-packages\win32com\client\dynamic.py", line 72, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) From bgailer at alum.rpi.edu Fri Oct 3 09:40:09 2003 From: bgailer at alum.rpi.edu (Bob Gailer) Date: Fri Oct 3 09:42:29 2003 Subject: [python-win32] 'No such interface supported' error after makepy In-Reply-To: References: Message-ID: <6.0.0.22.0.20031003073627.034d4b20@66.28.54.253> At 07:33 AM 10/3/2003, Simon Judge wrote: >Hi, I am trying to use win32all to export some information to word. > >I tried a simple program e.g: http://p-nand-q.com/python/ms_office.html >which worked... and TestMSOffice.py which also worked. > >I then used makepy.py and testmakepy.py ... after this the examples >stopped working! Why?! (error below). One reason for differences after makepy is that names become case sensitive. But it seems to me that led to attribute error. Bob Gailer bgailer@alum.rpi.edu 303 442 2625 -------------- next part -------------- --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.521 / Virus Database: 319 - Release Date: 9/23/2003 From henni at brainbot.com Fri Oct 3 09:34:22 2003 From: henni at brainbot.com (Thorsten Henninger) Date: Fri Oct 3 09:49:14 2003 Subject: [python-win32] 'No such interface supported' error after makepy In-Reply-To: References: Message-ID: <3F7D7ADE.5060204@brainbot.com> Hi, have you tried the "COM Makeoy utility" in Pythonwin (Menu Tools) to create the gen_py files? I had similar problems and that helped. Thorsten Simon Judge wrote: >Hi, I am trying to use win32all to export some information to word. > >I tried a simple program e.g: http://p-nand-q.com/python/ms_office.html >which worked... and TestMSOffice.py which also worked. > >I then used makepy.py and testmakepy.py ... after this the examples >stopped working! Why?! (error below). > >I've tried removing the gen_py folder, however this makes no >difference... > >Help! > >Thanks. > >Simon > >--- >Error: > >None: (-2147467262, 'No such interface supported', None, None) > >Traceback (innermost last): > >File "", line 1, in ? > >File "\\Server\meru documents\Project Files\Interface >Centre\Python\Dialog Test\word.py", line 6, in ? > word = win32com.client.Dispatch("Word.Application") >File "C:\Program >Files\Python\231\Lib\site-packages\win32com\client\__init__.py", line >95, in Dispatch > dispatch, userName = >dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) >File "C:\Program >Files\Python\231\Lib\site-packages\win32com\client\dynamic.py", line 84, >in _GetGoodDispatchAndUserName > return (_GetGoodDispatch(IDispatch, clsctx), userName) >File "C:\Program >Files\Python\231\Lib\site-packages\win32com\client\dynamic.py", line 72, >in _GetGoodDispatch > IDispatch = >pythoncom.CoCreateInstance(IDispatch, None, clsctx, >pythoncom.IID_IDispatch) > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > > -- brainbot technologies AG boppstrasse . 64 . 55118 mainz . germany fon +49 6131 211639-1 . fax +49 6131 211639-2 http://brainbot.com/ mailto:henni@brainbot.com From simon at meru.org.uk Fri Oct 3 10:08:40 2003 From: simon at meru.org.uk (Simon Judge) Date: Fri Oct 3 10:01:34 2003 Subject: [python-win32] 'No such interface supported' error after makepy Message-ID: > -----Original Message----- > From: Bob Gailer [mailto:bgailer@alum.rpi.edu] > One reason for differences after makepy is that names become case > sensitive. But it seems to me that led to attribute error. How should I resolve this then? Which names become case sensitive and how do I find out the case? I really want to roll back makepy anyway so I don't have to run it on all the machines that I put my program on... Why when I delete the gen_py directory does the same error still occur? > -----Original Message----- > From: Thorsten Henninger [mailto:henni@brainbot.com] > have you tried the "COM Makeoy utility" in Pythonwin (Menu Tools) to > create the gen_py files? Does that not just run makepy.pyc ??? Rerunning makepy.pyc does not seem to solve my problem. I've just noticed that the program does get as far as launching Word (it appears in the Task Manager Process List). This is really frustrating since I saw it working at one point!!! Cheers for the help. Simon > -----Original Message----- > From: Bob Gailer [mailto:bgailer@alum.rpi.edu] > Sent: 03 October 2003 14:40 > To: Simon Judge; python-win32@python.org > Subject: Re: [python-win32] 'No such interface supported' error after > makepy > > > At 07:33 AM 10/3/2003, Simon Judge wrote: > > >Hi, I am trying to use win32all to export some information to word. > > > >I tried a simple program e.g: > http://p-nand-q.com/python/ms_office.html > >which worked... and TestMSOffice.py which also worked. > > > >I then used makepy.py and testmakepy.py ... after this the examples > >stopped working! Why?! (error below). > > One reason for differences after makepy is that names become case > sensitive. But it seems to me that led to attribute error. > > Bob Gailer > bgailer@alum.rpi.edu > 303 442 2625 > From jens.jorgensen at tallan.com Fri Oct 3 10:54:59 2003 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Fri Oct 3 10:55:30 2003 Subject: [python-win32] 'No such interface supported' error after makepy In-Reply-To: References: Message-ID: <3F7D8DC3.50508@tallan.com> This is very, very curious. Looking at the stack trace it really does appear that any makepy operation would have nothing to do with this problem. At least not as near as I can tell. Does this work on a different box? Simon Judge wrote: >Hi, I am trying to use win32all to export some information to word. > >I tried a simple program e.g: http://p-nand-q.com/python/ms_office.html >which worked... and TestMSOffice.py which also worked. > >I then used makepy.py and testmakepy.py ... after this the examples >stopped working! Why?! (error below). > >I've tried removing the gen_py folder, however this makes no >difference... > >Help! > >Thanks. > >Simon > >--- >Error: > >None: (-2147467262, 'No such interface supported', None, None) > >Traceback (innermost last): > >File "", line 1, in ? > >File "\\Server\meru documents\Project Files\Interface >Centre\Python\Dialog Test\word.py", line 6, in ? > word = win32com.client.Dispatch("Word.Application") >File "C:\Program >Files\Python\231\Lib\site-packages\win32com\client\__init__.py", line >95, in Dispatch > dispatch, userName = >dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) >File "C:\Program >Files\Python\231\Lib\site-packages\win32com\client\dynamic.py", line 84, >in _GetGoodDispatchAndUserName > return (_GetGoodDispatch(IDispatch, clsctx), userName) >File "C:\Program >Files\Python\231\Lib\site-packages\win32com\client\dynamic.py", line 72, >in _GetGoodDispatch > IDispatch = >pythoncom.CoCreateInstance(IDispatch, None, clsctx, >pythoncom.IID_IDispatch) > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions." -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3108 bytes Desc: S/MIME Cryptographic Signature Url : http://mail.python.org/pipermail/python-win32/attachments/20031003/6813be9a/smime.bin From pascor at hotpop.com Fri Oct 3 13:16:49 2003 From: pascor at hotpop.com (Ray Pasco) Date: Fri Oct 3 13:23:52 2003 Subject: [python-win32] ? App distribution for those not having python installed ? Message-ID: <3F7DAF01.9050503@hotpop.com> I'm happy to say I'm ready to distribute my first python app which is self-contained using Installer. But, since it doesn't need python to be installed on the target (Win) platform, how can the distribution install .EXE program run without python ? I'm assuming I'll be using wininst to create a self-installer .EXE and want the app to be installed somewhere in "C:\program files", chosen by the user at install-time, and not the "Python22\Lib\site-packages". directory. An example would be most helpful ! From theller at python.net Fri Oct 3 17:38:05 2003 From: theller at python.net (Thomas Heller) Date: Fri Oct 3 17:38:19 2003 Subject: [python-win32] Re: ? App distribution for those not having python installed ? References: <3F7DAF01.9050503@hotpop.com> Message-ID: Ray Pasco writes: > I'm happy to say I'm ready to distribute my first python app > which is self-contained using Installer. But, since it doesn't need > python to be installed on the target (Win) platform, how can the > distribution install .EXE program run without python ? I'm assuming > I'll be using wininst to create a self-installer .EXE > and want the app to be installed somewhere in "C:\program files", > chosen by the user at install-time, and not the > "Python22\Lib\site-packages". directory. An example would be most > helpful ! You might want to look at inno setup for example (NSIS is another option from what I hear) if you want to build installation programs for windows. bdist_wininst can only be used to install python modules or packages on system where Python is already installed. Thomas From lbates at syscononline.com Mon Oct 6 09:48:39 2003 From: lbates at syscononline.com (Larry Bates) Date: Mon Oct 6 09:48:48 2003 Subject: [python-win32] App distribution for those not having python installed In-Reply-To: Message-ID: <034601c38c10$8ceca430$5d00a8c0@LABWXP> I have used a combination of py2exe (to "freeze" the python app into an .EXE and some other files) and InnoSetup to act as the installer (where you can ask user for target for installation if you like). This doesn't work on all Python programs because there are some (ReportLab as an example) that I have still be unable to get to work with py2exe. -Larry From peter at monicol.co.uk Tue Oct 7 05:51:07 2003 From: peter at monicol.co.uk (Peter Mott) Date: Tue Oct 7 05:51:03 2003 Subject: [python-win32] Problem with COM Interface. Windows Installer Message-ID: The COM inteface apparently breaks when attempting to use "record" objects derived from Windows.Installer. Below is a sample script with comments: import win32com.client import os import sys msiOpenDatabaseModeReadOnly=0 msidb = "sample.msi" installer = win32com.client.Dispatch("WindowsInstaller.Installer") database = installer.OpenDatabase(msidb, msiOpenDatabaseModeReadOnly) view = database.OpenView("SELECT File, FileName FROM File") view.Execute() record = view.Fetch() x = record.FieldCount print "%d fields" % x # Everything to this point is fine. The print statement prints '2' as it # should # (1) This does not work. Trace follows: x = record.DataSize(1) # Attempting to get the DataSize gets this error. ##Traceback (most recent call last): ## File "C:\home\clients\SIMproject\SIM_INSTALL\BuildScripts\testinst.py", line 17, in -toplevel- ## x = record.DataSize(1) ## File ">", line 2, in DataSize ##com_error: (-2147352573, 'Member not found.', None, None) # (2) This does not work with trace following x = record.StringData(1) ## ##Traceback (most recent call last): ## File "C:\home\clients\SIMproject\SIM_INSTALL\BuildScripts\testinst.py", line 14, in -toplevel- ## x = record.StringData(1) ## File ">", line 2, in StringData ##com_error: (-2147352573, 'Member not found.', None, None) ----------------- These lines are from a corresponding vbscript which works without problem. fileId = record.stringData(1) filename= record.stringData(2) I'm using W2K version 5.00. Python is 2.3.1 and w32all is build 157. The same problem is on 155. Windows Installer is version 2.00.2600.1183. I traced some of the Python code. It tries to find out what sort of 'object' it is looking for, can't, tries a method as a last resort but enjoys no success. I certainly do not know enough about COM to make any headway with this. Thanks for any help Peter From simon at meru.org.uk Wed Oct 8 02:54:11 2003 From: simon at meru.org.uk (Simon Judge) Date: Wed Oct 8 02:46:55 2003 Subject: [python-win32] 'No such interface supported' error after makepy Message-ID: Hmm, Bizzare - I've replicated what I did exactly on a different box and can't recreate it! It must be box specific - maybe a problem with office??? It is behaving slightly weirdly at the moment... Ohh well, unless anyone has any other ideas, i'll just develop on another box... I suppose I could try reinstalling the lot (python, wx &win32all). Thanks. Simon > -----Original Message----- > From: Simon Judge > Sent: 07 October 2003 16:57 > To: 'Jens B. Jorgensen' > Subject: RE: [python-win32] 'No such interface supported' error after > makepy > > > It is, yes! I'll try it on a different box tonight, thanks. > > Simon > > > -----Original Message----- > > From: Jens B. Jorgensen [mailto:jens.jorgensen@tallan.com] > > Sent: 03 October 2003 15:55 > > To: Simon Judge > > Cc: python-win32@python.org > > Subject: Re: [python-win32] 'No such interface supported' > error after > > makepy > > > > > > This is very, very curious. Looking at the stack trace it > really does > > appear that any makepy operation would have nothing to do with this > > problem. At least not as near as I can tell. Does this work on a > > different box? > > > > Simon Judge wrote: > > > > >Hi, I am trying to use win32all to export some information to word. > > > > > >I tried a simple program e.g: > > http://p-nand-q.com/python/ms_office.html > > >which worked... and TestMSOffice.py which also worked. > > > > > >I then used makepy.py and testmakepy.py ... after this the examples > > >stopped working! Why?! (error below). > > > > > >I've tried removing the gen_py folder, however this makes no > > >difference... > > > > > >Help! > > > > > >Thanks. > > > > > >Simon > > > > > >--- > > >Error: > > > > > >None: (-2147467262, 'No such interface supported', None, None) > > > > > >Traceback (innermost last): > > > > > >File "", line 1, in ? > > > > > >File "\\Server\meru documents\Project Files\Interface > > >Centre\Python\Dialog Test\word.py", line 6, in ? > > > word = win32com.client.Dispatch("Word.Application") > > >File "C:\Program > > > >Files\Python\231\Lib\site-packages\win32com\client\__init__.py", line > > >95, in Dispatch > > > dispatch, userName = > > >dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) > > >File "C:\Program > > >Files\Python\231\Lib\site-packages\win32com\client\dynamic.py > > ", line 84, > > >in _GetGoodDispatchAndUserName > > > return (_GetGoodDispatch(IDispatch, clsctx), userName) > > >File "C:\Program > > >Files\Python\231\Lib\site-packages\win32com\client\dynamic.py > > ", line 72, > > >in _GetGoodDispatch > > > IDispatch = > > >pythoncom.CoCreateInstance(IDispatch, None, clsctx, > > >pythoncom.IID_IDispatch) > > > > > >_______________________________________________ > > >Python-win32 mailing list > > >Python-win32@python.org > > >http://mail.python.org/mailman/listinfo/python-win32 > > > > > > > > > > -- > > Jens B. Jorgensen > > jens.jorgensen@tallan.com > > > > "With a focused commitment to our clients and our people, we > > deliver value through customized technology solutions." > > > > > From jens.jorgensen at tallan.com Wed Oct 8 09:23:39 2003 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Wed Oct 8 09:24:38 2003 Subject: [python-win32] 'No such interface supported' error after makepy In-Reply-To: References: Message-ID: <3F840FDB.5060207@tallan.com> It's probably something to do with the office automation components rather than Python I'm guessing. The error really seems to indicate that the object that is instantiated is saying that it doesn't support the IDispatch interface. This is weird but I have seen weirder things happen for no reason (i.e. COM registry entries getting mangled with bizarre entries for no reason causing strange errors to occur). Simon Judge wrote: >Hmm, > >Bizzare - I've replicated what I did exactly on a different box and >can't recreate it! It must be box specific - maybe a problem with >office??? It is behaving slightly weirdly at the moment... > >Ohh well, unless anyone has any other ideas, i'll just develop on >another box... I suppose I could try reinstalling the lot (python, wx >&win32all). > >Thanks. > >Simon > > > >>-----Original Message----- >>From: Simon Judge >>Sent: 07 October 2003 16:57 >>To: 'Jens B. Jorgensen' >>Subject: RE: [python-win32] 'No such interface supported' error after >>makepy >> >> >>It is, yes! I'll try it on a different box tonight, thanks. >> >>Simon >> >> >> >>>-----Original Message----- >>>From: Jens B. Jorgensen [mailto:jens.jorgensen@tallan.com] >>>Sent: 03 October 2003 15:55 >>>To: Simon Judge >>>Cc: python-win32@python.org >>>Subject: Re: [python-win32] 'No such interface supported' >>> >>> >>error after >> >> >>>makepy >>> >>> >>>This is very, very curious. Looking at the stack trace it >>> >>> >>really does >> >> >>>appear that any makepy operation would have nothing to do with this >>>problem. At least not as near as I can tell. Does this work on a >>>different box? >>> >>>Simon Judge wrote: >>> >>> >>> >>>>Hi, I am trying to use win32all to export some information to word. >>>> >>>>I tried a simple program e.g: >>>> >>>> >>>http://p-nand-q.com/python/ms_office.html >>> >>> >>>>which worked... and TestMSOffice.py which also worked. >>>> >>>>I then used makepy.py and testmakepy.py ... after this the examples >>>>stopped working! Why?! (error below). >>>> >>>>I've tried removing the gen_py folder, however this makes no >>>>difference... >>>> >>>>Help! >>>> >>>>Thanks. >>>> >>>>Simon >>>> >>>>--- >>>>Error: >>>> >>>>None: (-2147467262, 'No such interface supported', None, None) >>>> >>>>Traceback (innermost last): >>>> >>>>File "", line 1, in ? >>>> >>>>File "\\Server\meru documents\Project Files\Interface >>>>Centre\Python\Dialog Test\word.py", line 6, in ? >>>> word = win32com.client.Dispatch("Word.Application") >>>>File "C:\Program >>>> >>>> >>>Files\Python\231\Lib\site-packages\win32com\client\__init__.py", line >>> >>> >>>>95, in Dispatch >>>> dispatch, userName = >>>>dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) >>>>File "C:\Program >>>>Files\Python\231\Lib\site-packages\win32com\client\dynamic.py >>>> >>>> >>>", line 84, >>> >>> >>>>in _GetGoodDispatchAndUserName >>>> return (_GetGoodDispatch(IDispatch, clsctx), userName) >>>>File "C:\Program >>>>Files\Python\231\Lib\site-packages\win32com\client\dynamic.py >>>> >>>> >>>", line 72, >>> >>> >>>>in _GetGoodDispatch >>>> IDispatch = >>>>pythoncom.CoCreateInstance(IDispatch, None, clsctx, >>>>pythoncom.IID_IDispatch) >>>> >>>>_______________________________________________ >>>>Python-win32 mailing list >>>>Python-win32@python.org >>>>http://mail.python.org/mailman/listinfo/python-win32 >>>> >>>> >>>> >>>> >>>-- >>>Jens B. Jorgensen >>>jens.jorgensen@tallan.com >>> >>>"With a focused commitment to our clients and our people, we >>>deliver value through customized technology solutions." >>> >>> >>> >>> > > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions." From croxton3 at yahoo.com Thu Oct 9 12:30:06 2003 From: croxton3 at yahoo.com (Derek Croxton) Date: Thu Oct 9 14:40:20 2003 Subject: [python-win32] Re: .py, .pyw extensions not associated with python, pythonwin, after installing Python2.3/win32all-157 In-Reply-To: <5.1.0.14.0.20030915221006.01bbba20@smtp.sbcglobal.net> References: <5.1.0.14.0.20030915221006.01bbba20@smtp.sbcglobal.net> Message-ID: Tony Cappellini wrote: > > > After installing Python 2.3, and win32all-2.3, the green snake icons are > not associated with any .py and .pyw files, and therefor > double clicking does execute either. > > This has happened on 2 different Win2k systems. I never had this problem > with Python 2.2, or win32all for Py2.2. > > Has anyone else seen this problem ? I get the same thing (2 computers, Win2k and ME). Of course, I only started using Python a week ago, so I thought it was normal... From Jim.Vickroy at noaa.gov Thu Oct 9 14:45:57 2003 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Oct 9 14:46:02 2003 Subject: [python-win32] Re: .py, .pyw extensions not associated with python,pythonwin, after installing Python2.3/win32all-157 References: <5.1.0.14.0.20030915221006.01bbba20@smtp.sbcglobal.net> Message-ID: <3F85ACE4.ECCF669E@noaa.gov> I definitely do not see this behavior on either my Win Xp nor my Win 2k machines. Derek Croxton wrote: > Tony Cappellini wrote: > > > > > > After installing Python 2.3, and win32all-2.3, the green snake icons are > > not associated with any .py and .pyw files, and therefor > > double clicking does execute either. > > > > This has happened on 2 different Win2k systems. I never had this problem > > with Python 2.2, or win32all for Py2.2. > > > > Has anyone else seen this problem ? > > I get the same thing (2 computers, Win2k and ME). Of course, I only > started using Python a week ago, so I thought it was normal... > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From peter at monicol.co.uk Thu Oct 9 15:14:38 2003 From: peter at monicol.co.uk (Peter Mott) Date: Thu Oct 9 15:14:38 2003 Subject: [python-win32] Re: .py, .pyw extensions not associated with python, pythonwin, after installing Python2.3/win32all-157 In-Reply-To: Message-ID: If you open Explorer->Tools->Folder Options->FileTypes you get the list of current associations. Scroll down to .PY and then press the Advanced button (not the Change...) one. This lets you set the options for the association and one of them is to fix the icon. The icon, though, does not have anything to do with the action on double clicking/right clicking afaik. Peter > -----Original Message----- > From: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org]On Behalf Of Derek Croxton > Sent: 09 October 2003 17:30 > To: python-win32@python.org > Subject: [python-win32] Re: .py, .pyw extensions not associated with > python, pythonwin, after installing Python2.3/win32all-157 > > > Tony Cappellini wrote: > > > > > > After installing Python 2.3, and win32all-2.3, the green snake icons are > > not associated with any .py and .pyw files, and therefor > > double clicking does execute either. > > > > This has happened on 2 different Win2k systems. I never had this problem > > with Python 2.2, or win32all for Py2.2. > > > > Has anyone else seen this problem ? > > I get the same thing (2 computers, Win2k and ME). Of course, I only > started using Python a week ago, so I thought it was normal... > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > > From koen_van_herck at yahoo.com Thu Oct 9 13:36:27 2003 From: koen_van_herck at yahoo.com (Koen Van Herck) Date: Thu Oct 9 15:27:20 2003 Subject: [python-win32] Early binding problem Message-ID: <006b01c38e8b$df29c200$4028000a@KVanherck> >From within Pythonwin, I run the makepy utility to create the .py file. Then I can do: win32com.client.Dispatch('...') and get which is OK. However, if I close Pythonwin and restart it, and then do the Dispatch, I get which is the late binding COM object. I can see the .py file exists in my temp directory. Any ideas? Thanks, Koen. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20031009/e353662a/attachment.html From moof at metamoof.net Fri Oct 10 04:49:37 2003 From: moof at metamoof.net (Moof) Date: Fri Oct 10 04:50:21 2003 Subject: [python-win32] Multithreaded COM, when do I need to CoUninitialise? Message-ID: <3F8672A1.90403@metamoof.net> I'm currently writing a Webware app (http://webware.sf.net/), which uses multiple threads to serve web requests in the application server. Due to the nature of my application, I have to save a number of COM objects in my sessions, which are held in memory, for about 15-30 minutes, which is when the session times out and is garbage collected. After playing around with the COMKit part of Webware and deciding it isn't as simple as it looks, I now find I'm doing a little something like this: import sys sys.coinit_flags = 0 import pythoncom from Webkit.Page import Page from win32com.client import Dispatch class FooPage(Page): def procThatGetsCalledToSetUpData(self): #first reinit COM, in case this thread hasn't inited it pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED) foo = Dipatch('comlib.object1') #do stuff with foo bar = Dispatch('comlib.object2') bar.doStuff(foo) self.session().setValue('foo',foo) self.session().setvalue('bar',bar) #And here I used to CoUninitialize() self.writePage() The reason I *used* to CoUninitialize there was that at the time, I didn't need the com objects anymore, but now I find that I do, and need to store them in the session. The thing I suppose I'm wondering is whether I need to worry about CoUninitialize - I have no control over which thread will be working with the COM objects later, and I can't even force the user to go through a set path in my webpage, the session might never reach completion. Basically, I don't know what CoUninitialize does exactly, and whether using it is just being "good neighbourly" or whether it's actually really necessary. Since I'm asking, given that a thread may call CoInitializeEx() a number of times throughout its lifetime, is that going affect the COM Objects that are currently being stored in a session somewhere when I try to import them back into that thread? Thanks in advance, Moof -- G.A.Radford - Moofing at you from Madrid, Spain 'Intelligence, Khalis, and Eupathy' From peter at monicol.co.uk Fri Oct 10 05:35:00 2003 From: peter at monicol.co.uk (Peter Mott) Date: Fri Oct 10 05:34:55 2003 Subject: [python-win32] Multithreaded COM, when do I need to CoUninitialise? In-Reply-To: <3F8672A1.90403@metamoof.net> Message-ID: CoUninitialize frees resources that were used when the COM libraries were intialized with CoInitialise. BTW as you are using the Dispatch interface which is what scripting languages like VBscript use I don't see why you need to initialise COM directly. Peter > -----Original Message----- > From: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org]On Behalf Of Moof > Sent: 10 October 2003 09:50 > To: python-win32@python.org > Subject: [python-win32] Multithreaded COM, when do I need to > CoUninitialise? > > > I'm currently writing a Webware app (http://webware.sf.net/), which uses > multiple threads to serve web requests in the application server. > > Due to the nature of my application, I have to save a number of COM > objects in my sessions, which are held in memory, for about 15-30 > minutes, which is when the session times out and is garbage collected. > > After playing around with the COMKit part of Webware and deciding it > isn't as simple as it looks, I now find I'm doing a little something > like this: > > import sys > sys.coinit_flags = 0 > import pythoncom > from Webkit.Page import Page > from win32com.client import Dispatch > > class FooPage(Page): > def procThatGetsCalledToSetUpData(self): > #first reinit COM, in case this thread hasn't inited it > pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED) > foo = Dipatch('comlib.object1') > #do stuff with foo > bar = Dispatch('comlib.object2') > bar.doStuff(foo) > self.session().setValue('foo',foo) > self.session().setvalue('bar',bar) > #And here I used to CoUninitialize() > self.writePage() > > The reason I *used* to CoUninitialize there was that at the time, I > didn't need the com objects anymore, but now I find that I do, and need > to store them in the session. > > The thing I suppose I'm wondering is whether I need to worry about > CoUninitialize - I have no control over which thread will be working > with the COM objects later, and I can't even force the user to go > through a set path in my webpage, the session might never reach > completion. Basically, I don't know what CoUninitialize does exactly, > and whether using it is just being "good neighbourly" or whether it's > actually really necessary. > > Since I'm asking, given that a thread may call CoInitializeEx() a number > of times throughout its lifetime, is that going affect the COM Objects > that are currently being stored in a session somewhere when I try to > import them back into that thread? > > Thanks in advance, > Moof > -- > G.A.Radford - Moofing at you from Madrid, Spain > 'Intelligence, Khalis, and Eupathy' > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From koen_van_herck at yahoo.com Fri Oct 10 08:53:51 2003 From: koen_van_herck at yahoo.com (Koen Van Herck) Date: Fri Oct 10 08:53:47 2003 Subject: [python-win32] Hex/Dec problem with LCID Message-ID: <009f01c38f2d$8f781de0$4028000a@KVanherck> There seems to be some hex/dec confusion with the LCID of the type library. In the registry, I have a type library stored at \Typelib\{UUID}\1.5\409\win32 which, according to MSDN means the locale ID is 0x409 (English US) (see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/automat/htm/chap2_89o9.asp) However, when I run makepy.py, this number is interpreted as decimal 409 and stored in a file named UUIDx409x1x5.py This file contains a line LCID = 0x409 Which is correct. When trying to import the type library (win32com.client.Dispatch), the code will look for a file UUIDx1033x1x5.py which of course doesn't exist and the import fails. Changing selecttlb.py as shown below seems to fix the problem (at least for my case). (This was with Win2K, Python 2.2, win32all-158) Regards, Koen. --selecttlb.py, line 103-- try: lcid = int(lcid, 16) # KVH fix except ValueError: # crap in the registry! continue # Only care about "{lcid}\win32" key - jump straight there. try: key4 = win32api.RegOpenKey(key3, "%x\win32" % (lcid,)) # KVH fix except win32api.error: continue From gtalvola at nameconnector.com Fri Oct 10 17:38:02 2003 From: gtalvola at nameconnector.com (Geoffrey Talvola) Date: Fri Oct 10 17:38:10 2003 Subject: [python-win32] Multithreaded COM, when do I need to CoUniniti alise? Message-ID: <61957B071FF421419E567A28A45C7FE59AF6DD@mailbox.nameconnector.com> Moof wrote: > After playing around with the COMKit part of Webware and deciding it > isn't as simple as it looks, I now find I'm doing a little something > like this: You shouldn't need to do any calls to CoInitializeEx or CoUninitialize. Just make sure that your AppServer.config file has 'EnableCOM': 1, in it. This will cause all of the WebKit threads to _automatically_ have CoInitializeEx(pythoncom.COINIT_MULTITHREADED) called with the thread starts, and pythoncom.CoUninitialize() called when the thread ends. (That's what COMKit does -- it installs the hooks necessary to make sure these functions are called.) Is there some reason why this isn't sufficient? - Geoff From A.N.Z.Evershed at exeter.ac.uk Sat Oct 11 17:04:41 2003 From: A.N.Z.Evershed at exeter.ac.uk (Tony Evershed) Date: Sat Oct 11 17:51:52 2003 Subject: [python-win32] Copying a string to the clipboard In-Reply-To: Message-ID: <000001c3903b$4d5c4a30$530910ac@tonypc> I almost *know* this one has been asked before, but a trawl through Google and the win32 extensions help failed to turn up anything of use... Is it possible to copy a string to the clipboard, such that if I click on 'Paste' in Notepad the text will appear? If so, could someone please tell me how? I have, for information... Python 2.3 win32all build 155 Windows XP Professional Many thanks, Tony Evershed From bgailer at alum.rpi.edu Sat Oct 11 18:40:01 2003 From: bgailer at alum.rpi.edu (Bob Gailer) Date: Sat Oct 11 18:42:22 2003 Subject: [python-win32] Copying a string to the clipboard In-Reply-To: <000001c3903b$4d5c4a30$530910ac@tonypc> References: <000001c3903b$4d5c4a30$530910ac@tonypc> Message-ID: <6.0.0.22.0.20031011163806.0347ddf0@66.28.54.253> At 03:04 PM 10/11/2003, Tony Evershed wrote: >I almost *know* this one has been asked before, but a trawl through Google >and the win32 extensions help failed to turn up anything of use... > >Is it possible to copy a string to the clipboard, such that if I click on >'Paste' in Notepad the text will appear? import win32clipboard win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(text) win32clipboard.CloseClipboard() Bob Gailer bgailer@alum.rpi.edu 303 442 2625 -------------- next part -------------- --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.521 / Virus Database: 319 - Release Date: 9/23/2003 From jbauer at rubic.com Mon Oct 13 09:33:49 2003 From: jbauer at rubic.com (Jeff Bauer) Date: Mon Oct 13 09:35:10 2003 Subject: [python-win32] Win32 PPP connections Message-ID: <3F8AA9BD.BADBDA84@rubic.com> We have a 3rd party application that requires a Windows PPP connection to a private network. I'd like to automate this task with a python script. Any clues where I should look to startup, then tear down a PPP connection on Windows (NT/2000)? Thanks in advance. Jeff Bauer Rubicon, Inc. From pythonwin at evpopov.com Mon Oct 13 09:54:56 2003 From: pythonwin at evpopov.com (pythonwin) Date: Mon Oct 13 09:55:04 2003 Subject: [python-win32] Win32 PPP connections In-Reply-To: <3F8AA9BD.BADBDA84@rubic.com> References: <3F8AA9BD.BADBDA84@rubic.com> Message-ID: <1066053296.3f8aaeb00674d@imp.online.net> > We have a 3rd party application that requires a > Windows PPP connection to a private network. I'd > like to automate this task with a python script. > Any clues where I should look to startup, then > tear down a PPP connection on Windows (NT/2000)? You can try to execute rasdial.exe with proper parameters to start / stop a VPN connection (I think rasdial is shipped with NT/2000: try rasdial.exe in a DOS box to check). I had to do that in the past and it did the job (at least for me). From tim.golden at viacom-outdoor.co.uk Mon Oct 13 09:57:15 2003 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Mon Oct 13 10:03:31 2003 Subject: [python-win32] Win32 PPP connections Message-ID: > > Any clues where I should look to startup, then > > tear down a PPP connection on Windows (NT/2000)? > You can try to execute rasdial.exe Better still... use the win32ras module from the win32all extensions. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From jbauer at rubic.com Mon Oct 13 10:09:20 2003 From: jbauer at rubic.com (Jeff Bauer) Date: Mon Oct 13 10:10:43 2003 Subject: [python-win32] Re: Win32 PPP connections Message-ID: <3F8AB210.AF23172E@rubic.com> Thanks. That's exactly the kind of hack I was looking for. -Jeff > You can try to execute rasdial.exe with proper parameters > to start / stop a VPN connection (I think rasdial is shipped > with NT/2000: try rasdial.exe in a DOS box to check). I had > to do that in the past and it did the job (at least for me) From sxa at fluent.com Mon Oct 13 09:20:59 2003 From: sxa at fluent.com (Seb) Date: Mon Oct 13 11:00:24 2003 Subject: [python-win32] Building Python in Singlethread mode ! Message-ID: <008701c3918c$d7aacd90$8ae4e9c0@sxapc> Greetings ! We are currently experiencing problems with the way our C++ application is interacting with the Python modules we made. (Interfacing is done through SIP) We discovered that each calls from our C++ app to any functions implemented in a Python modules needs to be encapsulated by Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS. This solves the crashing problems we had so far but causes new crashing problems in other parts of the code. We thought that we should try a Python version build in single thread mode. Any suggestions ? Thanks ! From cedric.fournier at sescoi.fr Tue Oct 14 07:08:13 2003 From: cedric.fournier at sescoi.fr (FOURNIER Cedric) Date: Tue Oct 14 12:18:39 2003 Subject: [python-win32] killing win32 process Message-ID: <3F8BD91D1D4.7271CEDRIC.FOURNIER@mailhost-lotusfr> Hello. I am under win2000 and python 2.3 I have a win32 executable which runs (created through python script with os.popen3(). I know its name Can anyone explain me use of win32 api to kill this process. Thanks in advance From null-python-win32 at tinfoilhat.ca Tue Oct 14 12:21:40 2003 From: null-python-win32 at tinfoilhat.ca (Sean) Date: Tue Oct 14 12:25:42 2003 Subject: [python-win32] killing win32 process In-Reply-To: <3F8BD91D1D4.7271CEDRIC.FOURNIER@mailhost-lotusfr> Message-ID: ->I have a win32 executable which runs (created through python script with ->os.popen3(). -> A -quick- fix would be to exec pskill (from the PSTools freeware package www.sysinternals.com). You could also do it via WMI using the Win32_Process object but this is more work than it is worth. -- Sean From tim.golden at viacom-outdoor.co.uk Tue Oct 14 12:19:51 2003 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Tue Oct 14 12:26:08 2003 Subject: FW: [python-win32] killing win32 process Message-ID: > -----Original Message----- > From: FOURNIER Cedric [mailto:cedric.fournier@sescoi.fr] > Sent: 14 October 2003 12:08 > To: python-win32@python.org > Subject: [python-win32] killing win32 process > I am under win2000 and python 2.3 > I have a win32 executable > I know its name > > Can anyone explain me use of win32 api to kill this process. I'm sure there are other ways, but I'd use WMI: Get the WMI module from http://tgolden.sc.sabren.com/python/wmi.html Either copy the "Create and then destroy a new notepad process" example from the cookbook page (note to self: put internal anchors on that page) http://tgolden.sc.sabren.com/python/wmi_cookbook.html or, if you need to have created it with popen, do something like this: c = wmi.WMI () for process in c.Win32_Process (Name='name of process'): process.Terminate () where 'name of process' obviously has to be replaced by the name of the process you're running. HTH TJG [Sorry - I always forget to send back to the group. Tim] ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From Jim.Vickroy at noaa.gov Tue Oct 14 12:52:21 2003 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Oct 14 12:52:26 2003 Subject: [python-win32] killing win32 process References: <3F8BD91D1D4.7271CEDRIC.FOURNIER@mailhost-lotusfr> Message-ID: <3F8C29C5.2B354C61@noaa.gov> You may also want to take a look at the win32process module -- specifically, TerminateProcess. Depending on your need for interprocess communication this module may be satisfactory. If you need interprocess communication the win32process API requires you to use Windows pipes (win32pipe) which may be more Windows-specific than you care to be. FOURNIER Cedric wrote: > Hello. > > I am under win2000 and python 2.3 > > I have a win32 executable which runs (created through python script with > os.popen3(). > > I know its name > > Can anyone explain me use of win32 api to kill this process. > > Thanks in advance > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From james at digconn.co.uk Wed Oct 15 04:52:53 2003 From: james at digconn.co.uk (james brooksbank) Date: Wed Oct 15 05:00:48 2003 Subject: [python-win32] system tray messages Message-ID: <1066207971.16838.6.camel@digconnserver> I'm trying to deveolp a program which runs in the system tray, every minute the program searches for a file in a directory, if there is more than one file in there then .i need a message to pop up in the system tray which tells the user that there is mail. I can't figure out how to get the message to be displayed. I'm using wxPython and the code to call my system tray icon is self.tbicon = wxTaskBarIcon() the following if statement is run as part of a biggere module called update which is the module which should display the message. ls = os.listdir(path) #path is my filepath if len(ls) > 1: #the message code should go here Please can you help James Brooksbank From moof at metamoof.net Fri Oct 17 07:25:28 2003 From: moof at metamoof.net (Moof) Date: Fri Oct 17 07:28:01 2003 Subject: [python-win32] Why is Webware not using COM early-bound dispatch? Message-ID: <3F8FD1A8.6060404@metamoof.net> Hi there: I have the following bit of test code: from WebKit.Page import Page from win32com.client import Dispatch class COMTest(Page): def __init__(self): Page.__init__(self) def writeContent(self): # grab the COM object bestOffer = Dispatch("ComTMW.tmwBestOffer") self.writeln('
')
         self.writeln('bestOffer: %s' % repr(bestOffer))
         demands = bestOffer.SetDemand(2)
         self.writeln('demands: %s' % repr(demands))
         self.writeln('
') I do have COMKit installed. If I run this code from the python shell I get: >>> foo = COMTest.COMTest() >>> def writeln(foo): ... print foo ... >>> foo.writeln = writeln >>> foo.writeContent()
bestOffer: 

demands: 
((, 
), 2)
However, If I run it from within Webware, I get this returned as content:
bestOffer: 
demands: ((, ), 2)
The problem I get is that if I now try to set an attribute in one fo the objects in the demands array by writing: demands[0][0].Adults = 2 this works fine on the python shell but with webware I get the error: TypeError: PyIDispatch has read-only attributes This is because I'm tryign to assign a variable to what I thoguht was an early-bound COM object. So I'm wondering how to convince Webware to use early-bound COM objects. Webware is 0.8.2, Python is 2.3 and both the Webware and Python shell had the win32com\gen_py directory in the correct location in sys.path Any ideas? -- Giles Antonio Radford, a.k.a Moof Sympathy, eupathy, and, currently, apathy coming to you at: From gtalvola at nameconnector.com Fri Oct 17 12:54:07 2003 From: gtalvola at nameconnector.com (Geoffrey Talvola) Date: Fri Oct 17 12:54:24 2003 Subject: [python-win32] Why is Webware not using COM early-bound dispa tch? Message-ID: <61957B071FF421419E567A28A45C7FE59AF712@mailbox.nameconnector.com> Moof wrote: > ... > > This is because I'm tryign to assign a variable to what I > thoguht was an > early-bound COM object. So I'm wondering how to convince > Webware to use > early-bound COM objects. > > ... I'm not sure why this isn't working. Try using: from win32com.client.gencache import EnsureDispatch then use EnsureDispatch in place of Dispatch. See if this makes any difference. - Geoff From pascor at hotpop.com Fri Oct 17 17:28:43 2003 From: pascor at hotpop.com (Ray Pasco) Date: Fri Oct 17 17:28:44 2003 Subject: [python-win32] process creation ID returned as a string, not an int Message-ID: <3F905F0B.9050201@hotpop.com> After installing wmi on my Win98 box, I pulled my hair out for a while trying to get the "Notepad" examples to work. After a while I identified the apparent and intermittent problem (bug?). When creating a process and saving the returned ID, sometime this value is an integer and sometimes it is a string ! The only reliable way to end up with the integer value is to force it: NotepadProcID, return_value = c.new ("Win32_Process").Create / (CommandLine="notepad.exe") # Absolutely necessary to *always* get a usable int ! NotepadProcID == int (str (NotepadProcID)) I noticed that the integer version would be returned exactly once immediately after a boot; subsequent calls return the string equivalent. Would anyone care to comment ? From davidostrowski at yahoo.com Sat Oct 18 17:14:11 2003 From: davidostrowski at yahoo.com (david ostrowski) Date: Sat Oct 18 17:14:14 2003 Subject: [python-win32] (no subject) Message-ID: <20031018211411.57658.qmail@web21414.mail.yahoo.com> I am having difficulty getting the experimental Mark Hammond python.NET compiler (off activestate site) to build correctly. Most distributions do not include NMAKE.exe, which is identified in all readme.txt as the primary file to run. When run I get the following: Creating a new key for signing the assemblies __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com From davidostrowski at yahoo.com Sat Oct 18 17:18:41 2003 From: davidostrowski at yahoo.com (david ostrowski) Date: Sat Oct 18 17:18:45 2003 Subject: [python-win32] (no subject) Message-ID: <20031018211841.62523.qmail@web21401.mail.yahoo.com> sorry about the incomplete message. I am having problems with the compilation of python.NET experimental compiler from activestate site. When running NMAKE.exe (on the distributions that contain it) I get: Creating a new key for signing the assembles if not exist ..\ManagedPython sn -k .\ManagedPython.key 'sn' is not recognized as an internal or external commonand. NMAKE : fatal error... If I go to /compiler and run make.bat manually I get: ultimately: pywintypes.com_error (' Invalid class string' ) I have installed python2.2 , win32com successfully as well as tried this on windows2000, XP, and 98! help! Thanks. david ostrowski __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com From jens.jorgensen at tallan.com Sat Oct 18 21:04:17 2003 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Sat Oct 18 21:04:59 2003 Subject: [python-win32] (no subject) In-Reply-To: <20031018211841.62523.qmail@web21401.mail.yahoo.com> References: <20031018211841.62523.qmail@web21401.mail.yahoo.com> Message-ID: <3F91E311.6010505@tallan.com> I'm just going to make a guess here but there's a couple of things you should check out. First, you need to make sure that you have installed both the .NET framework redistributable as well as the .NET framework SDK. nmake and sn are both included in the .NET SDK. Aside from that just make sure that you have your PATH set to include the directories for both the above which will probably be something like: c:/windows/Microsoft.NET/Framework/v1.1.4322 c:/Program\ Files/Microsoft.NET/SDK/v1.1/Bin david ostrowski wrote: >sorry about the incomplete message. > > >I am having problems with the compilation of >python.NET experimental compiler from activestate >site. When running NMAKE.exe (on the distributions >that contain it) I get: > >Creating a new key for signing the assembles >if not exist ..\ManagedPython sn -k >.\ManagedPython.key >'sn' is not recognized as an internal or external >commonand. >NMAKE : fatal error... > > > > > >If I go to /compiler and run make.bat manually I get: > >ultimately: >pywintypes.com_error (' Invalid class string' ) > >I have installed python2.2 , win32com successfully as >well as tried this on windows2000, XP, and 98! >help! > >Thanks. >david ostrowski > >__________________________________ >Do you Yahoo!? >The New Yahoo! Shopping - with improved product search >http://shopping.yahoo.com > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3108 bytes Desc: S/MIME Cryptographic Signature Url : http://mail.python.org/pipermail/python-win32/attachments/20031018/d6a8149f/smime.bin From tim.golden at viacom-outdoor.co.uk Mon Oct 20 04:11:18 2003 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Mon Oct 20 04:17:39 2003 Subject: [python-win32] process creation ID returned as a string, not an int Message-ID: > -----Original Message----- > From: Ray Pasco [mailto:pascor@hotpop.com] > Sent: 17 October 2003 22:29 > To: python-win32@python.org > Subject: [python-win32] process creation ID returned as a > string, not an > int > > When creating a process and saving the returned ID, > sometime this value is an integer and sometimes > it is a string ! With no particular insight on this, experimentation on my Win2K box shows that the id is neither an int nor a string, but rather an instance of an ISWbemProperty class. This class, if you're interested: >>> print id.__class__ win32com.gen_py.565783C6-CB41-11D1-8B02-00600806D9B6x0x1x1.ISWbemProperty.IS WbemProperty I'll have a go on a Win98 box later today if I get the chance just to see if it's any different. To ask a question that goes beyond the immediate problem, though, what are you trying to do with the return value? All I ever do is stash it away in some local or class variable so that I can refer to the process later, eg to terminate it. In that case, I don't care whether it's an int or a string or anything else: I just pass it back in to a WMI query. What are you using it for? TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From tim.golden at viacom-outdoor.co.uk Mon Oct 20 04:53:40 2003 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Mon Oct 20 04:59:54 2003 Subject: FW: [python-win32] process creation ID returned as a string, not an int Message-ID: RP> From: Ray Pasco [mailto:pascor@hotpop.com] RP> RP> When creating a process and saving the returned ID, RP> sometime this value is an integer and sometimes RP> it is a string ! TG> I'll have a go on a Win98 box later today if I get the chance just TG> to see if it's any different. Ah. OK. I've now had a look at what Win98 does, and it looks like it manages to mangle the process id beyond recognition. I was getting out a negative id while the WMI object's own process id was a positive number. Converting using long (hex (id), 16) seemed to give the right result, but I didn't get a chance to pass it back in again. (Using someone else's machine). Even if it worked it would be, like your workaround, a tedious thing to have to do every time. Not very helpful, I know, but that's probably why I eschew Win98 where humanly possible. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ From stephen at theboulets.net Mon Oct 20 11:18:01 2003 From: stephen at theboulets.net (stephen) Date: Mon Oct 20 11:18:05 2003 Subject: [python-win32] Strange issue with killing a process Message-ID: <20031020151801.M73774@theboulets.net> I can kill a program this way: import os, win32api, sys,os.path base = "C:\\Program Files\\XEmacs\\XEmacs-21.4.13\\i586-pc-win32" prog = "xemacs.exe" command = os.path.join(base,prog) mode = os.P_NOWAIT id = os.spawnl(mode,command) win32api.TerminateProcess(id,0) But, and here's what's strange, this will only work if called from the same script. When I pickle 'id' and exit the script without killing the process, I can't start another script that would unpickle 'id' and then kill the process. Trying to do so gives me this error: Traceback (most recent call last): File "killprocess.py", line 20, in ? win32api.TerminateProcess(id,0) pywintypes.error: (6, 'TerminateProcess', 'The handle is invalid.') Anyone know what's going on? _________ Stephen From andrew.miller at verizon.com Mon Oct 20 15:31:07 2003 From: andrew.miller at verizon.com (andrew.miller@verizon.com) Date: Mon Oct 20 15:32:09 2003 Subject: [python-win32] Need help with COM Message-ID: Hi All, I am new to Python and COM and have run into some problems. I am trying to write a COM program that will interact with MS Internet Explorer. Using code like: from win32com.client import Dispatch ie = Dispatch ('InternetExplorer.Application') ie.Visible = 1 I have been able to start IE, navigate and submit forms. My problem is that one of the pages I navigate to opens up a new browser window. How do I navigate and work with this new (child) window instead of the parent browser? Thanks in advance. From tony at tcapp.com Tue Oct 21 02:13:40 2003 From: tony at tcapp.com (Tony Cappellini) Date: Tue Oct 21 02:17:09 2003 Subject: [python-win32] Win32all 1.59 crashes during install on XP Message-ID: <5.1.0.14.0.20031020231155.02879fe8@smtp.sbcglobal.net> When I tried to uninstall this, install.log could not be found, therefore I cannot uninstall win32all cleanly. Is there another way to do a CLEAN uninstall ? Does the registry get messed with during the install ? From niki at vintech.bg Tue Oct 21 03:27:59 2003 From: niki at vintech.bg (Niki Spahiev) Date: Tue Oct 21 03:30:49 2003 Subject: [python-win32] Strange issue with killing a process In-Reply-To: <20031020151801.M73774@theboulets.net> References: <20031020151801.M73774@theboulets.net> Message-ID: <3F94DFFF.5030503@vintech.bg> stephen wrote: > But, and here's what's strange, this will only work if called from the same > script. When I pickle 'id' and exit the script without killing the process, I > can't start another script that would unpickle 'id' and then kill the process. > Trying to do so gives me this error: > > Traceback (most recent call last): > File "killprocess.py", line 20, in ? > win32api.TerminateProcess(id,0) > pywintypes.error: (6, 'TerminateProcess', 'The handle is invalid.') > > Anyone know what's going on? Handles are closed when process terimantes. You must open new handle in second process. HTH Niki Spahiev From jhmsmits at xs4all.nl Wed Oct 22 17:58:11 2003 From: jhmsmits at xs4all.nl (Sander Smits) Date: Wed Oct 22 17:58:19 2003 Subject: [python-win32] DDE Message-ID: <200310222358.11241.jhmsmits@xs4all.nl> I have a stock data stream via a DDE server. I can connect to it via Excel. Now, when I try to connect to it via Python, it will only return requests which are opened in Excel already. All other requests (not called at by Excel) return an empty string. I use the following script: import dde server = dde.CreateServer() server.Create('') conversation = dde.CreateConversation(server) conversation.ConnectTo("name", "topic") s = "somethingstring" print conversation.Request(s) This script only returns values if Excel is opened, and then only returns those values which are called at by Excel. Is there a way to send requests via the DDE server and receive data directly via python without having to start Excel? Regards, Sander. From olson at mcs.anl.gov Thu Oct 23 08:56:10 2003 From: olson at mcs.anl.gov (Robert Olson) Date: Thu Oct 23 08:56:23 2003 Subject: [python-win32] Problems with Python+COM and XP Firewall Manager Message-ID: <5.2.0.9.2.20031023071947.02178e10@pop.mcs.anl.gov> Hi - I'm trying to use python+COM to poke at the WinXP firewall configs. I'm looking at the VBScript sample available here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ics/ics/enabling_internet_connection_firewall_vbscript_.asp (aka http://snurl.com/qu2 ) and attempting to emulate it in Python. I used makepy to create a module for the ICS library: makepy -o hnet.py \windows\system\hnetcfg.dll I can create the INetSharingManager obj just fine, and invoke its toplevel methods, but can't use the objects returned from the enumeration. here's the test code: import pythoncom import hnet n = hnet.NetSharingManager() print "n=", n print "sharingInstalled=", n.SharingInstalled col = n.EnumEveryConnection print "Col=%s count=%s" % (col, col.Count) item = col[0] print "Item is %s type=%s" % (item, type(item)) iidstr = hnet.VTablesNamesToCLSIDMap['INetConnection'] iid = pythoncom.MakeIID(iidstr) print "iidstr=%s iid=%s" %( iidstr, iid) try: item2 = item.QueryInterface(iid) print "item2=", item2 except Exception, e: print "QueryInterface failed: ", e try: con = n.INetSharingConfigurationForINetConnection(item) print "con=", con except Exception, e: print "INetSharingConfigurationForINetConnection failed: ", e And here's the output: C:\temp>python thnet.py n= sharingInstalled= 1 Col= count=2 Item is type= iidstr={C08956A1-1CD3-11D1-B1C5-00805FC1270E} iid={C08956A1-1CD3-11D1-B1C5-00805FC1270E} QueryInterface failed: There is no interface object registered that supports this IID INetSharingConfigurationForINetConnection failed: (-2147467262, 'No such interface supported', None, None) I've poked a little at using QueryInterface to turn the item from the collection into a INetConnection but haven't been able to get that to fly. I'm using ActiveState Python which doesn't have CastTo; however, I looked at the source to CastTo in CVS and it looks like it wouldn't work anyway, as the item in the connection doesn't have __class__ attribute as used by CastTo. I find that interface in the registry: HKEY_CLASSES_ROOT\Interface\{C08956A1-1CD3-11D1-B1C5-00805FC1270E} Does anyone have any ideas? thanks, --bob From jens.jorgensen at tallan.com Thu Oct 23 15:18:58 2003 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Thu Oct 23 15:20:22 2003 Subject: [python-win32] Problems with Python+COM and XP Firewall Manager In-Reply-To: <5.2.0.9.2.20031023071947.02178e10@pop.mcs.anl.gov> References: <5.2.0.9.2.20031023071947.02178e10@pop.mcs.anl.gov> Message-ID: <3F9829A2.4070508@tallan.com> The INetConnection interface derives from IUnknown so using win32com there is no way to call methods on this interface as all calls on objects are made through IDispatch even when makepy is used to generate "strongly typed" wrappers around such interfaces. (vbscript can't make calls on INetConnection either.). The ctypes library has some code that supports calling methods on "custom" interfaces. If you need to be able to make calls on the INetConnection interface you could either try ctypes (http://sourceforge.net/projects/ctypes, http://starship.python.net/crew/theller/ctypes/index.html) or you could generate a python extension module. The ctypes com stuff is work in progress so you'll need to look at the code and examples (not enough in the docs) to see how to do this if it is indeed possible. For the python extension here are a couple of options. You could wrap the whole type library, all objects,methods, etc. and that would probably take a while. You could also just hack something together. Since I haven't done something along this vein in a little while and have an XP box myself I decided to do just this. I would like to make the disclaimer that the thing I hacked together has little error checking, and plays very fast and loose with COM. Specifically, my strategy was to get the IUnknown * out of the PyIUnknown object so I can do the right COM stuff with in in C++. Well, PyIUnknown doesn't provide any way of getting at it directly so I did the unthinkable: I take the string that str(obj) returns on PyIUnknown and take that second hex value which is the pointer itself. I just cast it to IUnknown * and go from there. This is against a number of very basic rules of COM but it works in the simple case of my test script (same thread/apartment as python when it is called, etc. etc.). I implemented a couple of method calls so that I could run the following script (I did the same makepy you did) which enumerates the connections and prints out the connection name and status. I ran it on my laptop and it worked just fine. import sys sys.path.append('Release') import NetConnection import hnet n = hnet.NetSharingManager() col = n.EnumEveryConnection for nc in col : print "" print NetConnection.INetConnection_GetName(nc) print NetConnection.INetConnection_GetStatus(nc) The sys.path.append line is because I ran this from the source directory where I built the extension module. If you decide to try out (and modify?!) the extension yourself all you'll need to do is run "python setup.py install" to build and install the extension and then that line will not be necessary. If you install the binary extension you also won't need it. Here's a link to the source for my python extension should you want to tinker with it and perhaps grow it. As I mentioned above it is all set up with distutils for easy building/installing. http://pitroda.net:8000/~jbj1/NetConnection-0.0.zip And just 'cause it's easy I built a binary distribution as well for instant gratification. Note that this is built against Python 2.2 so if that's not your version it won't work. http://pitroda.net:8000/~jbj1/NetConnection-0.0.win32-py2.2.exe http://pitroda.net:8000/~jbj1/NetConnection-0.0.win32-py2.2.exe.asc (gnupg signature) Don't be afraid to take a look at the c++ extension I wrote. It is small and easy! I think more people should be doing extensions but people are afraid of them or think it'll be hard. I never use swig, no need to and you get a cleaner interface doing a proper pythonic interface yourself. Robert Olson wrote: > Hi - > > I'm trying to use python+COM to poke at the WinXP firewall configs. > I'm looking at the VBScript sample available here: > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ics/ics/enabling_internet_connection_firewall_vbscript_.asp > > > (aka http://snurl.com/qu2 ) and attempting to emulate it in Python. I > used makepy to create a module for the ICS library: > > makepy -o hnet.py \windows\system\hnetcfg.dll > > I can create the INetSharingManager obj just fine, and invoke its > toplevel methods, but can't use the objects returned from the > enumeration. > > here's the test code: > > import pythoncom > import hnet > > n = hnet.NetSharingManager() > print "n=", n > print "sharingInstalled=", n.SharingInstalled > > col = n.EnumEveryConnection > > print "Col=%s count=%s" % (col, col.Count) > > item = col[0] > print "Item is %s type=%s" % (item, type(item)) > > iidstr = hnet.VTablesNamesToCLSIDMap['INetConnection'] > iid = pythoncom.MakeIID(iidstr) > print "iidstr=%s iid=%s" %( iidstr, iid) > > try: > item2 = item.QueryInterface(iid) > print "item2=", item2 > except Exception, e: > print "QueryInterface failed: ", e > > try: > con = n.INetSharingConfigurationForINetConnection(item) > print "con=", con > except Exception, e: > print "INetSharingConfigurationForINetConnection failed: ", e > > And here's the output: > > C:\temp>python thnet.py > n= > sharingInstalled= 1 > Col= Library.INetSharingEveryConnectionCollection> count=2 > Item is type= 'PyIUnknown'> > iidstr={C08956A1-1CD3-11D1-B1C5-00805FC1270E} > iid={C08956A1-1CD3-11D1-B1C5-00805FC1270E} > QueryInterface failed: There is no interface object registered that > supports this IID > INetSharingConfigurationForINetConnection failed: (-2147467262, 'No > such interface supported', None, None) > > I've poked a little at using QueryInterface to turn the item from the > collection into a INetConnection but haven't been able to get that to > fly. I'm using ActiveState Python which doesn't have CastTo; however, > I looked at the source to CastTo in CVS and it looks like it wouldn't > work anyway, as the item in the connection doesn't have __class__ > attribute as used by CastTo. > > I find that interface in the registry: > > HKEY_CLASSES_ROOT\Interface\{C08956A1-1CD3-11D1-B1C5-00805FC1270E} > > Does anyone have any ideas? > > thanks, > --bob > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions." -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3108 bytes Desc: S/MIME Cryptographic Signature Url : http://mail.python.org/pipermail/python-win32/attachments/20031023/a1c54e92/smime.bin From olson at mcs.anl.gov Thu Oct 23 15:28:21 2003 From: olson at mcs.anl.gov (Robert Olson) Date: Thu Oct 23 15:28:29 2003 Subject: [python-win32] Problems with Python+COM and XP Firewall Manager In-Reply-To: <3F9829A2.4070508@tallan.com> References: <5.2.0.9.2.20031023071947.02178e10@pop.mcs.anl.gov> <3F9829A2.4070508@tallan.com> Message-ID: <6.0.0.22.2.20031023142731.02b79a38@pop.mcs.anl.gov> Very cool, thanks for putting that together. (there's some other stuff that's not python-wrapped (the IP Helper API that I've been pondering building an extension for anyway). When I try to compile it's complaininga bout not having NetConnection.h - should I hvae that somewhere, or did it get dropped from the module when you packed it up? -bob At 02:18 PM 10/23/2003, Jens B. Jorgensen wrote: >Here's a link to the source for my python extension should you want to >tinker with it and perhaps grow it. As I mentioned above it is all set up >with distutils for easy building/installing. From theller at python.net Thu Oct 23 16:07:10 2003 From: theller at python.net (Thomas Heller) Date: Thu Oct 23 16:08:14 2003 Subject: [python-win32] Re: Problems with Python+COM and XP Firewall Manager References: <5.2.0.9.2.20031023071947.02178e10@pop.mcs.anl.gov> Message-ID: Robert Olson writes: > Hi - > > I'm trying to use python+COM to poke at the WinXP firewall > configs. I'm looking at the VBScript sample available here: > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ics/ics/enabling_internet_connection_firewall_vbscript_.asp > > (aka http://snurl.com/qu2 ) and attempting to emulate it in Python. I > used makepy to create a module for the ICS library: > > makepy -o hnet.py \windows\system\hnetcfg.dll > > I can create the INetSharingManager obj just fine, and invoke its > toplevel methods, but can't use the objects returned from the > enumeration. > > here's the test code: [...] Just for fun, I tried to convert this into corresponding ctypes code. First, you have to run the readtlb.py tool on the hnetcfg.dll typelib: "readtlb.py c:\windows\system32\hnetcfg.dll > hnet_gen.py" which creates a python wrapper containing the interfaces. Second, I had to manually write a wrapper for the IEnumVARIANT interface, which was not yet wrapped by ctypes' com. Easy: from ctypes import * from ctypes.com import IUnknown, GUID, STDMETHOD, HRESULT class IEnumVARIANT(IUnknown): _iid_ = GUID("{00020404-0000-0000-C000-000000000046}") IEnumVARIANT._methods_ = IUnknown._methods_ + [ STDMETHOD(HRESULT, "Next", c_ulong, POINTER(VARIANT), POINTER(c_ulong)), STDMETHOD(HRESULT, "Skip", c_ulong), STDMETHOD(HRESULT, "Reset"), STDMETHOD(HRESULT, "Clone", POINTER(POINTER(IEnumVARIANT))) ] And finally, after some experimentation and looking into the generated hnet_get module, here is the script: ----- import hnet_gen from ctypes import * from ctypes.com import CreateInstance from ctypes.com.automation import IDispatch def main(): n = CreateInstance(hnet_gen.NetSharingManager) print "n=", n installed = c_int() n._get_SharingInstalled(byref(installed)) print "sharingInstalled=", installed collection = POINTER(hnet_gen.INetSharingEveryConnectionCollection)() n._get_EnumEveryConnection(pointer(collection)) count = c_long() collection._get_Count(byref(count)) print "count", count enum = POINTER(IUnknown)() collection._get__NewEnum(byref(enum)) print "enum", enum ienum = POINTER(IEnumVARIANT)() enum.QueryInterface(byref(IEnumVARIANT._iid_), byref(ienum)) v = VARIANT() fetched = c_ulong() ienum.Next(1, byref(v), byref(fetched)) print "Next?", fetched, v.vt item = v.value print "Got", item p = POINTER(hnet_gen.INetConnection)() item.QueryInterface(byref(hnet_gen.INetConnection._iid_), byref(p)) print p guid = GUID() p.GetUiObjectClassId(byref(guid)) print "GetUiObjectClassId", guid if __name__ == "__main__": main() ----- and here is what it prints: n= sharingInstalled= c_int(65535) count c_long(5) enum Next? c_ulong(1) 13 Got GetUiObjectClassId {7007ACC5-3202-11D1-AAD2-00805FC1270E} Not to say that ctypes.com is ready for production use, but maybe it's worth a look. Thomas PS: http://starship.python.net/crew/theller/ctypes/ From jens.jorgensen at tallan.com Thu Oct 23 16:11:32 2003 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Thu Oct 23 16:12:51 2003 Subject: [python-win32] Problems with Python+COM and XP Firewall Manager In-Reply-To: <6.0.0.22.2.20031023142731.02b79a38@pop.mcs.anl.gov> References: <5.2.0.9.2.20031023071947.02178e10@pop.mcs.anl.gov> <3F9829A2.4070508@tallan.com> <6.0.0.22.2.20031023142731.02b79a38@pop.mcs.anl.gov> Message-ID: <3F9835F4.5070203@tallan.com> Robert Olson wrote: > Very cool, thanks for putting that together. (there's some other stuff > that's not python-wrapped (the IP Helper API that I've been pondering > building an extension for anyway). No prob, glad to help. > When I try to compile it's complaininga bout not having > NetConnection.h - should I hvae that somewhere, or did it get dropped > from the module when you packed it up? Ack. Sorry, yeah. I updated the zip and uploaded it to the same spot. -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions." From theller at python.net Thu Oct 23 16:13:51 2003 From: theller at python.net (Thomas Heller) Date: Thu Oct 23 16:14:20 2003 Subject: [python-win32] Re: Problems with Python+COM and XP Firewall Manager References: <5.2.0.9.2.20031023071947.02178e10@pop.mcs.anl.gov> Message-ID: Thomas Heller writes: > Just for fun, I tried to convert this into corresponding ctypes code. [...] I forgot to mention that the code I posted needs some changes to the VARIANT class which are not even in CVS yet, so it would require some tweaking. Thomas From olson at mcs.anl.gov Thu Oct 23 17:11:57 2003 From: olson at mcs.anl.gov (Robert Olson) Date: Thu Oct 23 17:12:11 2003 Subject: [python-win32] Problems with Python+COM and XP Firewall Manager In-Reply-To: <3F9835F4.5070203@tallan.com> References: <5.2.0.9.2.20031023071947.02178e10@pop.mcs.anl.gov> <3F9829A2.4070508@tallan.com> <6.0.0.22.2.20031023142731.02b79a38@pop.mcs.anl.gov> <3F9835F4.5070203@tallan.com> Message-ID: <6.0.0.22.2.20031023160849.02900170@pop.mcs.anl.gov> At 03:11 PM 10/23/2003, Jens B. Jorgensen wrote: >Ack. Sorry, yeah. I updated the zip and uploaded it to the same spot. Okay, that built and works fine. very cool. What I'm actually looking for is the ability to call INetSharingManager::get_INetSharingConfigurationForINetConnection. What I'm thinking is I add a call that takes the netsharingmgr instance and the netconn IUnknown guy, convert the later to a INetConnectionPtr, and do the invocation. Can you point me at the magic to convert a python into the C++ INetSharingManager object, and the other direction for the return of the INetSharingConfiguration object (which does implement IDispatch which means I should be able to manipulate it in python). thanks; this is pretty powerful stuff .. --bob From jens.jorgensen at tallan.com Thu Oct 23 20:00:11 2003 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Thu Oct 23 20:01:25 2003 Subject: [python-win32] Problems with Python+COM and XP Firewall Manager In-Reply-To: <6.0.0.22.2.20031023160849.02900170@pop.mcs.anl.gov> References: <5.2.0.9.2.20031023071947.02178e10@pop.mcs.anl.gov> <3F9829A2.4070508@tallan.com> <6.0.0.22.2.20031023142731.02b79a38@pop.mcs.anl.gov> <3F9835F4.5070203@tallan.com> <6.0.0.22.2.20031023160849.02900170@pop.mcs.anl.gov> Message-ID: <3F986B8B.8010309@tallan.com> Interesting. I would think that would work actually. Hmm. Actually the reason that call doesn't work is because the InvokeTypes call is attempting to turn the argument (which is the INetConnection *) into VT_DISPATCH, which cannot be done since that interface doesn't support IDispatch. I'm not sure where the mistake was made but perhaps when the type library was processed it was assumed that the INetConnection interface would support IDispatch which of course it does not. I think this is technically a bug in makepy. You can actually fix this by modifying the hnet.py that was generated by makepy. Go to the line in there where it defines INetSharingConfigurationForINetConnection there is a line there with "InvokeTypes(0x6, LCID, 2, (9, 0), ((9, 1)"... and change the bit with "((9, 1)" to "((13, 1)" and now the code should work. If I had more time to spare at the moment looking at this I'd figure out a patch for makepy and send it on to Mark. Robert Olson wrote: > At 03:11 PM 10/23/2003, Jens B. Jorgensen wrote: > >> Ack. Sorry, yeah. I updated the zip and uploaded it to the same spot. > > > Okay, that built and works fine. very cool. > > What I'm actually looking for is the ability to call > INetSharingManager::get_INetSharingConfigurationForINetConnection. > What I'm thinking is I add a call that takes the netsharingmgr > instance and the netconn IUnknown guy, convert the later to a > INetConnectionPtr, and do the invocation. > > Can you point me at the magic to convert a python > into the > C++ INetSharingManager object, and the other direction for the return > of the INetSharingConfiguration object (which does implement IDispatch > which means I should be able to manipulate it in python). > > thanks; this is pretty powerful stuff .. > > --bob -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions." From master at hilug.org Fri Oct 24 04:02:05 2003 From: master at hilug.org (hilug master) Date: Fri Oct 24 04:02:19 2003 Subject: [python-win32] E_ACCESSDENIED problem with disk quota. Message-ID: <002201c39a05$1d9dca20$ca3fe7cb@LocalHost> Hi, I'm testing to control Windows disk quota by python on win2003 and winXP. But ther is some problem.. This is the test code: import win32com.client qutoa=win32com.client.Dispatch('Microsoft.DiskQuota.1') quota.Initialize('c:\\',1) test=quota.AddUser('test') ## 'test' is real account name in my machine. test.QuotaLimit=10000000 # 10MB However, If I run it within PythonWin, I get this returned error message: >>> t.QuotaLimit=10000000 Traceback (most recent call last): File "", line 1, in ? File "C:\Python22\Lib\site-packages\win32com\client\__init__.py", line 355, in __setattr__ apply(self._oleobj_.Invoke, args + (value,) + defArgs) com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147024891), None) I have known error code -2147024891 (0x80070005) means E_ACCESSDENIED by someone's kind help. (Thanks Roger :) But I run PythonWin on Administrator privilege and I couldn't find any related method for setting permission in 'Microsoft.DiskQuota.1' object. Does anyone have any ideas? Thanks! -- Y.H. Rhiu From master at hilug.org Fri Oct 24 04:55:07 2003 From: master at hilug.org (Y.H. Rhiu) Date: Fri Oct 24 04:55:43 2003 Subject: [python-win32] E_ACCESSDENIED problem with disk quota. Message-ID: <008601c39a0c$86971840$ca3fe7cb@LocalHost> Sorry, I repost this mail because of email MIME-encoding problem. -------------------------------------------------------------------- Hi, I'm testing to control Windows disk quota by python on win2003 and winXP. But ther is some problem.. This is the test code: import win32com.client qutoa=win32com.client.Dispatch('Microsoft.DiskQuota.1') quota.Initialize('c:\\',1) test=quota.AddUser('test') ## 'test' is real account name in my machine. test.QuotaLimit=10000000 # 10MB However, If I run it within PythonWin, I get this returned error message: >>> t.QuotaLimit=10000000 Traceback (most recent call last): File "", line 1, in ? File "C:\Python22\Lib\site-packages\win32com\client\__init__.py", line 355, in __setattr__ apply(self._oleobj_.Invoke, args + (value,) + defArgs) com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147024891), None) I have known error code -2147024891 (0x80070005) means E_ACCESSDENIED by someone's kind help. (Thanks Roger :) But I run PythonWin on Administrator privilege and I couldn't find any related method for setting permission in 'Microsoft.DiskQuota.1' object. Does anyone have any ideas? Thanks! -- Y.H. Rhiu From olson at mcs.anl.gov Fri Oct 24 08:45:57 2003 From: olson at mcs.anl.gov (Robert Olson) Date: Fri Oct 24 08:46:11 2003 Subject: [python-win32] Problems with Python+COM and XP Firewall Manager In-Reply-To: <3F986B8B.8010309@tallan.com> References: <5.2.0.9.2.20031023071947.02178e10@pop.mcs.anl.gov> <3F9829A2.4070508@tallan.com> <6.0.0.22.2.20031023142731.02b79a38@pop.mcs.anl.gov> <3F9835F4.5070203@tallan.com> <6.0.0.22.2.20031023160849.02900170@pop.mcs.anl.gov> <3F986B8B.8010309@tallan.com> Message-ID: <6.0.0.22.2.20031024074218.047fff60@pop.mcs.anl.gov> At 07:00 PM 10/23/2003, Jens B. Jorgensen wrote: >You can actually fix this by modifying the hnet.py that was generated by >makepy. Go to the line in there where it defines >INetSharingConfigurationForINetConnection there is a line there with >"InvokeTypes(0x6, LCID, 2, (9, 0), ((9, 1)"... and change the bit with >"((9, 1)" to "((13, 1)" and now the code should work. If I had more time >to spare at the moment looking at this I'd figure out a patch for makepy >and send it on to Mark. And again, it works like a champ. (and I find that even though I get a dialog from Windows implying that the firewall setting change will only last while the app is running, the change sticks). Thanks so much. --bob From jens.jorgensen at tallan.com Fri Oct 24 10:26:07 2003 From: jens.jorgensen at tallan.com (Jens B. Jorgensen) Date: Fri Oct 24 10:27:30 2003 Subject: [python-win32] Problems with Python+COM and XP Firewall Manager In-Reply-To: <6.0.0.22.2.20031024074218.047fff60@pop.mcs.anl.gov> References: <5.2.0.9.2.20031023071947.02178e10@pop.mcs.anl.gov> <3F9829A2.4070508@tallan.com> <6.0.0.22.2.20031023142731.02b79a38@pop.mcs.anl.gov> <3F9835F4.5070203@tallan.com> <6.0.0.22.2.20031023160849.02900170@pop.mcs.anl.gov> <3F986B8B.8010309@tallan.com> <6.0.0.22.2.20031024074218.047fff60@pop.mcs.anl.gov> Message-ID: <3F99367F.2060402@tallan.com> Robert Olson wrote: > At 07:00 PM 10/23/2003, Jens B. Jorgensen wrote: > >> You can actually fix this by modifying the hnet.py that was generated >> by makepy. Go to the line in there where it defines >> INetSharingConfigurationForINetConnection there is a line there with >> "InvokeTypes(0x6, LCID, 2, (9, 0), ((9, 1)"... and change the bit >> with "((9, 1)" to "((13, 1)" and now the code should work. If I had >> more time to spare at the moment looking at this I'd figure out a >> patch for makepy and send it on to Mark. > > > And again, it works like a champ. > > (and I find that even though I get a dialog from Windows implying that > the firewall setting change will only last while the app is running, > the change sticks). > > Thanks so much. Great to hear it worked out. By the way after I sent that last email I realized I should have probably explained a bit more. The 5th argument to InvokeTypes is a tuple describing the parameters to be passed to the function. The constant numeric values correspond to the enumeration constants for the VARIANT type. The value 9 is VT_DISPATCH, while value 13 is VT_UNKNOWN. In the python com code a standard windows call is made to translate whatever type was passed into the variant type indicated. In this case an IUnknown * is passed and the python com code asks it to be converted to VT_DISPATCH (IDispatch *) which means that IUnknown->QueryInterface is called to get an IDispatch interface. Since the INetConnection interface doesn't derive from IDispatch and that class doesn't support it this call fails telling you it can't get that interface. When makepy iterates through the type library it sees the argument to the function is type INetConnection *. When it is passed though it needs to be either IDispatch * or IUnknown * because that's what the dispatch (VARIANT) supports. I guess it just assumed that IDispatch * would work. It may not have bothered to see what INetConnection derived from or it may have made a mistake. -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions." From Benjamin.Schollnick at usa.xerox.com Fri Oct 24 11:40:00 2003 From: Benjamin.Schollnick at usa.xerox.com (Schollnick, Benjamin) Date: Fri Oct 24 11:40:21 2003 Subject: [python-win32] Help, with Remote Registry access? Message-ID: <51B62EFFBC83D6118ADA00096BB030A107CADBF2@usamcms7.mc.usa.xerox.com> Folks, I am having difficulty with *reading* the registry from a remote Windows box... 1) I need to impersonate a different user name & password, then the user I am currently logged in as. (i.e. access the registry as a administrator) 2) The registry to be examined is on a different machine... 3) I just need the key entry returned.... For example \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DrWatson\AppendToLogFile returning the value it has been saved with. I by no means am a Win32 Python expert, but I usually can muddle my way through.... But I am missing something here... And I am not sure what... I have proof of concept VBScript code.... strroot = "HKEY_LOCAL_MACHINE" strKeyPath = "\SOFTWARE\Microsoft\DrWatson" strKey = "AppendToLogFile" Dim arrValues strKeyPath = "\SOFTWARE\Microsoft\DrWatson" strKey = "AppendToLogfile" objRegister.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strKey, value Wscript.Echo value Here's the code that I have attempted to use.... Can anyone point out what I am missing? It works fine locally, but I can't figure out how to assign the user account and password for the remote system. import _winreg import win32com.client host = "127.0.0.1" # local host key = _winreg.ConnectRegistry(host, _winreg.HKEY_LOCAL_MACHINE) hkey = _winreg.OpenKey(key, r"Software\Microsoft\Windows\CurrentVersion\Uninstall") num = _winreg.QueryInfoKey(hkey)[0] print "*** Found %d Software ***" % num try: for x in range(1000): uninstall = _winreg.EnumKey(hkey, x) skey = _winreg.OpenKey(key, "Software\Microsoft\Windows\CurrentVersion\Uninstall\%s" % uninstall) try: software = _winreg.QueryValueEx(skey, "DisplayName")[0] print "%s-%s" % (uninstall, software) except: pass except: pass From master at hilug.org Mon Oct 27 04:38:55 2003 From: master at hilug.org (Y.H. Rhiu) Date: Mon Oct 27 04:39:16 2003 Subject: [python-win32] E_ACCESSDENIED problem with disk quota. Message-ID: <003e01c39c6e$24d859c0$ca3fe7cb@LocalHost> Sorry, I repost this mail because of email MIME-encoding problem. :( This is last try :) -------------------------------------------------------------------- Hi, I'm testing to control Windows disk quota by python on win2003 and winXP. But ther is some problem.. This is the test code: import win32com.client qutoa=win32com.client.Dispatch('Microsoft.DiskQuota.1') quota.Initialize('c:\\',1) test=quota.AddUser('test') ## 'test' is real account name in my machine. test.QuotaLimit=10000000 # 10MB However, If I run it within PythonWin, I get this returned error message: >>> t.QuotaLimit=10000000 Traceback (most recent call last): File "", line 1, in ? File "C:\Python22\Lib\site-packages\win32com\client\__init__.py", line 355, in __setattr__ apply(self._oleobj_.Invoke, args + (value,) + defArgs) com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147024891), None) I have known error code -2147024891 (0x80070005) means E_ACCESSDENIED by someone's kind help. (Thanks Roger :) But I run PythonWin on Administrator privilege and I couldn't find any related method for setting permission in 'Microsoft.DiskQuota.1' object. Does anyone have any ideas? Thanks! -- Y.H. Rhiu From moof at metamoof.net Mon Oct 27 06:08:59 2003 From: moof at metamoof.net (Moof) Date: Mon Oct 27 06:11:32 2003 Subject: [python-win32] Locale settings under python in windows. Message-ID: <3F9CFCCB.8020805@metamoof.net> Hi there, I'm currently trying to validate the input for a web form, the validator for which is running under python 2.3 on windows (currently XP, but soon 2K). I'm validating text input, and trying something along the lines of: namere = re.compile(u'''(?x) #verbose format (?i) #ignore case (?L) #Locale active - #saves me defining accents, etc. ^ #start of string [ #Start group \w #all letters plus _ \ #space \.,:' #some punctuation ??? -/\\ \d #all digits ]+ $ #end of string ''') and then rejecting the string if it does not match that regex. The thing that gets me is \w. The Python 2.3 documentation specifies that \w will include all letters in the current locale, which for me would be ('es_ES', 'cp1252') but it blatantly isn't: >>> namere.match('hola') <_sre.SRE_Match object at 0x01366918> >>> namere.match('hol?') >>> So a closer look reveals: >>> locale.getlocale() (None, None) >>> locale.getdefaultlocale() ('es_ES', 'cp1252') >>> locale.setlocale(locale.LC_CTYPE, locale.getdefaultlocale()) Traceback (most recent call last): File "", line 1, in ? File "C:\Python23\lib\locale.py", line 381, in setlocale return _setlocale(category, locale) Error: locale setting not supported Which basically buggers my regexp. How *can* I set locale, or how do I get around this problem? Moof -- Giles Antonio Radford, a.k.a Moof Sympathy, eupathy, and, currently, apathy coming to you at: From yhrhiu at simplexi.com Mon Oct 27 04:37:19 2003 From: yhrhiu at simplexi.com (yhrhiu@simplexi.com) Date: Mon Oct 27 09:36:38 2003 Subject: [python-win32] E_ACCESSDENIED problem with disk quota. Message-ID: <002e01c39c6d$eacba9d0$ca3fe7cb@LocalHost> Sorry, I repost this mail because of email MIME-encoding problem. :( This is last try :) -------------------------------------------------------------------- Hi, I'm testing to control Windows disk quota by python on win2003 and winXP. But ther is some problem.. This is the test code: import win32com.client qutoa=win32com.client.Dispatch('Microsoft.DiskQuota.1') quota.Initialize('c:\\',1) test=quota.AddUser('test') ## 'test' is real account name in my machine. test.QuotaLimit=10000000 # 10MB However, If I run it within PythonWin, I get this returned error message: >>> t.QuotaLimit=10000000 Traceback (most recent call last): File "", line 1, in ? File "C:\Python22\Lib\site-packages\win32com\client\__init__.py", line 355, in __setattr__ apply(self._oleobj_.Invoke, args + (value,) + defArgs) com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147024891), None) I have known error code -2147024891 (0x80070005) means E_ACCESSDENIED by someone's kind help. (Thanks Roger :) But I run PythonWin on Administrator privilege and I couldn't find any related method for setting permission in 'Microsoft.DiskQuota.1' object. Does anyone have any ideas? Thanks! -- Y.H. Rhiu From lbates at syscononline.com Mon Oct 27 15:32:58 2003 From: lbates at syscononline.com (Larry Bates) Date: Mon Oct 27 15:32:59 2003 Subject: [python-win32] py2exe failure on long path In-Reply-To: Message-ID: <000601c39cc9$82c73a00$5d00a8c0@LABWXP> I have a relatively simple Python program that I wish to make into .EXE using py2exe. When I try to execute the application I get: Traceback (most recent call last): File "", line 2, in ? File "imputil.pyc", line 103, in _import_hook File "", line 52, in _import_top_module File "imputil.pyc", line 216, in import_top File "imputil.pyc", line 267, in _import_one File "", line 163, in get_code ImportError: DLL load failed: The process cannot access the file because it is being used by another process. It doesn't appear to tell me which DLL load failed and I can promise that none of the .DLLs called from this program are in use by another process (I even rebooted my machine just to make sure). I copied this from my server where it had a long path name of: F:\Swami\Projects\Syscon\WTS\SQLdblog\dist\SQLdblog\SQLdblog.exe to C:\Junk\SQLdblog\SQLdblog.exe (along with the supporting .DLL, .PYD, etc. files) and it runs fine. Seems to be a problem with the length of the path where the program is being executed from. Regards, Larry Bates From sureshsubbiah at india.com Tue Oct 28 06:48:51 2003 From: sureshsubbiah at india.com (Sachin S.Suresh) Date: Tue Oct 28 06:49:02 2003 Subject: [python-win32] Urgent reg Type conversion in Python Message-ID: <20031028114852.4314.qmail@india.com> hi ppl, fine and how r u? i've got a problem with the c++ com object usage in python. i've imported and could able to create an pythin object of a com dll file using win32com.client library. << dll file name is RouterClient.dll and the class name is RouterClass. RouterClass has a member function such as SendMsgToTheServer(int,BSTR)-c++ convention)>> the code i've used to create is, ----------------------------------- import win32com.client obj = win32com.client.Dispatch("RouterClient.RouterClass") msg = '0100000000101000076xxxxx' obj.SendMsgToTheServer(432,msg) # 432 is the channel used to send the message ------------------------------------ Now the problem comes, if i run this file say sender.py, i've one error message as : File "win32com\gen_py\D9330E72-3056-4517-AD81-0A15DBDA3899x0x1x0.py", line 34, in SendMsgToTheServer TypeError: The VARIANT type is unknown (0000001e) Some observation i found : * if i create that object in PythonWin editor and while trying to call that SendMsgToTheServer(), once i put this open brace, i could c the parameter data types as, obj.SendToTheServer(KeyRange = I am attempting to convert the following VB Script code to Python, but with limited success. I appear to be connecting fine, but I can't get the registry information out... I can get the manifest, and I do have the correct permissions with the user account that I am using... The VB code works, so it is a issue with the python implementation... ------------------------ VB Code ----------------------------- Const HKEY_CURRENT_USER = &H80000001 Set objLocator = CreateObject("WbemScripting.SWbemLocator") Set objWMIService = objLocator.ConnectServer("13.1.99.43", "root\default", "operator", "spire") objWMIService.Security_.ImpersonationLevel = 3 set objRegister = objWMIService.get("StdRegProv") Dim arrValues strKeyPath = "Software\SCITEX\GUI" strKey = "Version" objRegister.GetStringValue HKEY_CURRENT_USER, strKeyPath, strKey, value Wscript.Echo value -------------------------------------------------------------------------- import _winreg import win32com.client HostName = "remote_ip" # local host login_account = "account name" account_pass = "password" strKeyPath = r"\HKEY_LOCAL_MACHINE\SOFTWARe\Microsoft\DrWatson" strKey = r"AppendToLogFile" HKLM = 0x80000001L objLocator = win32com.client.Dispatch ("WbemScripting.SWbemLocator") print dir(objLocator) objWMIService = objLocator.ConnectServer (HostName, "root\default", login_account, account_pass) objWMIService.Security_.ImpersonationLevel = 3 print dir(objWMIService.__class__) # # Dir is showing a "generic" dynamic listing??? Why? # #print objWMIService.__doc__ objRegister = objWMIService.Get ("StdRegProv") test = objRegister.GetObjectText_ ( 1 ) #test2 = objRegister.GetStringValue_ ( "SOFTWARE\Microsoft\DrWatson", "AppendToLogFile" ) print test2 # Print's the manifest #print test From brian at zope.com Tue Oct 28 14:20:17 2003 From: brian at zope.com (Brian Lloyd) Date: Tue Oct 28 15:44:11 2003 Subject: [python-win32] Python for .NET 1.0 beta 1 release Message-ID: (Forgot to post this to the win32 list...) Python for .NET 1.0 beta 1 has been released - you can download it from: http://www.zope.org/Members/Brian/PythonNet/ Python for .NET is a near-seamless integration of Python with the .NET common language runtime. For more details, see the README: http://www.zope.org/Members/Brian/PythonNet/README.html With the 1.0 b1 release, it is nearly feature-complete and is now usable for real applications (some simple demos are included). There is also now a mailing list for discussion, questions and issues related to Python for .NET at: pythondotnet@python.org. To subscribe to the mailing list or read the online archives, see: http://mail.python.org/mailman/listinfo/pythondotnet Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com From PYTHON at telefonica.net Thu Oct 30 17:25:06 2003 From: PYTHON at telefonica.net (PYTHON@telefonica.net) Date: Thu Oct 30 17:25:47 2003 Subject: [python-win32] Controlling WinZip with python Message-ID: <2310d23a14.23a142310d@teleline.es> Hi all, Does anybody know how can i compress a whole directory using winzip with python? I?ve read there is a command-line version of winzip but it?s still a beta version...anybody has used it? thanks From Chris.Ingram at Synchrologic.com Thu Oct 30 17:30:32 2003 From: Chris.Ingram at Synchrologic.com (Chris Ingram) Date: Thu Oct 30 17:31:25 2003 Subject: [python-win32] Controlling WinZip with python Message-ID: Instead of calling out to an external program like WinZip, you'd probably be better off using the zipfile module in the Python standard library. I've used it, and it works well. Documentation is available at http://www.python.org/doc/2.3.2/lib/module-zipfile.html. -- Chris Ingram, Synchrologic, Inc. Email: Chris.Ingram@synchrologic.com Phone: 678-802-1305 (direct) Office: 770-754-5600x1305 -----Original Message----- From: PYTHON@telefonica.net [mailto:PYTHON@telefonica.net] Sent: Thursday, October 30, 2003 5:25 PM To: python-win32@python.org Subject: [python-win32] Controlling WinZip with python Hi all, Does anybody know how can i compress a whole directory using winzip with python? I?ve read there is a command-line version of winzip but it?s still a beta version...anybody has used it? thanks _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From Duane.Kaufman at med.ge.com Thu Oct 30 17:30:38 2003 From: Duane.Kaufman at med.ge.com (Kaufman, Duane (MED, LUNAR)) Date: Thu Oct 30 17:32:00 2003 Subject: [python-win32] Controlling WinZip with python Message-ID: Hi, I would suggest using the capabilities provided by the ZipFile module in the Python distribution. Duane > -----Original Message----- > From: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org]On Behalf Of > PYTHON@telefonica.net > Sent: Thursday, October 30, 2003 4:25 PM > To: python-win32@python.org > Subject: [python-win32] Controlling WinZip with python > > > Hi all, > > Does anybody know how can i compress a whole directory > using winzip > with python? I?ve read there is a command-line version of winzip but > it?s still a beta version...anybody has used it? > > thanks > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From pierre.hjalm at dis.uu.se Fri Oct 31 06:46:14 2003 From: pierre.hjalm at dis.uu.se (Pierre =?ISO-8859-1?Q?Hj=E4lm?=) Date: Fri Oct 31 10:40:19 2003 Subject: [python-win32] Creating users with ADSI Message-ID: <20031031124614.1d76a29f.pierre.hjalm@dis.uu.se> Why does the code below give this error message?: Traceback (most recent call last): File "usertest2.py", line 12, in ? aduser.Setinfo() File ">", line 2, in Setinfo pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147019886), None) # code from win32com.client import Dispatch adsi=Dispatch("ADsNamespaces") ou=adsi.GetObject("","LDAP://ou=Employees,dc=test,dc=local") # above line changed to protect the innocent ;) aduser=ou.Create("User","cn=test") aduser.Put("sAMAccountName","test") aduser.Put("givenName","test") aduser.Put("sn","test") aduser.Put("userPrincipalName","test") aduser.Setinfo() -- Pierre Hj?lm, Systems Administrator Department of Information Science, Uppsala University, Sweden email:pierre.hjalm@dis.uu.se phone:+46-(0)18-4711044 fax:+46-(0)18-554422 From dave at psys.org Fri Oct 31 20:30:55 2003 From: dave at psys.org (d.w. harks) Date: Fri Oct 31 20:30:58 2003 Subject: [python-win32] Creating users with ADSI In-Reply-To: <20031031124614.1d76a29f.pierre.hjalm@dis.uu.se> References: <20031031124614.1d76a29f.pierre.hjalm@dis.uu.se> Message-ID: <20031101013054.GC15041@psys.org> With carefully-arranged electrons, Pierre Hj?lm wrote: > Why does the code below give this error message?: > > Traceback (most recent call last): > File "usertest2.py", line 12, in ? > aduser.Setinfo() > File ">", line 2, in Setinfo > pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147019886), None) > > > # code > from win32com.client import Dispatch > > adsi=Dispatch("ADsNamespaces") > ou=adsi.GetObject("","LDAP://ou=Employees,dc=test,dc=local") > # above line changed to protect the innocent ;) > > aduser=ou.Create("User","cn=test") > > aduser.Put("sAMAccountName","test") > aduser.Put("givenName","test") > aduser.Put("sn","test") > aduser.Put("userPrincipalName","test") > aduser.Setinfo() > try: aduser=ou.Create("User","cn=test") aduser.Put("sAMAccountName", "blah") aduser.Setinfo() aduser.Put("givenName","test) ... aduser.Setinfo() As to why there would need to be a separate setinfo() call to set the samaccountname, I'm not entirely sure. I think it has to do with some extra data sitting in the property cache, causing setinfo to get confused... dave -- David W. Harks http://dwblog.psys.org