From someshbartakke at hotmail.com Mon Mar 1 02:01:19 2004 From: someshbartakke at hotmail.com (Somesh Bartakke) Date: Mon Mar 1 01:59:23 2004 Subject: [python-win32] skins + win32all Message-ID: wanna know how to use ActiveSkins for my program from python ? either thru win32 or any other (say PyGTk etc) on win32 platform ? Somesh Bartakke -- Truth does not pay homage to society, ancient or modern but society has to pay homage to Truth or ..Die ! -- Swami Vivekanand -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040301/dc5bea1f/attachment.html From theller at python.net Mon Mar 1 03:59:15 2004 From: theller at python.net (Thomas Heller) Date: Mon Mar 1 03:59:40 2004 Subject: [python-win32] Re: OleLoadPicture PyIStream and Resource files References: Message-ID: <65dplz8c.fsf@python.net> "Kerry Oliphant" writes: > I am using OleLoadPicture to assign bitmaps to an ImageList control. > However, right now I have to load each bitmap from a file and write the data > to an PyIStream object. I would like to be able to just get the bitmaps > from a loaded resource DLL to write to the PyIStream object. Does anyone > know how to do this? You should look into the win32api.EnumResourceTypes() and win32api.EnumResourceNames() functions to find out about the resources in the file, then you should be able to win32api.LoadResource() to get the data. Thomas From jkreps at rev.state.ne.us Mon Mar 1 08:55:36 2004 From: jkreps at rev.state.ne.us (jkreps@rev.state.ne.us) Date: Mon Mar 1 08:58:30 2004 Subject: [python-win32] Re: Found how to use TLBs with py2exe, Message-ID: Andreas Maurer > To: jkreps@rev.state.ne.us cc: python-win32@python.org 02/28/2004 07:07 Subject: Re: [python-win32] Re: Found how to use TLBs with AM py2exe, jkreps@rev.state.ne.us schrieb: >> "I don't have VSS installed (shudder), I use CVS ;-)" >> >> CVS is sweet, fast and stable. >All this properties -in our context- does have VSS also. >Is CVS also shipped with an COM Automation Library? No. I use Boa_Constructor as my GUI RAD dev tool, which is built on pxPython and wxWindows widgets and looks and runs the same on either platform. The apps made with it runs on either a Windows box or a Linux box, and if one is careful about the fonts that are used no code changes are necessary. We are moving away from Microsoft's Common Object Model and dependence on Microsoft in general. In Windows I use CVSNT and TortoiseCVS. In Linux I use Cervesia, which is a plugin for Konqueror. There are two other OpenSource version control systems available: Subversion and Arch (aka tla). Subversion is CVS with all the oddities and difficulties removed. Arch is a totally different approach. Subversion has a Windows version and an IE plugin, just like CVS. Arch is available only for Linux. Since this thread started I moved to Subversion and am very pleased with it. JLK From pyama at snafu.de Mon Mar 1 09:44:26 2004 From: pyama at snafu.de (pyama@snafu.de) Date: Mon Mar 1 09:44:30 2004 Subject: [python-win32] Re: Found how to use TLBs with py2exe, Message-ID: > > >All this properties -in our context- does have VSS also. > >Is CVS also shipped with an COM Automation Library? > > No. > > I use Boa_Constructor as my GUI RAD dev tool, which is built on pxPython > and wxWindows widgets and looks and runs the same on either platform. The > apps made with it runs on either a Windows box or a Linux box, and if one > is careful about the fonts that are used no code changes are necessary. > > We are moving away from Microsoft's Common Object Model and dependence on > Microsoft in general. In Windows I use CVSNT and TortoiseCVS. In Linux I > ... cut ... IMHO we should change to other groups like alt.versioncontrol... or alt.os_struggle_against_each_other.... The reason why I've postet is, that the VSS TLB seems to be something special (*Maybe*. Any kinds of hints are welcome, something concerning this problem is even new for me and possibly other readers of the group may also learn something new to solve problems like this.) I've mentioned, the ClearCase TLB works very satisfying on WinNT/2k together with Python. I've written some cool tools in the past. Myself, I much more would like to work with CC, but now, I don't have it. The goal is, to help the creator of py2exe makeing py2exe more flexible, if -perhaps- other guys use some other funny TLBs. Subversion and other VC-Tools may be well, great and fine, but their existence don't help us to solve the problem and does not increase the power of the already powerfull py2exe tool. Andi From jkreps at rev.state.ne.us Mon Mar 1 09:58:10 2004 From: jkreps at rev.state.ne.us (jkreps@rev.state.ne.us) Date: Mon Mar 1 10:01:07 2004 Subject: [python-win32] Re: Found how to use TLBs with py2exe, Message-ID: ============ JLK http://www.linuxiso.org/viewdoc.php/introtolinux.html pyama@snafu.de To: jkreps@rev.state.ne.us, python-win32@python.org 03/01/2004 08:44 cc: AM Subject: Re: [python-win32] Re: Found how to use TLBs with py2exe, >> >> >>All this properties -in our context- does have VSS also. >> >>Is CVS also shipped with an COM Automation Library? >> >> No. >> >> I use Boa_Constructor as my GUI RAD dev tool, which is built on pxPython >> and wxWindows widgets and looks and runs the same on either platform. The >> apps made with it runs on either a Windows box or a Linux box, and if one >> is careful about the fonts that are used no code changes are necessary. >> >> We are moving away from Microsoft's Common Object Model and dependence on >> Microsoft in general. In Windows I use CVSNT and TortoiseCVS. In Linux I >> ... cut ... >IMHO we should change to other groups like alt.versioncontrol... >or alt.os_struggle_against_each_other.... I don't believe I've seen those two newsgroups, ;-) but my IT department won't let us connect to newsgroups for security reasons. :-( >The reason why I've postet is, that the VSS TLB seems to be >something special (*Maybe*. Any kinds of hints are welcome, >something concerning this problem is even new for me and possibly >other readers of the group may also learn something new to solve >problems like this.) >I've mentioned, the ClearCase TLB works very satisfying on >WinNT/2k together with Python. I've written some cool tools >in the past. Myself, I much more would like to work with CC, >but now, I don't have it. >The goal is, to help the creator of py2exe makeing py2exe more >flexible, if -perhaps- other guys use some other funny TLBs. >Subversion and other VC-Tools may be well, great and fine, but >their existence don't help us to solve the problem and does not >increase the power of the already powerfull py2exe tool. Py2exe is a very neat tool but in certain circumstances it is not helpful. For example: you have developed an Python based app that connects to an Oracle backend via ODBC. Using py2exe works well to create a Windows executable, but the IT department needs to install a user dns on each workstation and the Oracle admin needs to add each user to the Oracle user database. So, the only thing saved by using py2exe is not having to install Python on each workstation. However, when IT sets up a workstation, or rebuilds it after it corrupts itself, it has to install several apps anyway (virus scanners, schedulers, QuickTime, Roxio, Network clients and utilities, etc..., so Python can be just one more. Py2exe is, however, a very nice way to insure that the user does not have the ability to edit *.py files by allowing Python NOT to be installed. JLK From lpritc at scri.sari.ac.uk Mon Mar 1 10:13:04 2004 From: lpritc at scri.sari.ac.uk (Leighton Pritchard) Date: Mon Mar 1 10:13:11 2004 Subject: [python-win32] Re: Found how to use TLBs with py2exe, In-Reply-To: References: Message-ID: <40435300.3060507@scri.sari.ac.uk> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 | Py2exe is a very neat tool but in certain circumstances it is not helpful. | For example: you have developed an Python based app that connects to an | Oracle backend via ODBC. Using py2exe works well to create a Windows | executable, but the IT department needs to install [...] so Python can be | just one more. Py2exe is, however, a very nice way to insure that the user | does not have the ability to edit *.py files by allowing Python NOT to be | installed. JLK Speaking from my own experience, many of the small utilities and scripts I write in Python for the biologists in our group have to be run on Windows, as the IT policy at our institute isn't exactly *nix-friendly for 'ordinary' users. Python is not installed on machines as they come, nor would it be likely that IT would take it upon themselves to keep workstations up-to-date with the latest modules and libraries (e.g. BioPython) that I need to use. Py2exe is invaluable to me in distributing the code that I write and making it usable amongst the less computer-literate in the institute. - -- Dr Leighton Pritchard AMRSC D104, PPI, Scottish Crop Research Institute Invergowrie, Dundee, DD2 5DA, Scotland, UK E: lpritc@scri.sari.ac.uk W: http://bioinf.scri.sari.ac.uk/index.shtml T: +44 (0)1382 568579 F: +44 (0)1382 568578 PGP key FEFC205C: GPG key E58BA41B: http://www.keyserver.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFAQ1MAL1gZ+OWLpBsRAqU3AJ0devfMUUHNmlNllZ+CuSIJXP08XACfeC6f YTI+beR+uOywbD0wsKkbJes= =vjWr -----END PGP SIGNATURE----- From jkreps at rev.state.ne.us Mon Mar 1 10:16:14 2004 From: jkreps at rev.state.ne.us (jkreps@rev.state.ne.us) Date: Mon Mar 1 10:19:13 2004 Subject: [python-win32] Re: Found how to use TLBs with py2exe, Message-ID: Leighton Pritchard cc: Sent by: Subject: Re: [python-win32] Re: Found how to use TLBs with python-win32-bounces py2exe, @python.org 03/01/2004 09:13 AM -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 || Py2exe is a very neat tool but in certain circumstances it is not helpful. || For example: you have developed an Python based app that connects to an || Oracle backend via ODBC. Using py2exe works well to create a Windows || executable, but the IT department needs to install [...] so Python can be || just one more. Py2exe is, however, a very nice way to insure that the user || does not have the ability to edit *.py files by allowing Python NOT to be || installed. JLK |Speaking from my own experience, many of the small utilities and scripts I |write in Python for the biologists in our group have to be run on Windows, as |the IT policy at our institute isn't exactly *nix-friendly for 'ordinary' |users. Python is not installed on machines as they come, nor would it be |likely that IT would take it upon themselves to keep workstations up-to-date |with the latest modules and libraries (e.g. BioPython) that I need to use. |Py2exe is invaluable to me in distributing the code that I write and making it |usable amongst the less computer-literate in the institute. Hi Doc, Py2exe does that task admirably. Do any of your "small utilities and scripts" contain GUI interfaces and/or connections to database backends that require pre-installed client services and/or logins to pre-existing accounts? From amaurer at snafu.de Mon Mar 1 10:14:50 2004 From: amaurer at snafu.de (amaurer@snafu.de) Date: Mon Mar 1 10:24:30 2004 Subject: [python-win32] Re: Found how to use TLBs with py2exe, Message-ID: > > Py2exe is a very neat tool but in certain circumstances it is not helpful. > For example: you have developed an Python based app that connects to an > Oracle backend via ODBC. Using py2exe works well to create a Windows > executable, but the IT department needs to install a user dns on each > workstation and the Oracle admin needs to add each user to the Oracle user > database. So, the only thing saved by using py2exe is not having to > install Python on each workstation. However, when IT sets up a > workstation, or rebuilds it after it corrupts itself, it has to install > several apps anyway (virus scanners, schedulers, QuickTime, Roxio, Network > clients and utilities, etc..., so Python can be just one more. Py2exe is, > however, a very nice way to insure that the user does not have the ability > to edit *.py files by allowing Python NOT to be installed. > JLK Little Hint: Wise Install Manager, Ino-Installer (Freeware), MSI (Microsoft). With this tools, it's no problem to install any software and ODBC-DSNs. You can also uninstall software (Control Panel -> software). Are these problems two different problems? Andi From jkreps at rev.state.ne.us Mon Mar 1 10:25:35 2004 From: jkreps at rev.state.ne.us (jkreps@rev.state.ne.us) Date: Mon Mar 1 10:28:23 2004 Subject: [python-win32] Re: Found how to use TLBs with py2exe, Message-ID: amaurer@snafu.de To: jkreps@rev.state.ne.us, pyama@snafu.de, 03/01/2004 09:14 python-win32@python.org AM cc: Subject: Re: [python-win32] Re: Found how to use TLBs with py2exe, >> >> Py2exe is a very neat tool but in certain circumstances it is not helpful. >> For example: you have developed an Python based app that connects to an >> Oracle backend via ODBC. Using py2exe works well to create a Windows >> executable, but the IT department needs to install a user dns on each >> workstation and the Oracle admin needs to add each user to the Oracle user >> database. So, the only thing saved by using py2exe is not having to >> install Python on each workstation. However, when IT sets up a >> workstation, or rebuilds it after it corrupts itself, it has to install >> several apps anyway (virus scanners, schedulers, QuickTime, Roxio, Network >> clients and utilities, etc..., so Python can be just one more. Py2exe is, >> however, a very nice way to insure that the user does not have the ability >> to edit *.py files by allowing Python NOT to be installed. >> JLK >Little Hint: >Wise Install Manager, Ino-Installer (Freeware), MSI (Microsoft). >With this tools, it's no problem to install any software and ODBC-DSNs. >You can also uninstall software (Control Panel ->> software). Standard software, all in use by us, but ... >Are these problems two different problems? Yes. The idea of py2exe is NOT to have to install Python, for which it works well. But, some applications require additional installations that py2exe doesn't help with. For example, py2exe can bundle the Oracle mxODBC driver into the app.exe, but it can't install the Oracle client nor setup the user dns, tasks restricted to our IT staff. So one could just as easily, when installing these additional apps, install Python. The only reason not to is to keep users from editing *.py scripts. Py2exe makes this easy because the *.py scripts are not in the 'dist' directory that py2exe creates. Don't get me wrong... I appreciate py2exe, but its only virtue in our circumstance is to keep *.py scripts out of the hands of users. JLK From lpritc at scri.sari.ac.uk Mon Mar 1 10:47:20 2004 From: lpritc at scri.sari.ac.uk (Leighton Pritchard) Date: Mon Mar 1 10:47:26 2004 Subject: [python-win32] Re: Found how to use TLBs with py2exe, In-Reply-To: References: Message-ID: <40435B08.3050105@scri.sari.ac.uk> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 jkreps@rev.state.ne.us wrote: | |Speaking from my own experience, many of the small utilities and scripts I | |write in Python for the biologists in our group have to be run on Windows, | [...] | |Py2exe is invaluable to me in distributing the code that I write and | making it | |usable amongst the less computer-literate in the institute. | | Hi Doc, | Py2exe does that task admirably. Do any of your "small utilities and | scripts" contain GUI interfaces and/or connections to database backends | that require pre-installed client services and/or logins to pre-existing | accounts? Don't get me wrong - I'm not criticising your analysis, just making the point that py2exe has more utility to me than just preventing alterations to *.py files. As it happens, some of the utilities have involved GUIs (in my previous job), but none made any connections to local databases. Where local databases are required, I tend to provide the services by other means, and where public databases are required, pre-installed client services and/or logins to pre-existing accounts haven't been an issue. - -- Dr Leighton Pritchard AMRSC D104, PPI, Scottish Crop Research Institute Invergowrie, Dundee, DD2 5DA, Scotland, UK E: lpritc@scri.sari.ac.uk W: http://bioinf.scri.sari.ac.uk/index.shtml T: +44 (0)1382 568579 F: +44 (0)1382 568578 PGP key FEFC205C: GPG key E58BA41B: http://www.keyserver.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFAQ1sIL1gZ+OWLpBsRApUBAJ9mB53AxDjbbPaTqGQ/DV3px7s0YQCeN+/O nyRi3vzoJOjGe7JLJ1SUWMc= =Xz1X -----END PGP SIGNATURE----- From Benjamin.Schollnick at usa.xerox.com Mon Mar 1 10:46:49 2004 From: Benjamin.Schollnick at usa.xerox.com (Schollnick, Benjamin) Date: Mon Mar 1 10:50:28 2004 Subject: [python-win32] Producing EXEs from Python Code Message-ID: <51B62EFFBC83D6118ADA00096BB030A107CADDEB@usamcms7.mc.usa.xerox.com> > |users. Python is not installed on machines as they come, > nor would it be > |likely that IT would take it upon themselves to keep workstations > up-to-date > |with the latest modules and libraries (e.g. BioPython) that > I need to use. > |Py2exe is invaluable to me in distributing the code that I write and > making it > |usable amongst the less computer-literate in the institute. > > Py2exe does that task admirably. Do any of your "small utilities and > scripts" contain GUI interfaces and/or connections to > database backends > that require pre-installed client services and/or logins to > pre-existing > accounts? I alternatively use the McMillian Installer package instead..... But Py2Exe & Installer are roughly comparable.... The main feature in both packages is the ability to effectively roll the Python core into the exe, so that Python does not have to be installed on the client system. These packages will not prevent you from have to have ODBC connection, logins or other local machine configuration issues that would have to be handled by hand normally. Although, you could use the Win32 libraries, and create new drive mappings, create desktop icons, and other Windows based issues in a local python script that you have EXE'd... (i.e. a Install runtime script) Both Py2exe and Installer allow GUI creation... In the case of the Installer package, it will go through, and examine the code to see what is imported, and bundle that with the application. (i.e. Tkinter, etc...) - Benjamin From Benjamin.Schollnick at usa.xerox.com Mon Mar 1 11:02:33 2004 From: Benjamin.Schollnick at usa.xerox.com (Schollnick, Benjamin) Date: Mon Mar 1 11:02:54 2004 Subject: [python-win32] Re: Found how to use TLBs with py2exe, Message-ID: <51B62EFFBC83D6118ADA00096BB030A107CADDED@usamcms7.mc.usa.xerox.com> > > clients and utilities, etc..., so Python can be just one > more. Py2exe is, > > however, a very nice way to insure that the user does not > have the ability > > to edit *.py files by allowing Python NOT to be installed. > > JLK Correct, but for the wrong reasons. Py2Exe & Installer do not necessarily prevent the user from editing the .py files. Any text editor can open and edit the .py files. They "hide" the .py files, and thus can make it harder to modify the files. > Little Hint: > > Wise Install Manager, Ino-Installer (Freeware), MSI (Microsoft). > With this tools, it's no problem to install any software and > ODBC-DSNs. > You can also uninstall software (Control Panel -> software). > > Are these problems two different problems? I agree. Two different issues. Those installers also should have some depency management features. - Benjamin From pyama at snafu.de Mon Mar 1 11:06:31 2004 From: pyama at snafu.de (pyama@snafu.de) Date: Mon Mar 1 11:06:34 2004 Subject: [python-win32] Re: Found how to use TLBs with py2exe, Message-ID: > > Py2exe is a very neat tool but in certain circumstances it is not helpful. > For example: you have developed an Python based app that connects to an > Oracle backend via ODBC. Using py2exe works well to create a Windows > executable, but the IT department needs to install a user dns on each > workstation and the Oracle admin needs to add each user to the Oracle user > database. So, the only thing saved by using py2exe is not having to > install Python on each workstation. However, when IT sets up a > workstation, or rebuilds it after it corrupts itself, it has to install > several apps anyway (virus scanners, schedulers, QuickTime, Roxio, Network > clients and utilities, etc..., so Python can be just one more. Py2exe is, > however, a very nice way to insure that the user does not have the ability > to edit *.py files by allowing Python NOT to be installed. > JLK Little Hint: Wise Install Manager, Inno-Installer (Freeware), MSI (Microsoft). With this tools, it's no problem to install any software and ODBC-DSNs. You can also uninstall software-packages (Control Panel -> software). Perhaps, are these problems two different problems? ;-) Andi From jkreps at rev.state.ne.us Mon Mar 1 11:09:11 2004 From: jkreps at rev.state.ne.us (jkreps@rev.state.ne.us) Date: Mon Mar 1 11:12:06 2004 Subject: [python-win32] Re: Found how to use TLBs with py2exe, Message-ID: "Schollnick, Benjamin" > cc: Sent by: Subject: RE: [python-win32] Re: Found how to use TLBs with python-win32-bounces@pyth py2exe, on.org 03/01/2004 10:02 AM >> >> clients and utilities, etc..., so Python can be just one >> more. Py2exe is, >> >> however, a very nice way to insure that the user does not >> have the ability >> >> to edit *.py files by allowing Python NOT to be installed. >> >> JLK >Correct, but for the wrong reasons. >Py2Exe & Installer do not necessarily prevent the user from >editing the .py files. Any text editor can open and edit the >.py files. >They "hide" the .py files, and thus can make it harder to modify >the files. "hide" ??? mmm... my version of py2exe creates a 'dist' directory which contains *.pyd files and the *.exe files, none of which are not editable with a text editor. No *.py files are present in it. Does yours work differently? JLK From wangwm at igsnrr.ac.cn Mon Mar 1 20:09:47 2004 From: wangwm at igsnrr.ac.cn (Wang Weimin) Date: Mon Mar 1 20:09:38 2004 Subject: [python-win32] Error with PyWinTypes22.dll Message-ID: <4043DEDB.365E8A37@igsnrr.ac.cn> Hi,everybody When i try to run a python script program on win32 platform,it displays, F:\wangwm\python\Win32\ch15_internet_protocols>python simplenewsviewer.py Traceback (most recent call last): File "simplenewsviewer.py", line 17, in ? import win32api # to execute our browser. ImportError: DLL load failed: 找不到指定的程序。 And a dialog displays as the attachment. Does anyone know how to solve this problem?Thanks for any advice. -- Best Regards, Weimin -------------- next part -------------- A non-text attachment was scrubbed... Name: Python.gif Type: image/gif Size: 20213 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20040302/81afa137/Python.gif From amonroe at columbus.rr.com Mon Mar 1 20:30:43 2004 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Mon Mar 1 20:25:29 2004 Subject: [python-win32] Re: Found how to use TLBs with py2exe, In-Reply-To: References: Message-ID: <13477826989.20040301203043@columbus.rr.com> > py2exe creates. Don't get me wrong... I appreciate py2exe, but its only > virtue in our circumstance is to keep *.py scripts out of the hands of > users. Just curious how this tradition arose at your site. I think it's interesting the different perspectives you see. It seems like if you're a windows shop it's possible that users already have scripting at their disposal via Windows Script Host. Also, unless you're at a REALLY techy site, people just simply wouldn't BOTHER trying to write scripts even if they Python on their boxes. Alan From rwupole at msn.com Tue Mar 2 01:08:06 2004 From: rwupole at msn.com (Roger Upole) Date: Mon Mar 1 21:51:45 2004 Subject: [python-win32] Re: Error with PyWinTypes22.dll Message-ID: <000601c4001c$bc7735f0$0917c943@rupole> This is due to a version mismatch between Pywintypes22.dll and win32api.pyd. Try doing a complete uninstall/reinstall of the windows extensions, and check that you don't have an extra version of either of those files left anywhere. Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040301/69296130/attachment.html From mferguson at ntlworld.com Wed Mar 3 08:34:33 2004 From: mferguson at ntlworld.com (mferguson@ntlworld.com) Date: Wed Mar 3 08:35:17 2004 Subject: [python-win32] (no subject) Message-ID: <20040303133516.SBUY10961.mta07-svc.ntlworld.com@mta7-svc> I've been playing with an IE automation example and poking about in the IE DOM. I've got a bit of an understanding of what's going on but I was wondering if there was a way to know what attributes/properties/methods are available (other than looking at other people's code), I use the available MS doc ( http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_document.asp ) but it just doesn't quite seem to cover everything. For example, if I go to a particular page (code simplified): ie = DispatchEx('InternetExplorer.Application') doc = ie.Navigate( 'http://myserver/mypage.html'') then I can do: >>> doc.forms[0].name u'SelectSession' >>> doc.images[0].name u'' >>> doc.images[0].nameProp u'top.gif' >>> Now, I used 'nameProp' above because I saw it in another script but how would I have worked out that 'nameProp' works for images but forms use 'name'? Is there a way to get a list of all the available properties? Thanks, Mark. ----------------------------------------- Email provided by http://www.ntlhome.com/ From mferguson at ntlworld.com Thu Mar 4 05:04:30 2004 From: mferguson at ntlworld.com (mferguson@ntlworld.com) Date: Thu Mar 4 09:30:27 2004 Subject: [python-win32] Processing IE DOM events. Message-ID: <20040304100648.UUJH22458.mta03-svc.ntlworld.com@[10.137.100.63]> I'm looking the simplest way to handle IE DOM events in my python scripts. This looks promising but obviously isn't quite right: >>> doc.getElementById("submit").attachEvent("onClick",myfunc) Traceback (most recent call last): File "", line 1, in ? File "", line 2, in attachEvent ValueError: argument is not a COM object >>> Can this approach be made to work, or is there some other way to achieve the same thing? Thanks, Mark. ----------------------------------------- Email provided by http://www.ntlhome.com/ From mferguson at ntlworld.com Thu Mar 4 05:06:50 2004 From: mferguson at ntlworld.com (mferguson@ntlworld.com) Date: Thu Mar 4 09:30:29 2004 Subject: [python-win32] Processing IE DOM events. Message-ID: <20040304100714.UUXF22458.mta03-svc.ntlworld.com@[10.137.100.63]> I'm looking the simplest way to handle IE DOM events in my python scripts. This looks promising but obviously isn't quite right: >>> doc.getElementById("submit").attachEvent("onClick",myfunc) Traceback (most recent call last): File "", line 1, in ? File "", line 2, in attachEvent ValueError: argument is not a COM object >>> Can this approach be made to work, or is there some other way to achieve the same thing? Thanks, Mark. ----------------------------------------- Email provided by http://www.ntlhome.com/ From mferguson at ntlworld.com Thu Mar 4 12:02:28 2004 From: mferguson at ntlworld.com (mferguson@ntlworld.com) Date: Thu Mar 4 13:46:22 2004 Subject: [python-win32] Processing IE DOM events. Message-ID: <20040304170142.OLXS14417.mta02-svc.ntlworld.com@[10.137.100.62]> > > From: > Date: 2004/03/04 Thu AM 10:06:50 GMT > To: python-win32@python.org > Subject: [python-win32] Processing IE DOM events. > > I'm looking the simplest way to handle IE DOM events in my python scripts. This looks promising but obviously isn't quite right: > > >>> doc.getElementById("submit").attachEvent("onClick",myfunc) > Traceback (most recent call last): > File "", line 1, in ? > File "", line 2, in attachEvent > ValueError: argument is not a COM object > >>> > > Can this approach be made to work, or is there some other way to achieve the same thing? > > Thanks, > > Mark. OK, I've managed to get an event handler working, as below: from win32com.client import gencache, DispatchEx import time mod = gencache.EnsureModule('{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}', 0, 1, 1) docmod = gencache.EnsureModule('{3050F1C5-98B5-11CF-BB82-00AA00BDCE0B}', 0, 4, 0) class domEvents(docmod.HTMLDocumentEvents2): def __init__(self, obj): self.seen = 0 docmod.HTMLDocumentEvents2.__init__(self, obj) def Ononclick(self, ev): self.seen += 1 ev = gencache.EnsureDispatch(ev) el = ev.srcElement print 'click on %s(%s) - "%s", at (%d,%d)' % ( el.tagName, el.id, el.innerText, ev.clientX, ev.clientY) ie=DispatchEx("InternetExplorer.Application") ie.Navigate('http://localhost/page.html'); ie.Visible=1 while ie.Busy: time.sleep(0.1) handler = domEvents(ie.Document) #--------------------------------- And I get event info printed such as: click on INPUT() - "", at (361,220) click on INPUT() - "", at (518,245) Now, if I change 'el.id' to 'el.name', it craps out on me thus: File "C:\Python23\Lib\site-packages\win32com\server\policy.py", line 275, in _Invoke_ return self._invoke_(dispid, lcid, wFlags, args) File "C:\Python23\Lib\site-packages\win32com\server\policy.py", line 280, in _invoke_ return S_OK, -1, self._invokeex_(dispid, lcid, wFlags, args, None, None) File "C:\Python23\Lib\site-packages\win32com\server\policy.py", line 541, in _invokeex_ return func(*args) File "D:\Automate\py\dwevents3.py", line 16, in Ononclick print 'click on %s(%s) - "%s", at (%d,%d)' % ( File "C:\Python23\Lib\site-packages\win32com\client\__init__.py", line 450, in __getattr__ raise AttributeError, "'%s' object has no attribute '%s'" % (repr(self), attr) exceptions.AttributeError: '' object has no attribute 'name' Next, from the interactive window I do: >>> e = doc.getElementsByTagName('INPUT') >>> for i in e: ... print i.name ... username password submit What am I misunderstanding here? Why does the element accessed in the event handler have 'tagName' and 'id' attributes but no 'name' attribute? TIA, Mark. ----------------------------------------- Email provided by http://www.ntlhome.com/ From koen_van_herck at yahoo.com Fri Mar 5 05:03:35 2004 From: koen_van_herck at yahoo.com (Koen Van Herck) Date: Fri Mar 5 05:05:44 2004 Subject: [python-win32] EnsureModule raises AssertionError if typelib is updated Message-ID: <000c01c40299$6d909420$4028000a@KVanherck> I use win32com.client.EnsureModule() to import my typelib. If the typelib itself (the DLL) is updated (e.g. using "touch"), EnsureModule will cause the following error: File "C:\Python23\lib\site-packages\win32com\client\gencache.py", line 507, in EnsureModule module = MakeModuleForTypelib(typelibCLSID, lcid, major, minor, progressInstance, bForDemand = bForDemand, bBuildHidden = bBuildHidden) File "C:\Python23\lib\site-packages\win32com\client\gencache.py", line 279, in MakeModuleForTypelib makepy.GenerateFromTypeLibSpec( (typelibCLSID, lcid, major, minor), progressInstance=progressInstance, bForDemand = bForDemand, bBuildHidden = bBuildHidden) File "C:\Python23\lib\site-packages\win32com\client\makepy.py", line 273, in GenerateFromTypeLibSpec gencache.AddModuleToCache(info.clsid, info.lcid, info.major, info.minor) File "C:\Python23\lib\site-packages\win32com\client\gencache.py", line 542, in AddModuleToCache assert not mod.__dict__.has_key("_in_gencache_"), \ AssertionError: This module has already been processed by this process The files in gen_py are updated correctly, and if I run the same script again, EnsureModule works fine (until I update the DLL again). Any help? Thanks, Koen Van Herck. From rasjidw at openminddev.net Fri Mar 5 06:03:56 2004 From: rasjidw at openminddev.net (Rasjid Wilcox) Date: Fri Mar 5 06:00:54 2004 Subject: [python-win32] Calling Python functions from Visual Basic Message-ID: <200403052203.56973.rasjidw@openminddev.net> I'm looking into the ways of making Python functions available to Visual Basic 6 programs. So far it seems that I could use: * COM * XML-RPC * SOAP The former seems to require creating the COM component and registering it as a service, the latter two require running an XML-RPC or SOAP server. The advantage of the former I assume is speed, the latter two portability. Are there any other methods that I have missed? Also, the only XML-RPC library for VB I could find is vbXMLRPC.dll (http://www.enappsys.com/backend/vbXMLRPC_Index.jsp). Are there any others? It does seem that MS has a SOAP library, so there are no issues with that one (I hope). In terms of examples for creating a COM object using Python, I have found http://www.hps1.demon.co.uk/users/andy/pyvb/ which is dated 4 June 1997. Is this example still valid for current versions of Python and win32all? Thanks in advance for any feedback, Rasjid. -- Rasjid Wilcox Canberra, Australia (UTC +11 hrs) http://www.openminddev.net From mhammond at keypoint.com.au Fri Mar 5 21:39:51 2004 From: mhammond at keypoint.com.au (Mark Hammond) Date: Fri Mar 5 21:40:15 2004 Subject: [python-win32] Calling Python functions from Visual Basic In-Reply-To: <200403052203.56973.rasjidw@openminddev.net> Message-ID: <2d9c01c40324$4d722a10$0200a8c0@eden> > The former seems to require creating the COM component and > registering it as a > service, the latter two require running an XML-RPC or SOAP server. Just to be clear, in the nomenclature of win32com, you are registering a 'COM server'. This generally will not be a windows service. > The advantage of the former I assume is speed, the latter two > portability. > > Are there any other methods that I have missed? COM is pretty simple to get going too, which would be an advantage - nothing in the middle! I'm not familiar with using SOAP or XML-RPC from VB. > In terms of examples for creating a COM object using Python, > I have found > http://www.hps1.demon.co.uk/users/andy/pyvb/ which is dated 4 > June 1997. Is > this example still valid for current versions of Python and win32all? Generally, yes. The only things I could see that would be done differently are: * Remove the import of 'ni' - this was a very old Python module. * win32com.server.register has a HandleCommandLine() method that would generally be used, rather than the com object itself parsing sys.argv - although it could still choose to if it desired. Mark From mhammond at keypoint.com.au Fri Mar 5 21:45:02 2004 From: mhammond at keypoint.com.au (Mark Hammond) Date: Fri Mar 5 21:45:25 2004 Subject: [python-win32] EnsureModule raises AssertionError if typelib isupdated In-Reply-To: <000c01c40299$6d909420$4028000a@KVanherck> Message-ID: <2db601c40325$06a868f0$0200a8c0@eden> > "C:\Python23\lib\site-packages\win32com\client\gencache.py", line 542, > in AddModuleToCache > assert not mod.__dict__.has_key("_in_gencache_"), \ > AssertionError: This module has already been processed by this process > > The files in gen_py are updated correctly, and if I run the > same script > again, EnsureModule works fine (until I update the DLL again). > > Any help? This is a bug, and IIRC, py2exe has a similar issue in some cases. For now, removing the assertion should work, but it is pointing at something I should fix correctly. Mark. From forestiero at qwest.net Fri Mar 5 22:30:00 2004 From: forestiero at qwest.net (DogWalker) Date: Fri Mar 5 22:30:16 2004 Subject: [python-win32] Calling Python functions from Visual Basic References: <2d9c01c40324$4d722a10$0200a8c0@eden> Message-ID: <013101c4032b$4fe807e0$e69b0043@presario> Another way to run Python from Visual Basic is to use the Microsoft Script Control and ActiveX Python from ActiveState. ----- Original Message ----- From: Mark Hammond To: 'Rasjid Wilcox' ; python-win32@python.org Sent: Friday, March 05, 2004 6:39 PM Subject: RE: [python-win32] Calling Python functions from Visual Basic > The former seems to require creating the COM component and > registering it as a > service, the latter two require running an XML-RPC or SOAP server. Just to be clear, in the nomenclature of win32com, you are registering a 'COM server'. This generally will not be a windows service. > The advantage of the former I assume is speed, the latter two > portability. > > Are there any other methods that I have missed? COM is pretty simple to get going too, which would be an advantage - nothing in the middle! I'm not familiar with using SOAP or XML-RPC from VB. > In terms of examples for creating a COM object using Python, > I have found > http://www.hps1.demon.co.uk/users/andy/pyvb/ which is dated 4 > June 1997. Is > this example still valid for current versions of Python and win32all? Generally, yes. The only things I could see that would be done differently are: * Remove the import of 'ni' - this was a very old Python module. * win32com.server.register has a HandleCommandLine() method that would generally be used, rather than the com object itself parsing sys.argv - although it could still choose to if it desired. Mark _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040305/cd38a945/attachment.html From rasjidw at openminddev.net Fri Mar 5 22:48:33 2004 From: rasjidw at openminddev.net (Rasjid Wilcox) Date: Fri Mar 5 22:45:32 2004 Subject: [python-win32] Calling Python functions from Visual Basic In-Reply-To: <2d9c01c40324$4d722a10$0200a8c0@eden> References: <2d9c01c40324$4d722a10$0200a8c0@eden> Message-ID: <200403061448.33602.rasjidw@openminddev.net> On Saturday 06 March 2004 13:39, Mark Hammond wrote: > > > In terms of examples for creating a COM object using Python, > > I have found > > http://www.hps1.demon.co.uk/users/andy/pyvb/ which is dated 4 > > June 1997. Is > > this example still valid for current versions of Python and win32all? > > Generally, yes. The only things I could see that would be done differently > are: > * Remove the import of 'ni' - this was a very old Python module. > * win32com.server.register has a HandleCommandLine() method that would > generally be used, rather than the com object itself parsing sys.argv - > although it could still choose to if it desired. Thanks for that. I'll give it a try. Cheers, Rasjid. -- Rasjid Wilcox Canberra, Australia (UTC +11 hrs) http://www.openminddev.net From someshbartakke at hotmail.com Tue Mar 9 00:45:13 2004 From: someshbartakke at hotmail.com (Somesh Bartakke) Date: Tue Mar 9 00:43:19 2004 Subject: [python-win32] Deploying vc apps with python ? Message-ID: how to deploy application which uses Python gluing ? (embeded python) on win32 platform ? i used python 2.3.3 -library with release with vc++ 6 which dlls other files need to be deployed ? plz ans if anyone kNows .. thanX in +vance !! Somesh Bartakke -- Truth does not pay homage to society, ancient or modern but society has to pay homage to Truth or ..Die ! -- Swami Vivekanand -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040309/75bc5d84/attachment.html From Chris.Cioffi at Anthem.com Tue Mar 9 11:14:51 2004 From: Chris.Cioffi at Anthem.com (Cioffi, Chris) Date: Tue Mar 9 11:14:24 2004 Subject: [python-win32] Problems with SetFileAttributes Message-ID: <466C52CBC2CBBB47B679E66745D542F8ABBA1D@ntes01.in.trigon.com> Hello all, I'm writing a little app where I need to create some directories that I would like to set the compressed flag on for Win2K. However, neither win32file.SetFileAttributes nor win32api.SetFileAttributes seems to work. Here's what I've done to test: import win32api import win32con import win32file filename = 'c:\\inetpub\\docs' def method1(): print "use the win32api module to set the compress flag" attr = win32api.GetFileAttributes(filename) print 'Starting attrributes: %d' % attr new_attr = attr | win32con.FILE_ATTRIBUTE_COMPRESSED print 'New attributes: %d' % new_attr win32api.SetFileAttributes(filename, win32con.FILE_ATTRIBUTE_COMPRESSED) print 'Final attributes: %d\n' % win32api.GetFileAttributes(filename) return def method2(): print "use the win32file module to set the compress flag" attr = win32file.GetFileAttributes(filename) print 'Starting attrributes: %d' % attr new_attr = attr | win32con.FILE_ATTRIBUTE_COMPRESSED print 'New attributes: %d' % new_attr win32file.SetFileAttributes(filename, new_attr) print 'Final attributes: %d\n' % win32file.GetFileAttributes(filename) return if __name__ == '__main__': method1() method2() And I get the following back: >>> use the win32api module to set the compress flag Starting attrributes: 16 New attributes: 2064 Final attributes: 16 use the win32file module to set the compress flag Starting attrributes: 16 New attributes: 2064 Final attributes: 16 This is ActivePython v2.3.2, build 159. I do have admin rights to the whole machine and the directory is empty. Any info would be appreciated. Chris Cioffi Enterprise Technology Specialist 800-991-7259 Confidentiality Note: This message, including files attached to it, may contain confidential information that is intended only for the use of the ADDRESSEE(S) named above. If you are not an intended recipient, you are hereby notified that any dissemination or copying of the information contained in this message, or the taking of any action in reliance upon the information, is strictly prohibited. If you have received this message in error, please notify the sender immediately and delete the message from your system. Thank you. CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information or otherwise protected by law. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040309/3638f5bb/attachment.html From theller at python.net Tue Mar 9 12:12:25 2004 From: theller at python.net (Thomas Heller) Date: Tue Mar 9 12:12:34 2004 Subject: [python-win32] Re: Problems with SetFileAttributes References: <466C52CBC2CBBB47B679E66745D542F8ABBA1D@ntes01.in.trigon.com> Message-ID: "Cioffi, Chris" writes: > Hello all, > > I'm writing a little app where I need to create some directories that I > would like to set the compressed flag on for Win2K. However, neither > win32file.SetFileAttributes nor win32api.SetFileAttributes seems to work. Quote from MSDN for SetFileAttributes(): The following table describes how to set the attributes that cannot be set using SetFileAttributes. FILE_ATTRIBUTE_COMPRESSED To set a file's compression state, use the DeviceIoControl function with the FSCTL_SET_COMPRESSION operation. Using pywin32 doesn't save you to read MS docs. Thomas From rwupole at msn.com Tue Mar 9 22:33:25 2004 From: rwupole at msn.com (Roger Upole) Date: Tue Mar 9 19:17:02 2004 Subject: [python-win32] Re: Problems with SetFileAttributes Message-ID: <000601c40650$740a02e0$6717c943@rupole> The wmi class Win32_Directory has Compress and UnCompress methods. import win32com.client wmi=win32com.client.GetObject('winmgmts:') directories=wmi.ExecQuery("select * from Win32_Directory where Name='h:\\\\misc'") for directory in directories: directory.ExecMethod_('Compress') hth Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040309/06f7cbca/attachment.html From tim.golden at viacom-outdoor.co.uk Wed Mar 10 10:01:45 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Wed Mar 10 10:02:25 2004 Subject: [python-win32] Re: Problems with SetFileAttributes Message-ID: Roger> The wmi class Win32_Directory has Compress and UnCompress methods. Roger> import win32com.client Roger> wmi=win32com.client.GetObject('winmgmts:') Roger> directories=wmi.ExecQuery("select * from Win32_Directory where Name='h:\\\\misc'") Roger> for directory in directories: Roger> directory.ExecMethod_('Compress') I don't think I've ever seen an message on this list from Roger which hasn't extended my knowledge of Python/Win32 in some useful way. Thanks very much 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 hameedkhaan at yahoo.com Thu Mar 11 02:56:44 2004 From: hameedkhaan at yahoo.com (Hameed Khan) Date: Thu Mar 11 02:56:48 2004 Subject: [python-win32] win32com.client and microsoft agent question Message-ID: <20040311075644.54038.qmail@web61107.mail.yahoo.com> Hi, i want to control microsoft agent from python. i try look microsoft documentation and come up with the following code but it gives me errors i am pasting the log from interactive shell session. ##### CODE BEGINS ###### >>> import win32com.client as wincom >>> wincom >>> ag = wincom.Dispatch("Agent.Control") >>> charac = ag.Character("peedy") Traceback (most recent call last): File "", line 1, in ? File "D:\PYTHON\Lib\site-packages\win32com\client\dynamic.py", line 477, in __getattr__ raise AttributeError, "%s.%s" % (self._username_, attr) AttributeError: Agent.Control.Character >>> charac = ag.Characters("peedy") Traceback (most recent call last): File "", line 1, in ? File "D:\PYTHON\Lib\site-packages\win32com\client\dynamic.py", line 471, in __getattr__ raise pythoncom.com_error, details pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Agent.Control.2', 'Microsoft Agent was unable to start.\nVerify that Microsoft Agent is properly installed.', None, 0, -2147212030 ), None) >>> charac = ag.Characters.Load("peedy") Traceback (most recent call last): File "", line 1, in ? File "D:\PYTHON\Lib\site-packages\win32com\client\dynamic.py", line 471, in __getattr__ raise pythoncom.com_error, details pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Agent.Control.2', 'Microsoft Agent was unable to start.\nVerify that Microsoft Agent is properly installed.', None, 0, -2147212030 ), None) >>> #### CODE END #### i need just pointer of what kind of error is it. becuase i have porperly installed microsoft agents it works well with other applications line mIRC and others. All your comments, suggestions and help will be much appreciated. Thanks, Hameed __________________________________ Do you Yahoo!? Yahoo! Search - Find what you抮e looking for faster http://search.yahoo.com From benn at cenix-bioscience.com Thu Mar 11 05:57:14 2004 From: benn at cenix-bioscience.com (Neil Benn) Date: Thu Mar 11 05:57:18 2004 Subject: [python-win32] win32pipe Usage Message-ID: <4050460A.2070509@cenix-bioscience.com> Hello, I'm starting to get to grips with Python-win32 but I have a couple of questions I was hoping somebody could advise me with : Looking at the win32api documentation on the ActiveState website, there are a number of classes I can use (one of them being pyHANDLE). However I cannot find which module the classes are defined in, is there any information (I've done google searches - to no avail) which will tell me where these classes are defined so that I can import them? Also, more specific, I'm attempting to write a python program which will talk to a Named Pipe created by another process. I can do this successfully with win32pipe.CallNamedPipe(), however this method connects and disconnects to the pipe on each transaction. Does anyone know how to connect to an existing named pipe and leave that connection open for a period of time (then closing when completed). Thanks, in advance for your assistance. Cheers, Neil -- Neil Benn Senior Automation Engineer Cenix BioScience PfotenhauerStrasse 108 D-01307 Dresden Germany Tel : +49 (351) 210 1300 e-mail : benn@cenix-bioscience.com Cenix Website : http://www.cenix-bioscience.com From tim.golden at viacom-outdoor.co.uk Thu Mar 11 06:15:31 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Thu Mar 11 06:16:16 2004 Subject: [python-win32] win32pipe Usage Message-ID: Neil> Looking at the win32api documentation on the ActiveState website, Neil> there are a number of classes I can use (one of them being pyHANDLE). Neil> However I cannot find which module the classes are defined in, Neil> is there any information (I've done google searches - to no avail) Neil> which will tell me where these classes are defined so that I can import Neil> them? pyHANDLE is something of a special case, I suspect, since I can't think of a situation in which you're going to create it yourself: it'll always be returned from a call to, CreateFile etc. Once you have the handle, the documentation which I assume you've seen for the pyHANDLE object itself applies, although there's not much one can usefully do with it except close it and refer to its [handle] property which is the real Win32 Handle. Are there other classes you can't find out about? If so, what are they? I find the ActiveState CHM docs to be pretty good on the whole. And, in case you haven't already looked, the Mark Hammond & Andy Robinson book "Python Programming on Win32" is a must-have. (At least via Safari: http://safari.oreilly.com/1565926218). Ultimately, search the source, but that needs more time than most people have when they're in a hurry! Neil> I'm attempting to write a python program which Neil> will talk to a Named Pipe created by another process. Neil> I can do this successfully with win32pipe.CallNamedPipe(), Neil> however this method connects and disconnects to the pipe Neil> on each transaction. Does anyone know how to connect to Neil> an existing named pipe and leave that connection Neil> open for a period of time (then closing when completed). Yes, I saw your post on c.l.py earlier. No experience of my own, I'm afraid, and I don't have time to experiment just at the moment. Could you post some useful code? Ideally using Python at both ends of the pipe, but at least showing the sequence of events from the Python perspective? 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 theller at python.net Thu Mar 11 06:29:06 2004 From: theller at python.net (Thomas Heller) Date: Thu Mar 11 06:29:33 2004 Subject: [python-win32] Re: win32pipe Usage References: <4050460A.2070509@cenix-bioscience.com> Message-ID: Neil Benn writes: > Hello, > > I'm starting to get to grips with Python-win32 but I have > a couple of questions I was hoping somebody could advise > me with : > > Looking at the win32api documentation on the ActiveState website, > there are a number of classes I can use (one of them being > pyHANDLE). However I cannot find which module the classes are > defined in, is there any information (I've done google searches - > to no avail) which will tell me where these classes are defined so > that I can import them? Without having looked deeper, I would guess they are defined in pywintypes, which is an extension module implemented in C++. Took a look, it seems you can create them by pywintypes.HANDLE(integer) Thomas From mshane at vfemail.net Thu Mar 11 15:42:37 2004 From: mshane at vfemail.net (mshane@vfemail.net) Date: Thu Mar 11 15:42:43 2004 Subject: [python-win32] 5991 USER Objects in PythonWin IDE Message-ID: <1079037757.b07d3e7dc4b90@www.vfemail.net> When I startup the PythonWin IDE, I find it allocates 5991 USER Objects, as shown in the Windows Task Manager (Under the 'Processes' tab, use the 'View->Select Columns...' menu to look at the USER Objects). I've been getting errors in Outlook about running out of memory that go away when I close PythonWin. Now I can either code or use email, but not both (not that that's a bad thing, necessarily). Is this normal? Does anyone else get the same number of USER Objects? I'm running on Windows 2000, with PythonWin 2.3.2 (#49, Nov 13 2003, 10:34:54) [MSC v.1200 32 bit (Intel)] on win32, that I installed from ActiveState ActivePython-2.3.2-232-win32-ix86.msi. This maybe a red herring, but I believe the problem started when I upgraded from Mozilla 1.1 to Mozilla 1.6 and Firefox 0.8. Previous to that upgrade I had often run both PythonWin and Outlook together. I've uninstalled both Mozilla 1.6 and Firefox 0.8, and reinstalled ActivePython, but no change in the number of USER Objects. Any help would be appreciated. I've really gotten to like the IDE, and the debugger especially. I'd be very sad to have to go back to IDLE. Thanks very much. Mike. From rwupole at msn.com Thu Mar 11 21:20:06 2004 From: rwupole at msn.com (Roger Upole) Date: Thu Mar 11 18:03:46 2004 Subject: [python-win32] Re: win32pipe Usage Message-ID: <001001c407d8$8b0d1fc0$5917c943@rupole> You should be able to use win32file.CreateFile to connect to a pipe, and ReadFile and WriteFile to transfer data. (although I've never actually used them for this purpose myself) The msdn docs at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/pipes.asp give a pretty good overview. Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040311/5226ec35/attachment.html From rwupole at msn.com Fri Mar 12 04:58:38 2004 From: rwupole at msn.com (Roger Upole) Date: Fri Mar 12 01:42:20 2004 Subject: [python-win32] Re: win32com.client and microsoft agent question Message-ID: <001001c40818$98d91f60$8b17c943@rupole> I played around with this for a while, had to do ag.Connected=True before the error msg went away and I could do anything useful. Pretty fun, I can think of some amusing uses for this. Anybody know if you can create your own characters ? Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040312/77a4384c/attachment.html From graham.bloice at trihedral.com Fri Mar 12 04:08:34 2004 From: graham.bloice at trihedral.com (Graham Bloice) Date: Fri Mar 12 04:08:51 2004 Subject: [python-win32] 5991 USER Objects in PythonWin IDE In-Reply-To: <1079037757.b07d3e7dc4b90@www.vfemail.net> Message-ID: > When I startup the PythonWin IDE, I find it allocates 5991 USER > Objects, as > shown in the Windows Task Manager (Under the 'Processes' tab, use the > 'View->Select Columns...' menu to look at the USER Objects). > I've been getting > errors in Outlook about running out of memory that go away when I close > PythonWin. Now I can either code or use email, but not both (not > that that's > a bad thing, necessarily). Is this normal? Does anyone else get the same > number of USER Objects? > On both PythonWin 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit (Intel)] on win32 on W2K and PythonWin 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC 32 bit (Intel)] on win32 on WXP Pro I get 75 USER objects. Regards, Graham Bloice From glc at well.com Fri Mar 12 08:45:52 2004 From: glc at well.com (Greg Chapman) Date: Fri Mar 12 08:46:25 2004 Subject: [python-win32] Re: 5991 USER Objects in PythonWin IDE References: <1079037757.b07d3e7dc4b90@www.vfemail.net> Message-ID: On Thu, 11 Mar 2004 14:42:37 -0600, mshane@vfemail.net wrote: >When I startup the PythonWin IDE, I find it allocates 5991 USER Objects, as >shown in the Windows Task Manager (Under the 'Processes' tab, use the >'View->Select Columns...' menu to look at the USER Objects). I've been getting >errors in Outlook about running out of memory that go away when I close >PythonWin. Now I can either code or use email, but not both (not that that's >a bad thing, necessarily). Is this normal? Does anyone else get the same >number of USER Objects? > I get 75 USER objects with Windows XP, Python 2.3.3, win32all 200. You may want to check the registry key: HKCU\Software\Python\\Python for Win32 Earlier this year, I ran into a situation where I had hundreds of ToolbarDebugging and ToolbarDefault keys in that key (right now, I have 10 of each). This caused wierd global problems like no menubar in Notepad and a damaged Windows Start Menu. Uninstalling win32all, deleting the "Python for Win32" registry key and then reinstalling fixed the problem, at least so far. Your symptoms seem different than what I had, but it's probably worth a look in the registry anyway. --- Greg Chapman From gtalvola at nameconnector.com Fri Mar 12 09:17:44 2004 From: gtalvola at nameconnector.com (Geoffrey Talvola) Date: Fri Mar 12 09:17:51 2004 Subject: [python-win32] Re: 5991 USER Objects in PythonWin IDE Message-ID: <61957B071FF421419E567A28A45C7FE59AF9E1@mailbox.nameconnector.com> Greg Chapman wrote: > I get 75 USER objects with Windows XP, Python 2.3.3, win32all 200. > You may want to check the registry key: > > HKCU\Software\Python\\Python for Win32 > > Earlier this year, I ran into a situation where I had hundreds of > ToolbarDebugging and ToolbarDefault keys in that key (right > now, I have 10 of > each). This caused wierd global problems like no menubar in Notepad > and a damaged Windows Start Menu. Uninstalling win32all, deleting > the "Python for > Win32" registry key and then reinstalling fixed the problem, > at least so far. > Your symptoms seem different than what I had, but it's > probably worth a look in > the registry anyway. I'm in the same situation -- PythonWin causes other apps to misbehave. And I also have a ridiculous number of ToolbarDebugging and ToolbarDefault keys in the registry. Any idea what causes this? I'm using PythonWin build 163; any idea if this is fixed in a newer release? - Geoff From glc at well.com Fri Mar 12 13:27:55 2004 From: glc at well.com (Greg Chapman) Date: Fri Mar 12 13:28:22 2004 Subject: [python-win32] Re: 5991 USER Objects in PythonWin IDE References: <61957B071FF421419E567A28A45C7FE59AF9E1@mailbox.nameconnector.com> Message-ID: On Fri, 12 Mar 2004 09:17:44 -0500, Geoffrey Talvola wrote: >I'm in the same situation -- PythonWin causes other apps to misbehave. And >I also have a ridiculous number of ToolbarDebugging and ToolbarDefault keys >in the registry. Any idea what causes this? I'm using PythonWin build 163; >any idea if this is fixed in a newer release? > I have no idea what causes it. It's only happened to me once; I was using build 163 at the time. I'm now using build 200, but I don't know if that build has fixed this or if it's only a matter of time before I run into it again. Here's a bug report from Sourceforge which apparently indicates that the bug has been there at least since build 154: https://sourceforge.net/tracker/index.php?func=detail&aid=849191&group_id=78018&atid=551954 That report also suggests commenting out this call: frame.SaveBarState("ToolbarDebugging") in Pythonwin\pywin\debugger\debugger.py (the report refers to line 462 which in my version is a comment. The above is line 461 in debugger.py from build 200). I'll probably go ahead and try that myself and hope that it will keep the problem from occurring. --- Greg Chapman From mshane at vfemail.net Fri Mar 12 16:20:36 2004 From: mshane at vfemail.net (mshane@vfemail.net) Date: Fri Mar 12 16:21:07 2004 Subject: [python-win32] Re: 5991 USER Objects in PythonWin IDE In-Reply-To: References: Message-ID: <1079126436.9617f3a011ba2@www.vfemail.net> Greg Chapman wrote: > I get 75 USER objects with Windows XP, Python 2.3.3, win32all 200. You may > want to check the registry key: > > HKCU\Software\Python\\Python for Win32 > > Earlier this year, I ran into a situation where I had hundreds of > ToolbarDebugging and ToolbarDefault keys in that key (right now, I have 10 of > each). This caused wierd global problems like no menubar in Notepad and a > damaged Windows Start Menu. Uninstalling win32all, deleting the "Python for > Win32" registry key and then reinstalling fixed the problem, at least so far. > Your symptoms seem different than what I had, but it's probably worth a look > in the registry anyway. That fixed it! I had over 3000 entries in registry directory: HKCU\Software\Python 2.3\Python for Win32 After uninstalling ActivePython, removing the 'Python for Win32' directory, and reinstalling ActivePython, now I get 75 USER Objects. Thanks very much! Mike. From mchaffin at microsatsystems.com Fri Mar 12 18:10:26 2004 From: mchaffin at microsatsystems.com (Chaffin, Michael) Date: Fri Mar 12 21:52:53 2004 Subject: [python-win32] How to interrupt embedded python interpreter Message-ID: I am trying to figure a way to pass on an interrupt to embedded python interpreters, specifically say when the my python script object goes out of scope. I have found an article by Stefan Migowky titled, 'Embedded python: how to force a break to endless looping python'. (http://groups.google.com/groups?q=python+%22Stefan+Migowsky%22&hl=en&lr=&ie =UTF-8&oe=UTF-8&newwindow=1&selm=326536345498D311B3BC00105A39802A074853%40ne wsintern.dspace.de&rnum=13 ) The problem I see with this solution is patching the python dll, and the patch is kind of old. Is there another way to interrupt embedded python interpreters ? If not, will the patch from Stefan still work on python 2.2 or 2.3 ? Michael S. Chaffin From boober95 at rogers.com Sat Mar 13 13:31:31 2004 From: boober95 at rogers.com (Bill) Date: Sat Mar 13 13:32:29 2004 Subject: [python-win32] Python Win32 and Active Directory Message-ID: Has anyone tried using Active Directory thru the Python Win32 API? I want to authenticate to AD and tried the simple example in the online docs for 'opends' but alway get 'AD' is an undefined symbol. I may have missed something obvious, but I sure can't see what it is :-( /bill From mhammond at keypoint.com.au Mon Mar 15 04:05:30 2004 From: mhammond at keypoint.com.au (Mark Hammond) Date: Mon Mar 15 04:05:54 2004 Subject: [python-win32] Python Win32 and Active Directory In-Reply-To: Message-ID: <00c801c40a6c$aa624850$0200a8c0@eden> > Has anyone tried using Active Directory thru the Python Win32 API? > > I want to authenticate to AD and tried the simple example in > the online > docs for 'opends' but alway get 'AD' is an undefined symbol. > I may have > missed something obvious, but I sure can't see what it is :-( Can you post your complete sample code, and the complete traceback you get? Mark. From mhammond at keypoint.com.au Mon Mar 15 04:07:29 2004 From: mhammond at keypoint.com.au (Mark Hammond) Date: Mon Mar 15 04:07:53 2004 Subject: [python-win32] How to interrupt embedded python interpreter In-Reply-To: Message-ID: <00d101c40a6c$f1d35080$0200a8c0@eden> Pythonwin uses PyErr_SetInterrupt() to implement this via the taskbar icon, and it seems to work OK. Mark. > -----Original Message----- > From: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org]On Behalf Of Chaffin, Michael > Sent: Saturday, 13 March 2004 10:10 AM > To: 'python-win32@python.org' > Subject: [python-win32] How to interrupt embedded python interpreter > > > I am trying to figure a way to pass on an interrupt to embedded python > interpreters, specifically say when the my python script > object goes out of > scope. I have found an article by Stefan Migowky titled, > 'Embedded python: > how to force a break to endless looping python'. > > (http://groups.google.com/groups?q=python+%22Stefan+Migowsky%2 > 2&hl=en&lr=&ie > =UTF-8&oe=UTF-8&newwindow=1&selm=326536345498D311B3BC00105A398 > 02A074853%40ne > wsintern.dspace.de&rnum=13 ) > > The problem I see with this solution is patching the python > dll, and the > patch is kind of old. Is there another way to interrupt > embedded python > interpreters ? > > If not, will the patch from Stefan still work on python 2.2 or 2.3 ? > > Michael S. Chaffin > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From ras at holmes.nl Mon Mar 15 07:43:23 2004 From: ras at holmes.nl (Martijn Ras) Date: Mon Mar 15 07:43:27 2004 Subject: [python-win32] Service fails on mapped network drive Message-ID: <4055A4EB.4090408@holmes.nl> Heya Folks, Since i updated my script so it can be run as service, it fails to work on files that are located on mapped network drives. 1) Share the root of your drive C. 2) Map the network drive. 3) Create the following three files in the root of your drive C Note: Replace the following in the python script files: with the name of your machine, with the share name you specified in step 1), with the drive you specified in step2). 4) Run 'python execfile_test.py', it will print "dit is een test" three times, as expected. 5) Install the service 'python execfile_test_server.py install'. 6) Open the services control panel: a) change the logon so the service run under an account that has sufficient rights on the mapped network drive. b) start the service. 7) Open the EventViewer, select the Application log. You'll notice "dit is een test" has been logged twice and the third loggin an IOError 'No such file or directory'. Any suggestions on getting this service functioning one mapped network files? Mazzel, Martijn. :::::::::::::: config.txt :::::::::::::: config = 'dit is een test' :::::::::::::: execfile_test.py :::::::::::::: config = {} execfile('C:\\config.txt', config) print str(config['config']) execfile('\\\\\\\\config.txt', config) print str(config['config']) execfile(':\\config.txt', config) print str(config['config']) :::::::::::::: execfile_test_server.py :::::::::::::: import exceptions import os import pywintypes import win32api import win32con import win32event import win32file import win32pipe import win32security import win32service import win32serviceutil class execfile_test_server(win32serviceutil.ServiceFramework): _svc_name_ = 'execfile_test_server' _svc_display_name_ = 'execfile_test_server' def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) self.overlapped = pywintypes.OVERLAPPED() self.overlapped.hEvent = win32event.CreateEvent(None,0,0,None) self.thread_handles = [] def SvcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event.SetEvent(self.hWaitStop) def SvcDoRun(self): import servicemanager # Write an event log record indicating we have started servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STARTED, (self._svc_name_, '')) config = {} execfile('C:\\config.txt', config) msg = str(config['config']) servicemanager.LogInfoMsg(msg) execfile('\\\\\\\\config.txt', config) msg = str(config['config']) servicemanager.LogInfoMsg(msg) execfile(':\\config.txt', config) msg = str(config['config']) servicemanager.LogInfoMsg(msg) # Write another event log record we have stopped servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STOPPED, (self._svc_name_, '')) if __name__=='__main__': win32serviceutil.HandleCommandLine(execfile_test_server) From ras at holmes.nl Mon Mar 15 07:40:59 2004 From: ras at holmes.nl (Martijn Ras) Date: Mon Mar 15 10:04:04 2004 Subject: [python-win32] Service fails on mapped network drive Message-ID: <4055A45B.7000006@holmes.nl> Heya Folks, Since i updated my script so it can be run as service, it fails to work on files that are located on mapped network drives. 1) Share the root of your drive C. 2) Map the network drive. 3) Create the following three files in the root of your drive C Note: Replace the following in the python script files: with the name of your machine, with the share name you specified in step 1), with the drive you specified in step2). 4) Run 'python execfile_test.py', it will print "dit is een test" three times, as expected. 5) Install the service 'python execfile_test_server.py install'. 6) Open the services control panel: a) change the logon so the service run under an account that has sufficient rights on the mapped network drive. b) start the service. 7) Open the EventViewer, select the Application log. You'll notice "dit is een test" has been logged twice and the third loggin an IOError 'No such file or directory'. Any suggestions on getting this service functioning one mapped network files? Mazzel, Martijn. :::::::::::::: config.txt :::::::::::::: config = 'dit is een test' :::::::::::::: execfile_test.py :::::::::::::: config = {} execfile('C:\\config.txt', config) print str(config['config']) execfile('\\\\\\\\config.txt', config) print str(config['config']) execfile(':\\config.txt', config) print str(config['config']) :::::::::::::: execfile_test_server.py :::::::::::::: import exceptions import os import pywintypes import win32api import win32con import win32event import win32file import win32pipe import win32security import win32service import win32serviceutil class execfile_test_server(win32serviceutil.ServiceFramework): _svc_name_ = 'execfile_test_server' _svc_display_name_ = 'execfile_test_server' def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) self.overlapped = pywintypes.OVERLAPPED() self.overlapped.hEvent = win32event.CreateEvent(None,0,0,None) self.thread_handles = [] def SvcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event.SetEvent(self.hWaitStop) def SvcDoRun(self): import servicemanager # Write an event log record indicating we have started servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STARTED, (self._svc_name_, '')) config = {} execfile('C:\\config.txt', config) msg = str(config['config']) servicemanager.LogInfoMsg(msg) execfile('\\\\\\\\config.txt', config) msg = str(config['config']) servicemanager.LogInfoMsg(msg) execfile(':\\config.txt', config) msg = str(config['config']) servicemanager.LogInfoMsg(msg) # Write another event log record we have stopped servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STOPPED, (self._svc_name_, '')) if __name__=='__main__': win32serviceutil.HandleCommandLine(execfile_test_server) From boober95 at rogers.com Mon Mar 15 12:06:49 2004 From: boober95 at rogers.com (Bill) Date: Mon Mar 15 12:07:27 2004 Subject: [python-win32] Python Win32 and Active Directory In-Reply-To: <00c801c40a6c$aa624850$0200a8c0@eden> References: <00c801c40a6c$aa624850$0200a8c0@eden> Message-ID: Mark, Thanks for getting back to me. Attached is the example I tried to run on my windows xp machine. What I want is authentication to a windows server, but I haven't gotten very far, but I'm new at this so I expect I've made an error? (I did fix the problem with the doc string which wasn't closed though.) /bill On March 15, 2004 04:05 am, Mark Hammond wrote: > > Has anyone tried using Active Directory thru the Python Win32 API? > > > > I want to authenticate to AD and tried the simple example in > > the online > > docs for 'opends' but alway get 'AD' is an undefined symbol. > > I may have > > missed something obvious, but I sure can't see what it is :-( > > Can you post your complete sample code, and the complete traceback you get? > > Mark. -------------- next part -------------- A non-text attachment was scrubbed... Name: opends.py.output.py Type: text/x-java Size: 2162 bytes Desc: not available Url : http://mail.python.org/pipermail/python-win32/attachments/20040315/a76e8aea/opends.py.output.bin From lbates at syscononline.com Mon Mar 15 12:25:57 2004 From: lbates at syscononline.com (Larry Bates) Date: Mon Mar 15 12:26:01 2004 Subject: [python-win32] Service fails on mapped network drive In-Reply-To: Message-ID: <037601c40ab2$94a4c7e0$5d00a8c0@LABWXP> Martijn, This is because services are not run under a context (user) that knows about your mapped network drives. You will probably have to run your service as a user that has the network drives mapped. -Larry Bates Message: 8 Date: Mon, 15 Mar 2004 13:40:59 +0100 From: Martijn Ras Subject: [python-win32] Service fails on mapped network drive To: python-win32@python.org Message-ID: <4055A45B.7000006@holmes.nl> Content-Type: text/plain; charset=us-ascii; format=flowed Heya Folks, Since i updated my script so it can be run as service, it fails to work on files that are located on mapped network drives. 1) Share the root of your drive C. 2) Map the network drive. 3) Create the following three files in the root of your drive C Note: Replace the following in the python script files: with the name of your machine, with the share name you specified in step 1), with the drive you specified in step2). 4) Run 'python execfile_test.py', it will print "dit is een test" three times, as expected. 5) Install the service 'python execfile_test_server.py install'. 6) Open the services control panel: a) change the logon so the service run under an account that has sufficient rights on the mapped network drive. b) start the service. 7) Open the EventViewer, select the Application log. You'll notice "dit is een test" has been logged twice and the third loggin an IOError 'No such file or directory'. Any suggestions on getting this service functioning one mapped network files? Mazzel, Martijn. :::::::::::::: config.txt :::::::::::::: config = 'dit is een test' :::::::::::::: execfile_test.py :::::::::::::: config = {} execfile('C:\\config.txt', config) print str(config['config']) execfile('\\\\\\\\config.txt', config) print str(config['config']) execfile(':\\config.txt', config) print str(config['config']) :::::::::::::: execfile_test_server.py :::::::::::::: import exceptions import os import pywintypes import win32api import win32con import win32event import win32file import win32pipe import win32security import win32service import win32serviceutil class execfile_test_server(win32serviceutil.ServiceFramework): _svc_name_ = 'execfile_test_server' _svc_display_name_ = 'execfile_test_server' def __init__(self, args): win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) self.overlapped = pywintypes.OVERLAPPED() self.overlapped.hEvent = win32event.CreateEvent(None,0,0,None) self.thread_handles = [] def SvcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event.SetEvent(self.hWaitStop) def SvcDoRun(self): import servicemanager # Write an event log record indicating we have started servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STARTED, (self._svc_name_, '')) config = {} execfile('C:\\config.txt', config) msg = str(config['config']) servicemanager.LogInfoMsg(msg) execfile('\\\\\\\\config.txt', config) msg = str(config['config']) servicemanager.LogInfoMsg(msg) execfile(':\\config.txt', config) msg = str(config['config']) servicemanager.LogInfoMsg(msg) # Write another event log record we have stopped servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STOPPED, (self._svc_name_, '')) if __name__=='__main__': win32serviceutil.HandleCommandLine(execfile_test_server) ------------------------------ _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 End of Python-win32 Digest, Vol 12, Issue 12 ******************************************** From amonroe at columbus.rr.com Mon Mar 15 15:41:30 2004 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Mon Mar 15 15:35:01 2004 Subject: [python-win32] Is there a Python win32 RunAs equivalent where you can send a password? Message-ID: <193675362860.20040315154130@columbus.rr.com> I need to spawn a commandline program from within my Python script multiple times. Each time it's spawned it needs to run under a different account from a different domain. As best I can tell, I can't spawn a cmd file and use the normal "runas" command provided in windows because it prompts for the password, and I need my script to run unattended. Any suggestions? I glanced at win32process.CreateProcessAsUser, but it didn't appear to have an argument to in which I could send the password. Alan From Christian.Wyglendowski at greenville.edu Mon Mar 15 15:45:36 2004 From: Christian.Wyglendowski at greenville.edu (Christian Wyglendowski) Date: Mon Mar 15 15:50:03 2004 Subject: [python-win32] Is there a Python win32 RunAs equivalent where youcan send a password? Message-ID: > -----Original Message----- > I need to spawn a commandline program from within my Python > script multiple times. Each time it's spawned it needs to run > under a different account from a different domain. As best I > can tell, I can't spawn a cmd file and use the normal "runas" > command provided in windows because it prompts for the > password, and I need my script to run unattended. Any suggestions? > > I glanced at win32process.CreateProcessAsUser, but it didn't > appear to have an argument to in which I could send the password. > Have a look at win32security.LogonUser and win32security.ImpersonateLoggedOnUser. There is a nice example in the Python Cookbook (print edition only, I think?) on page 257. I have also used a COM object called sfImpersonator to some success. You probably *could* spawn a cmd file and use popen to send the password, but it would have to be a hack. Christian http://www.dowski.com From Christian.Wyglendowski at greenville.edu Mon Mar 15 15:48:11 2004 From: Christian.Wyglendowski at greenville.edu (Christian Wyglendowski) Date: Mon Mar 15 15:50:07 2004 Subject: [python-win32] Is there a Python win32 RunAs equivalent where youcan send a password? Message-ID: Never mind my previous email saying that the example was in the print cookbook only - it is online at this link: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81402/index_txt Christian http://www.dowski.com From amonroe at columbus.rr.com Mon Mar 15 16:21:22 2004 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Mon Mar 15 16:14:53 2004 Subject: [python-win32] Is there a Python win32 RunAs equivalent where youcan send a password? In-Reply-To: References: Message-ID: <116677755090.20040315162122@columbus.rr.com> > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81402/index_txt This looks really promising, but I've got some kind of rights problem: >>> a = impersonate.Impersonate('somebody', 'xxxxxx') >>> a.logon() pywintypes.error: (1314, 'LogonUser', 'A required privilege is not held by the client.') From amonroe at columbus.rr.com Mon Mar 15 16:23:38 2004 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Mon Mar 15 16:17:08 2004 Subject: [python-win32] Is there a Python win32 RunAs equivalent where youcan send a password? In-Reply-To: References: Message-ID: <10677890765.20040315162338@columbus.rr.com> > *could* spawn a cmd file and use popen to send the password, but it > would have to be a hack. This occurred to me too, with the same reaction :^) Alan From pf_moore at yahoo.co.uk Mon Mar 15 17:52:10 2004 From: pf_moore at yahoo.co.uk (Paul Moore) Date: Mon Mar 15 17:52:32 2004 Subject: [python-win32] Re: Is there a Python win32 RunAs equivalent where youcan send a password? References: <116677755090.20040315162122@columbus.rr.com> Message-ID: "R. Alan Monroe" writes: >> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81402/index_txt > > This looks really promising, but I've got some kind of rights problem: > >>>> a = impersonate.Impersonate('somebody', 'xxxxxx') >>>> a.logon() > pywintypes.error: (1314, 'LogonUser', 'A required privilege is not held by the client.') Look at the comments in the recipe - the full text is at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81402/ Basically, you need special rights to do this "Act as part of the Operating System" is the key bit. The "RunAs" command gets round this by using a service as an intermediary. The "RunAs" service handles the job of running as a different user - it runs as the SYSTEM user, which has most rights on by default. Hope this helps, Paul -- This signature intentionally left blank From mhammond at keypoint.com.au Mon Mar 15 18:24:54 2004 From: mhammond at keypoint.com.au (Mark Hammond) Date: Mon Mar 15 18:25:46 2004 Subject: [python-win32] Python Win32 and Active Directory In-Reply-To: Message-ID: <02c701c40ae4$b9c2d030$0200a8c0@eden> I'm afraid I don't know the ActiveDirectory API well enough to know for sure, but: The code in question is: def opends(loc,server=''): '''automatically buoild ldap string and authenticate''' ldap=win32com.client.Dispatch('ADsNameSpaces').getobject("","LDAP:") ldap_main_loc='OU=people,DC=ad,DC=company,DC=state,DC=oh,DC=us' ldap_auth='CN=admin_account,'+ldap_main_loc #if there is no "," then they are not providing a full url #so append the standard url for it #if there is no '=', assume they want a cn if loc.find(',')==-1: if loc.find('=')==-1: loc='cn='+loc+','+Ad.ldap_main_loc else: loc=loc+','+Ad.ldap_main_loc if loc.find('LDAP://')==-1: loc='LDAP://'+loc return ldap.OpenDSObject(loc,Ad.ldap_auth,Ad.pw,1) And the traceback: File "", line 1, in ? File "C:\Shared\project\opends.py", line 29, in opends if loc.find('=')==-1: loc='cn='+loc+','+Ad.ldap_main_loc NameError: global name 'Ad' is not defined Looking at the line: if loc.find('=')==-1: loc='cn='+loc+','+Ad.ldap_main_loc It is trying to reference an 'Ad' object, to fetch its ldap_main_loc attribute. However, the code does not define an 'Ad' object - hence Python raises the NameError. It is telling you that you have referenced an object before you have defined it. I'm not sure what 'Ad' is supposed to be. However, you do have a variable called 'ldap_main_loc', so maybe this is what you meant - ie: if loc.find('=')==-1: loc='cn='+loc+','+ldap_main_loc I note that most lines past that also reference 'Ad' - but all references have a local variable of the exact same name. It looks like you simply want to remove all 'Ad.' references. Mark. > -----Original Message----- > From: python-win32-bounces@python.org > [mailto:python-win32-bounces@python.org]On Behalf Of Bill > Sent: Tuesday, 16 March 2004 4:07 AM > To: Mark Hammond; 'Bill'; python-win32@python.org > Subject: Re: [python-win32] Python Win32 and Active Directory > > > Mark, > > Thanks for getting back to me. Attached is the example I > tried to run on my > windows xp machine. What I want is authentication to a > windows server, but I > haven't gotten very far, but I'm new at this so I expect I've > made an error? > (I did fix the problem with the doc string which wasn't > closed though.) > > /bill > > > On March 15, 2004 04:05 am, Mark Hammond wrote: > > > Has anyone tried using Active Directory thru the Python Win32 API? > > > > > > I want to authenticate to AD and tried the simple example in > > > the online > > > docs for 'opends' but alway get 'AD' is an undefined symbol. > > > I may have > > > missed something obvious, but I sure can't see what it is :-( > > > > Can you post your complete sample code, and the complete > traceback you get? > > > > Mark. > From boober95 at rogers.com Mon Mar 15 19:19:13 2004 From: boober95 at rogers.com (Bill) Date: Mon Mar 15 19:19:23 2004 Subject: [python-win32] Python Win32 and Active Directory In-Reply-To: <02c701c40ae4$b9c2d030$0200a8c0@eden> References: <02c701c40ae4$b9c2d030$0200a8c0@eden> Message-ID: Very interesting ... so I removed the references to 'AD', then I had to change the last reference to add quotes so it is 'pw' since then it was undefined (of course this ain't right, but I just want to see it work). That got me to the last line, added an import of 'ldap' and it started to make more sense. Now I get a 'com' error, but I'm not connected to the net with the AD server, so I will have to try it out in the morning, but it certainly looks better than it did before the changes! I think I've been mislead though, I thought the example (it was taken from the online help for active directory), was a working bit of code, but I'm beginning to think it was cut from something larger and not tested. I'll let you know what happens in the morning with this. /bill On March 15, 2004 06:24 pm, Mark Hammond wrote: > I'm afraid I don't know the ActiveDirectory API well enough to know for > sure, but: > > The code in question is: > > def opends(loc,server=''): > '''automatically buoild ldap string and authenticate''' > ldap=win32com.client.Dispatch('ADsNameSpaces').getobject("","LDAP:") > ldap_main_loc='OU=people,DC=ad,DC=company,DC=state,DC=oh,DC=us' > ldap_auth='CN=admin_account,'+ldap_main_loc > > #if there is no "," then they are not providing a full url > #so append the standard url for it > #if there is no '=', assume they want a cn > if loc.find(',')==-1: > if loc.find('=')==-1: loc='cn='+loc+','+Ad.ldap_main_loc > else: loc=loc+','+Ad.ldap_main_loc > if loc.find('LDAP://')==-1: loc='LDAP://'+loc > > return ldap.OpenDSObject(loc,Ad.ldap_auth,Ad.pw,1) > > And the traceback: > File "", line 1, in ? > File "C:\Shared\project\opends.py", line 29, in opends > if loc.find('=')==-1: loc='cn='+loc+','+Ad.ldap_main_loc > NameError: global name 'Ad' is not defined > > Looking at the line: > > if loc.find('=')==-1: loc='cn='+loc+','+Ad.ldap_main_loc > > It is trying to reference an 'Ad' object, to fetch its ldap_main_loc > attribute. However, the code does not define an 'Ad' object - hence Python > raises the NameError. It is telling you that you have referenced an object > before you have defined it. > > I'm not sure what 'Ad' is supposed to be. However, you do have a variable > called 'ldap_main_loc', so maybe this is what you meant - ie: > > if loc.find('=')==-1: loc='cn='+loc+','+ldap_main_loc > > I note that most lines past that also reference 'Ad' - but all references > have a local variable of the exact same name. It looks like you simply > want to remove all 'Ad.' references. > > Mark. > > > -----Original Message----- > > From: python-win32-bounces@python.org > > [mailto:python-win32-bounces@python.org]On Behalf Of Bill > > Sent: Tuesday, 16 March 2004 4:07 AM > > To: Mark Hammond; 'Bill'; python-win32@python.org > > Subject: Re: [python-win32] Python Win32 and Active Directory > > > > > > Mark, > > > > Thanks for getting back to me. Attached is the example I > > tried to run on my > > windows xp machine. What I want is authentication to a > > windows server, but I > > haven't gotten very far, but I'm new at this so I expect I've > > made an error? > > (I did fix the problem with the doc string which wasn't > > closed though.) > > > > /bill > > > > On March 15, 2004 04:05 am, Mark Hammond wrote: > > > > Has anyone tried using Active Directory thru the Python Win32 API? > > > > > > > > I want to authenticate to AD and tried the simple example in > > > > the online > > > > docs for 'opends' but alway get 'AD' is an undefined symbol. > > > > I may have > > > > missed something obvious, but I sure can't see what it is :-( > > > > > > Can you post your complete sample code, and the complete > > > > traceback you get? > > > > > Mark. From desperado1901 at hotmail.com Mon Mar 15 21:43:32 2004 From: desperado1901 at hotmail.com (MD Alam) Date: Tue Mar 16 10:55:20 2004 Subject: [python-win32] [Python-Help] Need help Message-ID: Hi I'm working on python and trying to make a software witch will scan users pc and get all hardware information. I have get all these information using windows registry.But One thing I cudn't find is get windows memory from registry.I mean how much memory have in the system.Can anybody help me to get it.I don know which registry I have to open and where I can get the right path to get memory info. Thank you _________________________________________________________________ Free yourself from those irritating pop-up ads with MSn Premium. Get 2months FREE* http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines From amonroe at columbus.rr.com Tue Mar 16 11:06:12 2004 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Tue Mar 16 10:59:36 2004 Subject: [python-win32] Re: Is there a Python win32 RunAs equivalent where youcan send a password? In-Reply-To: References: <116677755090.20040315162122@columbus.rr.com> Message-ID: <82745245185.20040316110612@columbus.rr.com> >> This looks really promising, but I've got some kind of rights problem: >> >>>>> a = impersonate.Impersonate('somebody', 'xxxxxx') >>>>> a.logon() >> pywintypes.error: (1314, 'LogonUser', 'A required privilege is not held by the client.') > Look at the comments in the recipe - the full text is at > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81402/ A clarification for anyone else that ever needs to try this... >The code is problematic as is. It may, or may not work. To enable >this code on locked down NT based systems (Win2k and XP) you will >first have to enable "Act as Operating System" and grant rights to >the appropriate user groups (run secpol.msc and select Local >Policies, then User Rights Assignments). When you grant these rights, put in YOURSELF, the script runner, NOT the future user that you will eventually impersonate within the script itself! This drove me nuts until I tried it as a wild guess and finally started working. Also, you have to reboot for policy changes to take effect. Alan From tim.golden at viacom-outdoor.co.uk Tue Mar 16 11:10:05 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Tue Mar 16 11:11:04 2004 Subject: [python-win32] [Python-Help] Need help Message-ID: MD Alam> I'm working on python and trying to make a software witch will scan MD Alam>users pc and get all hardware information. I have get all these MD Alam>information using windows registry.But One thing I cudn't find is MD Alam>get windows memory from registry.I mean how much memory have in MD Alam>the system.Can anybody help me to get it.I don know which registry I MD Alam>have to open and where I can get the right path to get memory info. [Obligatory plug for... WMI!] You can do this in WMI. Something like this: import wmi c = wmi.WMI () for i in c.Win32_ComputerSystem (): print i.Caption, "has", i.TotalPhysicalMemory, "bytes" Get it from http://tgolden.sc.sabren.com/python/wmi.html 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 cedric.fournier at sescoi.fr Tue Mar 16 12:50:13 2004 From: cedric.fournier at sescoi.fr (FOURNIER Cedric) Date: Tue Mar 16 12:49:59 2004 Subject: [python-win32] manage local drives sharing informations Message-ID: <40573E55203.762BCEDRIC.FOURNIER@mailhost-lotusfr> Hello. First of all, my config: windows 2000 sp2 python 2.3 I would like to manage my sharing informations for all my local drives (eg: name of the share, comments, ...). I've found the following code which can be a start : import wmi system = wmi.WMI () my_computer = system.Win32_ComputerSystem ()[0] print "Disks on", my_computer.Name for disk in system.Win32_LogicalDisk (): print disk.Caption, disk.Description, disk.ProviderName or "" but I don't know where to find a list and description of properties such as Name, Caption, Description, ProviderName, ....... If somebody have some explanations for me, I would be cool. Thanks for your help From lehmanap at cs.purdue.edu Tue Mar 16 13:46:25 2004 From: lehmanap at cs.purdue.edu (Aaron Patrick Lehmann) Date: Tue Mar 16 13:46:32 2004 Subject: [python-win32] How to create a vbArray of Strings in python for win32 Message-ID: <20040316184625.GC14127@lore.cs.purdue.edu> Hello-- I'm trying to create and edit Exchange contacts using Python for win32. In Exchange, the contacts each have a list of contacts, so that I know who my contacts know. This list is represented as an array of Strings. When I view one that I have already made, Python converts this to a tuple of unicode strings. I have tried, but I can't seem to make it convert back. Follows is the relevant snippet of code to link to contacts. Could someone point out what I'm doing wrong, or possibly provide an example of how to make and use an array in python for win32? CdoPR_CONTACTS = 0x817C001EL#will yeild a tuple of the names of a contacts contacts vbArray = 8192L vbString = 8L STRING_AR = vbArray + vbString def _linkContacts( con1, con2 ): """ Arguments: con1 -- A Contact Message from an Exchange server con2 -- Another Contact message from the Exchange server """ con1Fields = con1.Fields try: #Try to add the second contacts name to the first contacts list, as though we #know it is there con1cons = con1Fields.Item( CdoPR_CONTACTS ) if con2.Subject not in con1cons.Value: con1cons.Value = con1cons.Value + ( con2.Subject, ) except: #If it wasn't there, then create it, with the appropriate starting value con1Fields.Add( CdoPR_CONTACTS, STRING_AR, ( con2.Subject, ) ) #update the contact in Excahnge con1.Update( ) Aaron Lehmann -- Old hold for new construction. --Gene Ray www.timecube.com From tim.golden at viacom-outdoor.co.uk Wed Mar 17 03:28:52 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Wed Mar 17 03:29:41 2004 Subject: [python-win32] manage local drives sharing informations Message-ID: >I would like to manage my sharing informations for all my local drives >(eg: name of the share, comments, ...). > > >I've found the following code which can be a start : > import wmi > system = wmi.WMI () > my_computer = system.Win32_ComputerSystem ()[0] > print "Disks on", my_computer.Name > for disk in system.Win32_LogicalDisk (): > print disk.Caption, disk.Description, disk.ProviderName or "" > >but I don't know where to find a list and description of >properties such >as Name, Caption, Description, ProviderName, ....... In essence, you have to go to the appropriate MSDN page and start from there. (Google for Microsoft WMI classes). There are other helpful WMI examples around the net, most of which translate quite easily into Python. Just Google for WMI examples and you'll get loads of useful hits. If you take any WMI object (such as my_computer or disk in your example above) and print it, you usually get a readable output of available fields and values. (This is because the Python module calls the object's GetObjectText_ method). For example: ActivePython 2.2.3 Build 227 (ActiveState Corp.) based on Python 2.2.3 (#42, Nov 13 2003, 09:57:55) [MSC 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import wmi >>> c = wmi.WMI () >>> for i in c.Win32_Share (): print i ... instance of Win32_Share { AllowMaximum = TRUE; Caption = "Remote IPC"; Description = "Remote IPC"; Name = "IPC$"; Path = ""; Status = "OK"; Type = 2147483651; }; instance of Win32_Share { AllowMaximum = TRUE; Caption = "Remote Admin"; Description = "Remote Admin"; Name = "ADMIN$"; Path = "C:\\WINNT"; Status = "OK"; Type = 2147483648; }; instance of Win32_Share { AllowMaximum = TRUE; Caption = "Default share"; Description = "Default share"; Name = "C$"; Path = "C:\\"; Status = "OK"; Type = 2147483648; }; 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 jacques.bosch at gmx.net Thu Mar 18 02:34:45 2004 From: jacques.bosch at gmx.net (Jacques Bosch) Date: Thu Mar 18 03:07:02 2004 Subject: [python-win32] Python and screen magnifier. Message-ID: <067e01c40cbb$7c786860$0100000a@quigrim> Hi there. I'm new to this list. Hope somebody might be able to help me. I use a screen magnifier called Zoomtext (ZT), as I can't see very well. :) I have recently started using python, but find that the cursor / caret is not tracked by ZT in any of the python editors or python shells that I have tried. It is very frustrating. I have tried ZT's "Caret Detect" too, and it asks me if I want to keep the new caret definition. I say yes, but it still does not work. I have tried several python editors, including Active Python and WX Python. Seems like the problem is with the cursor / caret in any app written in python. Almost as if a python text cursor is not like a standard windows cursor. How can I overcome / work around this problem? Is there anybody on this list that uses Zoomtext with Python? Thanx for any help. Jacques * Jacques Bosch Software Developer jacques.bosch@gmx.net tel: mobile: +27 (0)12-3465444 +27 (0)82-4711807 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040318/388d65b1/attachment.html From niki at vintech.bg Thu Mar 18 03:46:12 2004 From: niki at vintech.bg (Niki Spahiev) Date: Thu Mar 18 03:48:12 2004 Subject: [python-win32] Python and screen magnifier. In-Reply-To: <067e01c40cbb$7c786860$0100000a@quigrim> References: <067e01c40cbb$7c786860$0100000a@quigrim> Message-ID: <405961D4.5090401@vintech.bg> Jacques Bosch wrote: > Hi there. I'm new to this list. Hope somebody might be able to help me. > > I use a screen magnifier called Zoomtext (ZT), as I can't see very well. :) > I have recently started using python, but find that the cursor / caret > is not tracked by ZT in any of the python editors or python shells that > I have tried. > It is very frustrating. > I have tried ZT's "Caret Detect" too, and it asks me if I want to keep > the new caret definition. I say yes, but it still does not work. > > I have tried several python editors, including Active Python and WX > Python. Seems like the problem is with the cursor / caret in any app > written in python. > Almost as if a python text cursor is not like a standard windows cursor. > > How can I overcome / work around this problem? > Is there anybody on this list that uses Zoomtext with Python? Don't know about Zoomtext, but all these python editors are based on scintilla (www.scintilla.org) source code editing component. Maybe author can help. HTH Niki Spahiev From amonroe at columbus.rr.com Thu Mar 18 09:30:27 2004 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Thu Mar 18 09:24:35 2004 Subject: [python-win32] Re: Is there a Python win32 RunAs equivalent where youcan send a password? In-Reply-To: References: <116677755090.20040315162122@columbus.rr.com> Message-ID: <177912360845.20040318093027@columbus.rr.com> > Look at the comments in the recipe - the full text is at > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81402/ > Basically, you need special rights to do this "Act as part of the > Operating System" is the key bit. The "RunAs" command gets round this > by using a service as an intermediary. The "RunAs" service handles the > job of running as a different user - it runs as the SYSTEM user, which > has most rights on by default. Does this whole impersonation business work with os.system()? What about the threading module? I'm not having any luck with it. Per the cookbook site I got this to run: try: a.logon() print win32api.GetUserName() os.system("notepad") a.logoff() except: print sys.exc_type, sys.exc_value the print win32api.GetUserName() prints the impersonated user's name like I expect, but the notepad process is running as _me_, not the impersonated user (@&$#^@$!!!). Am I doing something wrong? I briefly toyed with win32process.CreateProcessAsUser, but that put me back at square one with the error about not having a required privilege. Alan From Christian.Wyglendowski at greenville.edu Thu Mar 18 11:35:38 2004 From: Christian.Wyglendowski at greenville.edu (Christian Wyglendowski) Date: Thu Mar 18 11:35:52 2004 Subject: [python-win32] Re: Is there a Python win32 RunAs equivalent whereyoucan send a password? Message-ID: > -----Original Message----- > > Does this whole impersonation business work with os.system()? > What about the threading module? I'm not having any luck with it. > > Per the cookbook site I got this to run: > > > try: > a.logon() > print win32api.GetUserName() > os.system("notepad") > a.logoff() > except: > print sys.exc_type, sys.exc_value > > > the print win32api.GetUserName() prints the impersonated > user's name like I expect, but the notepad process is running > as _me_, not the impersonated user (@&$#^@$!!!). Am I doing > something wrong? > > I briefly toyed with win32process.CreateProcessAsUser, but > that put me back at square one with the error about not > having a required privilege. > You might want to have a look at this thread on Google Groups: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=3e27 3aac_6%40corp-goliath.newsgroups.com&rnum=2&prev=/groups%3Fhl%3Den%26lr% 3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3Dpython%2Bimpersonate%26sa%3DN%26tab%3 Dwg It sounds like this whole process (no pun intended) is a real pain. Christian http://www.dowski.com From amonroe at columbus.rr.com Thu Mar 18 14:18:12 2004 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Thu Mar 18 14:12:17 2004 Subject: [python-win32] Re: Is there a Python win32 RunAs equivalent where youcan send a password? In-Reply-To: <177912360845.20040318093027@columbus.rr.com> References: <116677755090.20040315162122@columbus.rr.com> <177912360845.20040318093027@columbus.rr.com> Message-ID: <13929625140.20040318141812@columbus.rr.com> > the print win32api.GetUserName() prints the impersonated user's name > like I expect, but the notepad process is running as _me_, not the > impersonated user (@&$#^@$!!!). Am I doing something wrong? > I briefly toyed with win32process.CreateProcessAsUser, but that put me > back at square one with the error about not having a required > privilege. I'm getting closer - putting myself in the "Replace a process level token" policy allows me to launch processes with CreateProcessAsUser, and they genuinely run as the intended impersonated user... BUT, the spawned process invariably bombs out immediately with "the application failed to initialize properly (0xc0000142) click on ok to terminate the application". Any ideas? Alan From amonroe at columbus.rr.com Thu Mar 18 16:21:19 2004 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Thu Mar 18 16:15:24 2004 Subject: [python-win32] Is there a Python win32 RunAs equivalent where youcan send a password? In-Reply-To: References: Message-ID: <128937012562.20040318162119@columbus.rr.com> > used a COM object called sfImpersonator to some success. You probably > *could* spawn a cmd file and use popen to send the password, but it > would have to be a hack. What's the trick to using the popen approach? (I've temporarily given up on the windows api method) Everything I've tried gives me IOError: [Errno 22] Invalid argument when I tried to write() to the child's stdin, or the main program just exits killing any children. I've tried this with and without the "cmd" at the front, wrapping it in a cmd file, etc. pin, pout = os.popen2( 'cmd /C runas /user:tco\pyadmin "dumpsec /computer=\\\\ess /rpt=allsharedirs /showexcdirs \ /outfile=ess-shares.tsv /saveas=tsv" ') print pin, pout pin.write('xxxxxx\n') pin.flush() Alan From boober95 at rogers.com Thu Mar 18 18:19:19 2004 From: boober95 at rogers.com (Bill) Date: Thu Mar 18 18:19:26 2004 Subject: [python-win32] Is there a Python win32 RunAs equivalent where youcan send a password? In-Reply-To: <128937012562.20040318162119@columbus.rr.com> References: <128937012562.20040318162119@columbus.rr.com> Message-ID: Alan, I haven't been following this, but I see one problem you will have is you need to do a 'pin.close()'. In general you don't know when a processes will send it's output due to buffering, and you might not have any control. (So the 'flush' will send the input, but when will the output be sent?) You might try changing your 'flush' to a 'close' and see what happens. If I've missed your point, just ignore me, just my 2 cents. /bill On March 18, 2004 04:21 pm, R. Alan Monroe wrote: > > used a COM object called sfImpersonator to some success. You probably > > *could* spawn a cmd file and use popen to send the password, but it > > would have to be a hack. > > What's the trick to using the popen approach? (I've temporarily given > up on the windows api method) Everything I've tried gives me IOError: > [Errno 22] Invalid argument when I tried to write() to the child's > stdin, or the main program just exits killing any children. > > I've tried this with and without the "cmd" at the front, wrapping it > in a cmd file, etc. > > > pin, pout = os.popen2( 'cmd /C runas /user:tco\pyadmin "dumpsec > /computer=\\\\ess /rpt=allsharedirs /showexcdirs \ /outfile=ess-shares.tsv > /saveas=tsv" ') > print pin, pout > pin.write('xxxxxx\n') > pin.flush() > > > Alan > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From amonroe at columbus.rr.com Thu Mar 18 18:32:08 2004 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Thu Mar 18 18:26:12 2004 Subject: [python-win32] Is there a Python win32 RunAs equivalent where youcan send a password? In-Reply-To: References: <128937012562.20040318162119@columbus.rr.com> Message-ID: <2944861158.20040318183208@columbus.rr.com> > I haven't been following this, but I see one problem you will have is you > need to do a 'pin.close()'. In general you don't know when a processes will > send it's output due to buffering, and you might not have any control. (So > the 'flush' will send the input, but when will the output be sent?) You > might try changing your 'flush' to a 'close' and see what happens. Will try that tomorrow, but I'm not optimistic. It seems like the runas command is locked down to prevent piped input. It actually gives an error about being unable to change the echo mode. You get the same error if you try to redirect its input with a less than character at the commandline. Alan From Gerald.MAUNIER at gemplus.com Fri Mar 19 05:30:58 2004 From: Gerald.MAUNIER at gemplus.com (MAUNIER Gerald) Date: Fri Mar 19 09:45:49 2004 Subject: [python-win32] win32com.client and microsoft agent question Message-ID: Hi, Just add this after the Dispatch : ag.connected=1 The full example is then : import win32com.client ag=win32com.client.Dispatch("Agent.Control") ag.connected=1 ag.Characters.Load("Merlin") ag.Characters("Merlin").Show() raw_input("press enter...") More documentation on microsoft's web site : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msagent/pacontrol_4b56.asp Regards Gerald -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-win32/attachments/20040319/8b054205/attachment.html From atul.kshirsagar at firstlogic.com Fri Mar 19 12:35:17 2004 From: atul.kshirsagar at firstlogic.com (Atul Kshirsagar) Date: Fri Mar 19 12:44:08 2004 Subject: [python-win32] Python 2.3 problem with extention-embedding in multi-threaded and multi sub-interpreter environment Message-ID: <095A307E4B8A1541B29248EABD4D4D4005E1CDF8@exchange-lax1.firstlogic.com> I am embedding python in my C++ application. I am using Python *2.3.2* with a C++ extention DLL in multi-threaded environment. I am using SWIG-1.3.19 to generate C++ to Python interface. Now to explain it in details, 1. Python initialization [Py_Initialize()] and finalization [Py_Finalize()] is done in the *main* thread. 2. For each new thread I create a separate sub-interpreter [Py_NewInterpreter()]. 3. Using PyRun_String("import myModule"...) before execution of python script, extention module is imported. 4. Each thread executes *multiple* python script using PyEval_EvalCode() using the class objects in my extention DLL. 5. Each sub-interpreter is destroyed [Py_EndInterpreter()] at the end of that particular thread. I am observing that; As explained above when multiple threads are running. And as one of these threads finishes, in other running threads I start getting "TypeError: 'NoneType' object is not callable" error on the methods called on class objects in extention module. The same code *works fine* with Python 2.2.2. I have found these links more or less talking about the same problem migrating from 2.2 to 2.3. http://mail.python.org/pipermail/python-dev/2003-September/038237.html http://mail.python.org/pipermail/python-list/2004-February/206851.html http://mail.python.org/pipermail/python-list/2004-January/204040.html I *guess* what is happening is global variables are zapped to "NoneType" when one thread finishes and other thread trying to access them through the Python script (step 4.) this error is generated. But it *works* sometimes when(*guess*) the running thread is at step 3. and by importing the module the global variables are re-initialized for "Type" information. I tried using reload(myModule) to solve the problem but that is generating big memory leak every time it is called. Is this a know issue with 2.3 (interpreter?) ? Or is there a change for 2.3 in the way embedding should be done in a multi-threaded and multi-sub-interpreter environment ? Anybody for help ? Thanks, Atul From schnijders at home.nl Wed Mar 24 08:13:23 2004 From: schnijders at home.nl (Schneider) Date: Wed Mar 24 08:05:06 2004 Subject: [python-win32] (Newbie) type mismatch Message-ID: Hi, I am trying to code a call to a COM application (Sofon) which is a VC++ windows program as far as I know. Most calls just work fine, however on some calls I get a type mismatch error. The typelibrary states the following: VARIANT_BOOL SetVersionDataElement( BSTR FieldName, VARIANT* Value); In VB the call looks like this (works fine): cProject.SetVersionDataElement sParName, sParVal In Python I used: sofon.project.SetVersionDataElement("OutputDocument", "PF") Makepy produces this: def SetVersionDataElement(self, FieldName=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): return self._oleobj_.InvokeTypes(6, LCID, 1, (11, 0), ((8, 0), (16396, 0)),FieldName, Value) The traceback looks like: Traceback (most recent call last): File "L:\InvoiceSofon\invoiceSofonMainFrame.py", line 459, in OnFilemenuitems2Menu printRec(odbc, sofon, self.invoiceOverviewListCtrl, Index) File "L:\InvoiceSofon\invoiceSofonFunctopns.py", line 142, in printRec sofon.project.SetVersionDataElement("OutputDocument", "PF") File ">", line 2, in SetVersionDataElement pywintypes.com_error: (-2147352571, 'Type komt niet overeen.', None, 2) I am very desperate to get this to work since I would realy hate to learn VB. What goes wrong? Where to find more info on the COM stuff? TIA Frans From johnp at HomeLumber.com Wed Mar 24 09:16:07 2004 From: johnp at HomeLumber.com (John Purser) Date: Wed Mar 24 09:16:18 2004 Subject: [python-win32] (Newbie) type mismatch Message-ID: I'm just starting to dig into Python and Com and like you I'm looking for better reference material than I've found. Is there a book that covers Com better than "Python Programming on Win32 Help for Windows Programmers By Mark Hammond & Andy Robinson" which is 4 years old now? I can offer this link which is to chapter 12 of their book on the O'Reilly site: http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html And you might consider that the com call expects Unicode strings, not ASCII if I've read this all correctly. Good luck and if you find a good reference please post it back to the group. Thanks, John Purser -----Original Message----- From: Schneider [mailto:schnijders@home.nl] Sent: Wednesday, March 24, 2004 6:13 AM To: python-win32@python.org Subject: [python-win32] (Newbie) type mismatch Hi, I am trying to code a call to a COM application (Sofon) which is a VC++ windows program as far as I know. Most calls just work fine, however on some calls I get a type mismatch error. The typelibrary states the following: VARIANT_BOOL SetVersionDataElement( BSTR FieldName, VARIANT* Value); In VB the call looks like this (works fine): cProject.SetVersionDataElement sParName, sParVal In Python I used: sofon.project.SetVersionDataElement("OutputDocument", "PF") Makepy produces this: def SetVersionDataElement(self, FieldName=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): return self._oleobj_.InvokeTypes(6, LCID, 1, (11, 0), ((8, 0), (16396, 0)),FieldName, Value) The traceback looks like: Traceback (most recent call last): File "L:\InvoiceSofon\invoiceSofonMainFrame.py", line 459, in OnFilemenuitems2Menu printRec(odbc, sofon, self.invoiceOverviewListCtrl, Index) File "L:\InvoiceSofon\invoiceSofonFunctopns.py", line 142, in printRec sofon.project.SetVersionDataElement("OutputDocument", "PF") File ">", line 2, in SetVersionDataElement pywintypes.com_error: (-2147352571, 'Type komt niet overeen.', None, 2) I am very desperate to get this to work since I would realy hate to learn VB. What goes wrong? Where to find more info on the COM stuff? TIA Frans _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From koliphant at qwest.net Wed Mar 24 16:14:37 2004 From: koliphant at qwest.net (Kerry Oliphant) Date: Wed Mar 24 16:14:02 2004 Subject: [python-win32] py2exe problem with ActiveX control Message-ID: I have a number of ActiveX controls that I am using in my program. I have been trying to use py2exe to package everything together and I keep getting the error that "'DispatchBaseClass' is not defined" in the makepy generated file for one of the activeX controls. Does anyone have a clue here? This is my error report: running py2exe creating C:\Python23\CETI\build creating C:\Python23\CETI\build\bdist.win32 creating C:\Python23\CETI\build\bdist.win32\winexe creating C:\Python23\CETI\build\bdist.win32\winexe\collect creating C:\Python23\CETI\build\bdist.win32\winexe\temp *** generate typelib stubs *** creating C:\Python23\CETI\build\bdist.win32\winexe\temp\win32com creating C:\Python23\CETI\build\bdist.win32\winexe\temp\win32com\gen_py Traceback (most recent call last): File "setup.py", line 55, in ? windows = [easyControl] File "c:\python23\lib\distutils\core.py", line 149, in setup dist.run_commands() File "c:\python23\lib\distutils\dist.py", line 907, in run_commands self.run_command(cmd) File "c:\python23\lib\distutils\dist.py", line 927, in run_command cmd_obj.run() File "C:\Python23\Lib\site-packages\py2exe\build_exe.py", line 180, in run self.typelibs) File "C:\Python23\Lib\site-packages\py2exe\build_exe.py", line 1061, in collect_win32com_genpy sub_mod = gencache.GetModuleForCLSID(clsid) File "C:\Python23\Lib\site-packages\win32com\client\gencache.py", line 232, in GetModuleForCLSID __import__(sub_mod_name) File "C:\Python23\CETI\build\bdist.win32\winexe\temp\win32com\gen_py\1D3EA638-885 2-443F-8091-8BC575DEAA72x0x3x0\ExplorerBar.py", line 33, in ? __import__('win32com.gen_py.1D3EA638-8852-443F-8091-8BC575DEAA72x0x3x0._Expl orerBar') File "C:\Python23\CETI\build\bdist.win32\winexe\temp\win32com\gen_py\1D3EA638-885 2-443F-8091-8BC575DEAA72x0x3x0\_ExplorerBar.py", line 27, in ? class _ExplorerBar(DispatchBaseClass): NameError: name 'DispatchBaseClass' is not defined My setup.py file: from distutils.core import setup import py2exe import sys # If run without args, build executables, in quiet mode. if len(sys.argv) == 1: sys.argv.append("py2exe") sys.argv.append("-q") class Target: def __init__(self, **kw): self.__dict__.update(kw) # for the versioninfo resources self.version = "7.7.6" self.company_name = "Concepts ETI, Inc." self.copyright = "Coppyright 2004" self.name = "EASy! Control" easyControl = Target( # used for the versioninfo resource description = "EASy! Control Distribution.", # what to build script = "EasyControl/EasyControlApp.py", ## other_resources = [(RT_MANIFEST, 1, manifest_template % dict(prog="test_wx"))], icon_resources = [(1, "EasyControl/EasyControlResource/impeller.ico")], dest_base = "distEasyControl") setup( options = {"py2exe": {"typelibs": # typelibs for early bound COM [('{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}', 0, 2, 0), #common controls ('{423968A1-C17C-11D0-9082-0060976CDFDC}', 0, 1, 0), #Radial ('{1D3EA638-8852-443F-8091-8BC575DEAA72}', 0, 3, 0), #explorer bar ('{C0A63B80-4B21-11D3-BD95-D426EF2C7949}', 0, 1, 0), #flexgrid ('{33F4BD9A-1A86-4B1A-92DB-6312C5028315}', 0, 1, 0), #pro E Graph ('{A189857B-3B4A-45DC-B1A1-E5C436F5CB0C}', 0, 2, 0) #Splash Panel ], # create a compressed zip archive "compressed": 1, "optimize": 2}}, # The lib directory contains everything except the executables and the python dll. # Can include a subdirectory name. zipfile = "library.zip", windows = [easyControl] ) From pyama at snafu.de Thu Mar 25 03:40:48 2004 From: pyama at snafu.de (pyama@snafu.de) Date: Thu Mar 25 03:40:52 2004 Subject: [python-win32] py2exe problem with ActiveX control Message-ID: > File > "C:\Python23\CETI\build\bdist.win32\winexe\temp\win32com\gen_py\1D3EA638-885 > 2-443F-8091-8BC575DEAA72x0x3x0\ExplorerBar.py", line 33, in ? > > __import__('win32com.gen_py.1D3EA638-8852-443F-8091-8BC575DEAA72x0x3x0._Expl > orerBar') > File > "C:\Python23\CETI\build\bdist.win32\winexe\temp\win32com\gen_py\1D3EA638-885 > 2-443F-8091-8BC575DEAA72x0x3x0\_ExplorerBar.py", line 27, in ? > class _ExplorerBar(DispatchBaseClass): > NameError: name 'DispatchBaseClass' is not defined > You have two choices: 1. Edit _Explorer.Bar.py by hand and add from win32com.client import DispatchBaseClass 2. Change ...\site-packages\py2exe\build_ex.py in line 1056 from makepy.GenerateFromTypeLibSpec(info, bForDemand = True) to makepy.GenerateFromTypeLibSpec(info, bForDemand = False) This will generate only one big Python-typelib. HTH Andi From amonroe at columbus.rr.com Thu Mar 25 19:01:18 2004 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Thu Mar 25 18:55:10 2004 Subject: [python-win32] NT lockouts when spawning psexec from a multithreaded program? Message-ID: <94260856351.20040325190118@columbus.rr.com> [apologies if this is a re-run for some folks - I posted it to tutor@python.org with no responses] Does anyone have any clue why my accounts get intermittently locked out when spawning psexec from a multithreaded Python program? I have a domain admin account in each of about a dozen domains. They all have the same username. I'm using the threading module, and each new thread spawns a .cmd file (using os.system() ) which runs psexec (the free utility from Sysinternals) as a domain\user. It's the first time I've tried threading - am I doing something obviously wrong? I'm running the main python script on my 2k workstation - would 2k server act any differently? The target server list is a mix of NT and 2k boxes, about 400 of them. I'm limiting the number of threads, while threading.activeCount() < MAXCONCURRENT: I started with a MAXCONCURRENT of 30, bumping it down to 9 didn't help. I would really hate to run them all sequentially. Has anyone tried this before? Alan From harisri at telstra.com Fri Mar 26 00:42:11 2004 From: harisri at telstra.com (Srihari Vijayaraghavan) Date: Fri Mar 26 00:44:04 2004 Subject: [python-win32] win32evtlog Message-ID: <3b28f38a45.38a453b28f@email.bigpond.com> Hello, I am trying to get just the "Information" (or "Warning") type events from eventlog, and it seems to fail: 1. from win32evtlog import * 2. handle = OpenEventLog("", "system") 3. flags = EVENTLOG_BACKWARDS_READ |\ EVENTLOG_SEQUENTIAL_READ |\ EVENTLOG_INFORMATION_TYPE 4. l = ReadEventLog(handle, flags, 0) Traceback (most recent call last): File "", line 1, in ? pywintypes.error: (87, 'ReadEventLog', 'The parameter is incorrect.') These combinations it works great however: EVENTLOG_ERROR_TYPE (for system and application log) EVENTLOG_AUDIT_SUCCESS and EVENTLOG_AUDIT_FAILURE (for security log) So I am not sure what is wrong with my flags parameter. Can someone please assist me? And Oh I am on Windows 2000 Professional sp3, Python 2.3.3 and pywin32-200. Thanks Hari From therve at neocles.com Fri Mar 26 03:51:34 2004 From: therve at neocles.com (Thomas HERVE) Date: Fri Mar 26 03:51:54 2004 Subject: [python-win32] win32evtlog Message-ID: >Hello, Hi, >I am trying to get just the "Information" (or "Warning") type events from >eventlog, and it seems to fail: >1. from win32evtlog import * >2. handle = OpenEventLog("", "system") >3. flags = EVENTLOG_BACKWARDS_READ |\ > EVENTLOG_SEQUENTIAL_READ |\ > EVENTLOG_INFORMATION_TYPE I don't think you can use these flags. The only ones usable are : 'EVENTLOG_BACKWARDS_READ', 'EVENTLOG_FORWARDS_READ', 'EVENTLOG_SEEK_READ', 'EVENTLOG_SEQUENTIAL_READ'. If you look at the value you can see that these ones are compatible. For example, EVENTLOG_SEQUENTIAL_READ == EVENTLOG_ERROR_TYPE, so if you "pipe" you don't get any additionnal information. >These combinations it works great however: >EVENTLOG_ERROR_TYPE (for system and application log) >EVENTLOG_AUDIT_SUCCESS and EVENTLOG_AUDIT_FAILURE (for security log) Seems strange to me. >So I am not sure what is wrong with my flags parameter. Can someone please >assist me? I can give you my way to do this : import win32evtlog handle = win32evtlog.OpenEventLog("", "System") flags = win32evtlog.EVENTLOG_FORWARDS_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ event_list = win32evtlog.ReadEventLog(handle, flags, 0) while self.event_list != [] : for event in self.event_list : # filter with the type of event you want if event.EventType == win32evtlog. EVENTLOG_INFORMATION_TYPE : print event.SourceName event_list = win32evtlog.ReadEventLog(handle, flags, 0) Hope this help. > Thanks > Hari -- Thomas From tim.golden at viacom-outdoor.co.uk Fri Mar 26 09:04:32 2004 From: tim.golden at viacom-outdoor.co.uk (Tim Golden) Date: Fri Mar 26 09:06:08 2004 Subject: [python-win32] NT lockouts when spawning psexec from a multit hreaded program? Message-ID: >Does anyone have any clue why my accounts get intermittently locked >out when spawning psexec from a multithreaded Python program? [... snip details of spawning threads to run psexec ...] I suspect no-one's answered this one yet (unless they've got back to you directly) because it's a very difficult question to diagnose at a distance, and doesn't seem likely to be tied to Python, threaded or not. Without wishing to insult your intelligence, have you tried running the parallel psexec without using python, eg by launching a small armada batch scripts or by using whatever other language is available to you? Using Python to drive an external utility should give no more nor fewer problems than using any other tool to drive the same utility. If the symptoms only occur within Python, could you post some code so we can see what's going on? Maybe something will show up. 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 spastor at center.com Fri Mar 26 17:44:40 2004 From: spastor at center.com (sebastien Pastor) Date: Fri Mar 26 16:05:48 2004 Subject: [python-win32] Win32pdhutil - GetFormattedCounterValue while running python thu IIS Message-ID: <4064B258.3080607@center.com> Hi guys, I ve got a piece of script which basically retrieve the "Current Connections", given by the Web Service object. I am using Win32pdhutil and it works smoothly when i run the script locally. If i try to run thru IIS as a cgi i ve got this message : File "E:\PROGRA~1\Python22\Lib\site-packages\win32\lib\win32pdhutil.py", line 59, in GetPerformanceAttributes type, val = win32pdh.GetFormattedCounterValue(hc, format) pywintypes.error: (-2147481645, 'GetFormattedCounterValue', 'No error message is available') I guess it might be permissions error but cannot find out which one ... Any help will be highly appreciated . Seb From harisri at telstra.com Fri Mar 26 20:07:35 2004 From: harisri at telstra.com (Srihari Vijayaraghavan) Date: Fri Mar 26 20:07:45 2004 Subject: [python-win32] win32evtlog Message-ID: <523ba575f8.575f8523ba@email.bigpond.com> Hello Thomas, Thanks for your response. I did not realise (rather surprised that) EVENTLOG_(INFORMATION|WARNING|ERROR)_TYPE and EVENTLOG_AUDIT_(SUCCESS|FAILURE) cannot be used in win32evtlog.ReadEventLog()'s flags parameter. Thanks for your sample code too. I shall try with your tips. Hari. ----- Original Message ----- From: Thomas HERVE Date: Friday, March 26, 2004 7:51 pm Subject: Re: [python-win32] win32evtlog > >Hello, > > Hi, > > >I am trying to get just the "Information" (or "Warning") type > events from > > >eventlog, and it seems to fail: > >1. from win32evtlog import * > >2. handle = OpenEventLog("", "system") > >3. flags = EVENTLOG_BACKWARDS_READ |\ > > EVENTLOG_SEQUENTIAL_READ |\ > > EVENTLOG_INFORMATION_TYPE > > I don't think you can use these flags. The only ones usable are : > 'EVENTLOG_BACKWARDS_READ', 'EVENTLOG_FORWARDS_READ', > 'EVENTLOG_SEEK_READ', > 'EVENTLOG_SEQUENTIAL_READ'. If you look at the value you can see > that > these ones are compatible. > For example, EVENTLOG_SEQUENTIAL_READ == EVENTLOG_ERROR_TYPE, so if > you > "pipe" you don't get any additionnal information. > > >These combinations it works great however: > >EVENTLOG_ERROR_TYPE (for system and application log) > >EVENTLOG_AUDIT_SUCCESS and EVENTLOG_AUDIT_FAILURE (for security log) > > Seems strange to me. > > >So I am not sure what is wrong with my flags parameter. Can > someone > please > >assist me? > > I can give you my way to do this : > > > import win32evtlog > > handle = win32evtlog.OpenEventLog("", "System") > flags = > win32evtlog.EVENTLOG_FORWARDS_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ > event_list = win32evtlog.ReadEventLog(handle, flags, 0) > > while self.event_list != [] : > for event in self.event_list : > # filter with the type of event you want > if event.EventType == win32evtlog. > EVENTLOG_INFORMATION_TYPE : > print event.SourceName > event_list = win32evtlog.ReadEventLog(handle, flags, 0) > > > Hope this help. > > > Thanks > > Hari > > -- > Thomas > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From amonroe at columbus.rr.com Fri Mar 26 20:24:31 2004 From: amonroe at columbus.rr.com (R. Alan Monroe) Date: Fri Mar 26 20:18:01 2004 Subject: [python-win32] NT lockouts when spawning psexec from a multit hreaded program? In-Reply-To: References: Message-ID: <20352249137.20040326202431@columbus.rr.com> > Without wishing to insult your intelligence, have you tried running > the parallel psexec without using python, eg by launching a small > armada batch scripts or by using whatever other language is available > to you? Using Python to drive an external utility should give no more > nor fewer problems than using any other tool to drive the same utility. Time didn't permit such a test until today. Since the first bunch of accounts were always locking out, I had new accounts created, dedicated solely to this project, and didn't have any lockout problems. My suspicion is that while I was psexec'ing under the original credentials from my domain workstation, a non-domain standalone server was also using those same credentials simultaneously for it's own (normal) purposes, and for some reason, the DC didn't like that. So I tried the multiple cmd windows first, which worked, then I fired up the Python script with 20 threads and it appeared to work. Alan From qinlj at solidshare.com Sat Mar 27 21:31:40 2004 From: qinlj at solidshare.com (Lijun Qin) Date: Sun Mar 28 11:36:10 2004 Subject: [python-win32] Yet another python-com bridge (wincom.pyd) Message-ID: <008f01c4146c$db3873f0$0200a8c0@huhu> Hi all, Here is my own python-com bridge (named wincom), which support Python at as both server and client side, support C++ access python use vtable interface when the interface is a dual interface (similar to universal_gateway featuer of win32all). One of the feature of wincom is that there is only a simple pyd file (wincom.pyd, and runtime boost_python23.dll) to deply, unlike win32-all package you'll need deploy a whole package. Another feature of wincom is that it's use is quite simple, a typelib is in the center, and all objects in the typelib can be easily imported, like this: import wincom msxml = wincom.typelib('{F5078F18-C551-11D3-89B9-0000F81FE221}', 4, 0) after these lines, all objects in the msxml4.0 typelib can be easily accessed, like this: self.dom = msxml.DOMDocument40() #create a CoClass use it's name if not self.dom.load(file_name): raise RuntimeError, "load xml file failed" self.node = self.dom.documentElement #COM object property mapped to python attribute self.id = self.node.getAttribute('id') #COM object function mapped to python method self.my_objs = [] for my_obj_node in self.node.selectNodes("//my_obj"): #COM enumratable mapped to python iter object self.my_objs.append(my_obj_class(self, my_obj_node)) You can download the file from http://www.solidshare.com/python/wincom.pyd, source file is not included, but if peoples like it, I'll consider setup a project in sourceforge or somewhere else. Lijun Qin From andrew at shellscape.org Mon Mar 29 01:01:34 2004 From: andrew at shellscape.org (Andrew Powell) Date: Mon Mar 29 02:40:13 2004 Subject: [python-win32] MSScriptControl Objects Message-ID: Hello all. Newcommer to the newsgroups so please let me know if Im not adhering to any policy. Ive setup an app (.NET app) which is using the MSScriptControl. I have the ActivePython package installed and the ActiveScript engine for Python registered. Thats all peachykeen. Im running into a problem whereby Objects that Ive extended to the script arent being 'seen' correctly by the engine. Other languages such as VBScript, JScript and RubyScript are dealing with and using the objects just fine. The following is an error that the pyscript engine returned upon using an object ive named 'Graphics'. The following error occurs when I try to use the methods, properties or subclasses of any object extended to the script via MSScriptControl.AddObject. Error Number : -2147352567 Description : Traceback (most recent call last): File "