From mhammond@skippinet.com.au Fri Nov 1 00:22:37 2002 From: mhammond@skippinet.com.au (Mark Hammond) Date: Fri, 1 Nov 2002 11:22:37 +1100 Subject: [python-win32] Creating an installer for a COM server. In-Reply-To: <20021028120729.26881.qmail@mail.yifansoft.com> Message-ID: > * python sets up its sys.path attribute from a number of sources. One is > a hardcoded registry key. This we can modify to point to an appropriate > subkey under our application's root key. As far as we can tell the > following registry keys need to be set appropriately: *need* is a little strong . Also, note that the "2.2" is actually a string resource in python22.dll. You can open a pre-built python22.dll as a resource in MSVC, edit the string, and magically the registry key will have changed. This means you wont comflict with an installed vanilla Python. > SOFTWARE\\Python\PythonCore\2.2\InstallPath > SOFTWARE\\Python\PythonCore\2.2\InstallPath\InstallGroup Not needed - used by addon installers to know where to find the Python install. Presumably you dont care about this. > SOFTWARE\\Python\PythonCore\2.2\Modules\pythoncom > SOFTWARE\\Python\PythonCore\2.2\Modules\pywintypes > SOFTWARE\\Python\PythonCore\2.2\PythonPath > SOFTWARE\\Python\PythonCore\2.2\PythonPath\win32com > SOFTWARE\\Python\PythonCore\2.2\PythonPath\win32 Yep, but you can collapse the path down however you like. > * If the shiped python is modified to look in the above registry keys > the COM servers work fine as long as pywintypes22.dll and > pythoncom22.dll exist in the winnt/system32/ dir. We do not want to > overwrite existing python installations in any way (in case users > are running modified versions of pythoncom22.dll ...). However if we > modify the above registry keys for pythoncom22.dll and pywintypes22.dll > paths, then the COM servers no longer work. A few *.py files in > the win32all distro contain hardwired references to registry keys. > Modifying those does not fix the problem. re-registering the COM servers *should* work after changing the location of these modules. COM object registration puts the full path to pythoncom22.dll in the registry, so changing the location of this will require re-registering. Also note that buried in the COM registration support is the ability to get a list of registry keys needed to register a COM given object - this is how the win32all WISE installer actually registers the COM objects (so that the registry keys are written to the uninstall log, and thus uninstall magically removes these COM objects too) Mark. From Pavlos Christoforou" Message-ID: <002a01c281cb$0dd4f6c0$0e01010a@gaaros> Thanks Mark > Also note that buried in the COM registration support is the ability to get > a list of registry keys needed to register a COM given object - this is how > the win32all WISE installer actually registers the COM objects (so that the > registry keys are written to the uninstall log, and thus uninstall magically > removes these COM objects too) I am not using WISE. INNO Setup allows the installer to call arbitrary scripts at the end of the install/unistall. I just run the win32com install and unistall scripts (appropriately edited). I suppose it will be 'safer' to find those registry entries and let the installer do the registration. Thanks for win32all Pavlos From jon.barber@acm.org Sat Nov 2 12:25:25 2002 From: jon.barber@acm.org (Jon Barber) Date: Sat, 02 Nov 2002 12:25:25 +0000 Subject: [python-win32] Best practices for writing extensions in C Message-ID: <3DC3C435.9000609@acm.org> Hi, I'm in the process of exposing the Win32 PC/SC subsytem to CPython via a DLL the usual way, and I have a few questions regarding best practices. It's been a while since I've used C (about 9 years) so please bear with me. 1. I've written it all by hand so far, but is there any benefit to using SWIG ? I've exposed all the bits I need, and I don't intend to use any other scripting language to access the API. What other reasons are there for using SWIG ? 2. What conventions to people use to document the parameters that python has to supply, and can I make these visible to an end user ? 3. What is the best way to package up the extension for distribution ? Do people use PPM for Win32 extensions ? Thanks for your patience. Jon. From robin@reportlab.com Sat Nov 2 13:53:13 2002 From: robin@reportlab.com (Robin Becker) Date: Sat, 2 Nov 2002 13:53:13 +0000 Subject: [python-win32] Best practices for writing extensions in C In-Reply-To: <3DC3C435.9000609@acm.org> References: <3DC3C435.9000609@acm.org> Message-ID: <2Zf8hXAJj9w9Ew7m@jessikat.fsnet.co.uk> In message <3DC3C435.9000609@acm.org>, Jon Barber writes >Hi, > >I'm in the process of exposing the Win32 PC/SC subsytem to CPython via a >DLL the usual way, and I have a few questions regarding best practices. >It's been a while since I've used C (about 9 years) so please bear with me. > >1. I've written it all by hand so far, but is there any benefit to >using SWIG ? I've exposed all the bits I need, and I don't intend to >use any other scripting language to access the API. What other reasons >are there for using SWIG ? > >2. What conventions to people use to document the parameters that >python has to supply, and can I make these visible to an end user ? > >3. What is the best way to package up the extension for distribution ? >Do people use PPM for Win32 extensions ? > >Thanks for your patience. > >Jon. I've had success using Sam Rushing's calldll/windll as a wrapper for most of the things I need access to. I'm slowly trying to implement an alternative to anygui's mswgui backend. The main point is that I get a much smaller footprint with calldll (over win32all). All of the programming is done in python, but I need to describe the structures that get used in a fairly non C way. As for packaging I've used inno and distutils for distribution. -- Robin Becker From robinjim@earthlink.net Sat Nov 2 14:38:21 2002 From: robinjim@earthlink.net (robin and jim) Date: Sat, 2 Nov 2002 07:38:21 -0700 Subject: [python-win32] Best practices for writing extensions in C References: <3DC3C435.9000609@acm.org> Message-ID: <003a01c2827d$7ee2f080$5d3b3a41@robinjim> Hello Jon, (1) When I wrote a wrapper for the C-API of a commercial product, I too could not see a reason to use SWIG as I also only access it from Python. (3) I use distutils. I do not know anything about PPM; I'll have to see what it is. ----- Original Message ----- From: "Jon Barber" To: Sent: Saturday, November 02, 2002 5:25 AM Subject: [python-win32] Best practices for writing extensions in C > Hi, > > I'm in the process of exposing the Win32 PC/SC subsytem to CPython via a > DLL the usual way, and I have a few questions regarding best practices. > It's been a while since I've used C (about 9 years) so please bear with me. > > 1. I've written it all by hand so far, but is there any benefit to > using SWIG ? I've exposed all the bits I need, and I don't intend to > use any other scripting language to access the API. What other reasons > are there for using SWIG ? > > 2. What conventions to people use to document the parameters that > python has to supply, and can I make these visible to an end user ? > > 3. What is the best way to package up the extension for distribution ? > Do people use PPM for Win32 extensions ? > > Thanks for your patience. > > Jon. > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From mhammond@skippinet.com.au Sun Nov 3 00:09:54 2002 From: mhammond@skippinet.com.au (Mark Hammond) Date: Sun, 3 Nov 2002 11:09:54 +1100 Subject: [python-win32] Best practices for writing extensions in C In-Reply-To: <3DC3C435.9000609@acm.org> Message-ID: > 1. I've written it all by hand so far, but is there any benefit to > using SWIG ? I've exposed all the bits I need, and I don't intend to > use any other scripting language to access the API. What other reasons > are there for using SWIG ? For me, SWIG is a speed-of-implementation and ease-of-maint tool, rather than a cross-language tool. If it is done, it is done . > 2. What conventions to people use to document the parameters that > python has to supply, and can I make these visible to an end user ? The best bet is probably Python style docstrings, where the first line is a brief synopsis of the signature. IDLE and Pythonwin (and presumably others) will use this first line of a doc string if there is no better info. The autoduck tool I use for win32all may also work, but is only visible to the end user via the help system. > 3. What is the best way to package up the extension for distribution ? > Do people use PPM for Win32 extensions ? To who? If to Python developers you expect to already have Python installed, distutils. If not, check out distutils or Gordon's installer tool - you get a single EXE, then installing that should be easy any way you like Mark. From softex@hn.vnn.vn Sun Nov 3 03:36:16 2002 From: softex@hn.vnn.vn (Hung, Le Khanh) Date: Sun, 3 Nov 2002 10:36:16 +0700 Subject: [python-win32] A Suggestion for Python Syntax References: <20021102170008.30773.63652.Mailman@mail.python.org> Message-ID: <004501c282ea$2abf3f50$5a19a8c0@HungSoftex> This is a multi-part message in MIME format. ------=_NextPart_000_0042_01C28324.D7089380 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable We all know that the statement like continue, break, .. are not = structured. But they are useful for flexible control of the execution. It is mainly because of loop structure limitations. Here we suggest a strengthened loop and selective constructions. With = them we need not to use break statement at all. CompoudStatement ::=3D dostatement | loop statement dostatement::=3D "do" suite GuardedCommand loopstatement::=3D "loop" suite GuardedCommand GuardedCommand::=3D ( ?[!] "check" Condition suite )* Condition ::=3D expression : Condition ::=3D ( "case" Condition suite )* These constructions could replace all Python's compound statements Some examples: 1. Python command if B1 : S1 elif B2 : S2 else S3 is equivalent to do ?! check case B1 : S1 case B2 : S2 S3 2. Python command while B : S is equivalent to loop ? check B : S 3. # Search in Array # This is common sketch for searching algorithms InitSearchScope loop ? check NotEmptySearchScope: TakeAnElement ? check NotFit: SrinkSearchScope # Implementation of Sequential Search i =3D lo; # Scope is from lo to hi loop ? check i < hi : # i is in Scope ? check a[i] !=3D x : i+=3D1 # Binary Search i,j =3D lo,hi loop ? check ix : j =3D k-1 This bit of code has the same structure as the previous! # For comparison, here is Python's Binary search i,j =3D lo,hi while ix : j =3D k-1 else break It is not obvious and natural here that there are two exit points from = the loop. I would be happy to receive comments Best regards. Hung ------=_NextPart_000_0042_01C28324.D7089380 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
We all know that the statement like = continue,=20 break, .. are not structured.
But they are useful for flexible = control of the=20 execution. It is mainly
because of loop structure = limitations.
Here we=20 suggest a strengthened loop and selective constructions. With them
we = need=20 not to use break statement at all.


CompoudStatement ::=3D = dostatement |=20 loop statement
dostatement::=3D
    "do"=20 suite
   =20 GuardedCommand
loopstatement::=3D
    "loop"=20 suite
   =20 GuardedCommand
GuardedCommand::=3D

    ( ?[!] = "check"=20 Condition  suite )*
Condition ::=3D expression :
Condition=20 ::=3D
    ( "case" Condition  suite )*
These=20 constructions could replace all Python's compound = statements
Some examples:
1. Python=20 command
if B1 : S1
elif B2 :=20 S2
else S3
is equivalent = to

do
?!=20 check case B1 :=20 S1
           &= nbsp; =20 case B2 : = S2
       =20 S3
2. Python command
while B : S
is equivalent = to
loop
? check B : = S
3. # Search in Array
# This is = common sketch for=20 searching algorithms
InitSearchScope
loop
?=20 check=20 NotEmptySearchScope:
       =20 TakeAnElement
? check=20 NotFit:
       =20 SrinkSearchScope
# Implementation of Sequential = Search
i =3D=20 lo;  # Scope is from lo to hi
loop
?=20 check i < hi : # i is in Scope
? = check=20 a[i] !=3D x :
        = i+=3D1
# Binary Search
i,j =3D=20 lo,hi
loop
? check i<j : k = =3D (i+j) /=20 2
? = check
       =20 case a[k]<x : i =3D=20 k+1
        case=20 a[k]>x : j =3D k-1

This bit of code has the same structure as = the=20 previous!

# For comparison, here is Python's Binary search
i,j = =3D=20 lo,hi
while i<j : k =3D (i+j) /=20 2
        if = a[k]<x :=20 i =3D k+1
        = elif=20 a[k]>x : j =3D k-1
       =20 else break
It is not obvious and = natural=20 here that there are two exit points from the loop.
I would be happy = to=20 receive comments
Best regards.
Hung
------=_NextPart_000_0042_01C28324.D7089380-- From lbrannma@cablespeed.com Sun Nov 3 19:50:03 2002 From: lbrannma@cablespeed.com (Lance) Date: Sun, 3 Nov 2002 11:50:03 -0800 Subject: [python-win32] PYTHONSTARTUP file Message-ID: <001501c28372$33899440$3212eb42@MYNEWBOX> Hi, I'm running a recent PythonWin. I set my PYTHONSTARTUP environment variable (Win XP) to c:\python22\startup.py. In startup.py I have three lines import os import sys os.chdir("c:\pythonfoo") PythonWin does not execute this file on startup. Any suggestions will be appreciated. From pythonwin32@infopackaging.com Mon Nov 4 15:19:20 2002 From: pythonwin32@infopackaging.com (Troy Sorzano) Date: Mon, 04 Nov 2002 10:19:20 EST Subject: [python-win32] Resolve IP to windows computer name Message-ID: Hi all, I am trying to write a little script in python to read my firewall logs. The source is logged as an IP address. But I would like that IP converted into the windows computer name. I found the windows utility NBTSTAT -A but it requires the computer I am looking up to be turned on. I tried NBTSTAT -c to list the cached name lookups but they expire. Does anyone have a better suggestion then NBTSTAT? Thanks, Troy Sorzano From Jim.Vickroy@noaa.gov Mon Nov 4 15:45:05 2002 From: Jim.Vickroy@noaa.gov (Jim Vickroy) Date: Mon, 04 Nov 2002 08:45:05 -0700 Subject: [python-win32] A Suggestion for Python Syntax Message-ID: <88594923.49238859@sec.noaa.gov> Perhaps, a better audience for this proposal would be comp.lang.python rather than to the MS Windows-specific group. ----- Original Message ----- From: "Hung, Le Khanh" Date: Saturday, November 2, 2002 8:36 pm Subject: [python-win32] A Suggestion for Python Syntax > We all know that the statement like continue, break, .. are not > structured.But they are useful for flexible control of the > execution. It is mainly > because of loop structure limitations. > Here we suggest a strengthened loop and selective constructions. > With them > we need not to use break statement at all. > > > CompoudStatement ::= dostatement | loop statement > dostatement::= > "do" suite > GuardedCommand > loopstatement::= > "loop" suite > GuardedCommand > GuardedCommand::= > > ( ?[!] "check" Condition suite )* > Condition ::= expression : > Condition ::= > ( "case" Condition suite )* > These constructions could replace all Python's compound statements > > Some examples: > 1. Python command > if B1 : S1 > elif B2 : S2 > else S3 > > is equivalent to > > do > ?! check case B1 : S1 > case B2 : S2 > S3 > 2. Python command > while B : S > is equivalent to > loop > ? check B : S > > 3. # Search in Array > # This is common sketch for searching algorithms > InitSearchScope > loop > ? check NotEmptySearchScope: > TakeAnElement > ? check NotFit: > SrinkSearchScope > > # Implementation of Sequential Search > i = lo; # Scope is from lo to hi > loop > ? check i < hi : # i is in Scope > ? check a[i] != x : > i+=1 > > # Binary Search > i,j = lo,hi > loop > ? check i ? check > case a[k] case a[k]>x : j = k-1 > > This bit of code has the same structure as the previous! > > # For comparison, here is Python's Binary search > i,j = lo,hi > while i if a[k] elif a[k]>x : j = k-1 > else break > > It is not obvious and natural here that there are two exit points > from the loop. > I would be happy to receive comments > Best regards. > Hung > > From Jim.Vickroy@noaa.gov Mon Nov 4 16:03:10 2002 From: Jim.Vickroy@noaa.gov (Jim Vickroy) Date: Mon, 04 Nov 2002 09:03:10 -0700 Subject: [python-win32] PYTHONSTARTUP file Message-ID: <962e7ae9.7ae9962e@sec.noaa.gov> Hello Lance, I can offer no suggestions. I am using Python 2.2.2 on an XP system and note the same behavior with Pythonwin and with IDLE. The startup configuration file only seems to work with the interactive, command line interpreter. ----- Original Message ----- From: "Lance" Date: Sunday, November 3, 2002 12:50 pm Subject: [python-win32] PYTHONSTARTUP file > Hi, > > I'm running a recent PythonWin. I set my PYTHONSTARTUP environment > variable(Win XP) to > c:\python22\startup.py. > > In startup.py I have three lines > import os > import sys > os.chdir("c:\pythonfoo") > > PythonWin does not execute this file on startup. Any suggestions > will be > appreciated. > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From jens.jorgensen@tallan.com Mon Nov 4 18:30:14 2002 From: jens.jorgensen@tallan.com (Jens B. Jorgensen) Date: Mon, 04 Nov 2002 12:30:14 -0600 Subject: [python-win32] Resolve IP to windows computer name References: Message-ID: <3DC6BCB6.10904@tallan.com> I'm fairly familiar with the protocols for NetBIOS over TCP/IP (aka NetBT), having written my own code that implements some of their features (including "reverse lookup" such as you're doing). I think you'll find though that if a computer is no longer turned on then getting its name will not be very doable unless you run some kind of daemon all the time to listen for name registrations. The problem is that naming in "windows network" is dynamic by design. When a computer comes up it uses broadcast (depending on what kind of node it is operating as, could also go to WINS server or both) to register names on the network. When the computer goes down it is supposed to unregister its names. Since the design is dynamic in nature it is doubtful you could reliably get a mapping and also unlikely there's any existing services will cache the name registrations persistently since this would violate the design and very likely cause problems, for example someone logging in to one machine, then shutting that down and going to another machine and logging in. Troy Sorzano wrote: >Hi all, > >I am trying to write a little script in python to read my firewall >logs. The source is logged as an IP address. But I would like that IP >converted into the windows computer name. I found the windows utility >NBTSTAT -A but it requires the computer I am looking up to be >turned on. I tried NBTSTAT -c to list the cached name lookups but >they expire. > >Does anyone have a better suggestion then NBTSTAT? > >Thanks, > >Troy Sorzano > > > > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" From amapy@snafu.de Tue Nov 5 16:37:17 2002 From: amapy@snafu.de (Andreas Maurer) Date: Tue, 05 Nov 2002 17:37:17 +0100 Subject: [python-win32] Resolve IP to windows computer name References: Message-ID: <3DC7F3BD.7070208@snafu.de> Troy Sorzano wrote: > Hi all, > > I am trying to write a little script in python to read my firewall > logs. The source is logged as an IP address. But I would like that IP > converted into the windows computer name. I found the windows utility > NBTSTAT -A but it requires the computer I am looking up to be > turned on. I tried NBTSTAT -c to list the cached name lookups but > they expire. > > Does anyone have a better suggestion then NBTSTAT? > > Thanks, > > Troy Sorzano > Hi Troy, try ping -a or: import socket socket.gethostbyaddr("") HTH Andi From charles.a.erignac@boeing.com Wed Nov 6 20:49:40 2002 From: charles.a.erignac@boeing.com (Erignac, Charles A) Date: Wed, 6 Nov 2002 12:49:40 -0800 Subject: [python-win32] Passing Arrays by Reference Message-ID: <67B3A7DA6591BE439001F2736233351211E29A@XCH-NW-28.nw.nos.boeing.com> I am calling a method on a COM object that fills in an array passed by reference. The array must be initialized to a given size otherwise the call will fail. Currently I am able to complete the call and the array returned by the method is the one I passed as a parameter but unfortunately the value of the array does not change and it should. For your information the COM object I work with is a Position interface maintained by the CATIA COM server. The method is Sub GetComponents(CATSafeArrayVariant array). I understand that the CATSafeArrayVariant type is equivalent to an array of variants. The python call looks like this: a = range(0,12) b = myPosition.GetComponents(a) print a # outputs (0,1,2,3,4,5,6,7,8,9,10,11) instead of the actual components print b # same output The call is an early binding thanks to pygen. I would appreciate any help regarding this problem. I would like at least to know where to look in the win32com code to understand what is going wrong. Best regards, Charles From jens.jorgensen@tallan.com Wed Nov 6 21:03:37 2002 From: jens.jorgensen@tallan.com (Jens B. Jorgensen) Date: Wed, 06 Nov 2002 15:03:37 -0600 Subject: [python-win32] Passing Arrays by Reference References: <67B3A7DA6591BE439001F2736233351211E29A@XCH-NW-28.nw.nos.boeing.com> Message-ID: <3DC983A9.1010702@tallan.com> This is a cryptographically signed message in MIME format. --------------ms040203090507080900080005 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Things seem to work fine for me. I created a test ActiveX DLL in VB with a single object. Here's the code for it: Public Sub DoArrayThing(larr() As Long) Dim i As Long For i = LBound(larr) To UBound(larr) larr(i) = larr(i) + 1 Next i End Sub Then in python here's what I get: ActivePython 2.2.1 Build 222 (ActiveState Corp.) based on Python 2.2.1 (#34, Apr 15 2002, 09:51:39) [MSC 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from win32com.client import Dispatch >>> o = Dispatch('TestArray.ArrManip') >>> o.DoArrayThing(range(0, 4)) (1, 2, 3, 4) >>> a = _ >>> o.DoArrayThing(a) (2, 3, 4, 5) >>> So it looks like everything python is doing is all fine and good with the arrays. Erignac, Charles A wrote: >I am calling a method on a COM object that fills in an array passed by >reference. The array must be initialized to a given size otherwise the call >will fail. Currently I am able to complete the call and the array returned >by the method is the one I passed as a parameter but unfortunately the value >of the array does not change and it should. For your information the COM >object I work with is a Position interface maintained by the CATIA COM >server. The method is Sub GetComponents(CATSafeArrayVariant array). I >understand that the CATSafeArrayVariant type is equivalent to an array of >variants. >The python call looks like this: > a = range(0,12) > b = myPosition.GetComponents(a) > print a # outputs (0,1,2,3,4,5,6,7,8,9,10,11) instead of the actual >components > print b # same output > >The call is an early binding thanks to pygen. >I would appreciate any help regarding this problem. I would like at least to >know where to look in the win32com code to understand what is going wrong. >Best regards, > >Charles > > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" --------------ms040203090507080900080005 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIJmjCC AyswggKUoAMCAQICAwdmRzANBgkqhkiG9w0BAQQFADCBkjELMAkGA1UEBhMCWkExFTATBgNV BAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMQ8wDQYDVQQKEwZUaGF3dGUx HTAbBgNVBAsTFENlcnRpZmljYXRlIFNlcnZpY2VzMSgwJgYDVQQDEx9QZXJzb25hbCBGcmVl bWFpbCBSU0EgMjAwMC44LjMwMB4XDTAyMDUwNjE0NDQ0MVoXDTAzMDUwNjE0NDQ0MVowZjES MBAGA1UEBBMJSm9yZ2Vuc2VuMQ0wCwYDVQQqEwRKZW5zMRcwFQYDVQQDEw5KZW5zIEpvcmdl bnNlbjEoMCYGCSqGSIb3DQEJARYZamVucy5qb3JnZW5zZW5AdGFsbGFuLmNvbTCCASIwDQYJ KoZIhvcNAQEBBQADggEPADCCAQoCggEBALpRu41RjbKdgKkVQ4+0r38pZjxYFENSvBSQDup8 NBBC1Dj9oUkuEHuwJYg0jjYO4GdOT2QBhozGP+MUuxq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AwICAUAwBwYFKw4DAgcwDQYIKoZI hvcNAwICASgwga0GCyqGSIb3DQEJEAILMYGdoIGaMIGSMQswCQYDVQQGEwJaQTEVMBMGA1UE CBMMV2VzdGVybiBDYXBlMRIwEAYDVQQHEwlDYXBlIFRvd24xDzANBgNVBAoTBlRoYXd0ZTEd MBsGA1UECxMUQ2VydGlmaWNhdGUgU2VydmljZXMxKDAmBgNVBAMTH1BlcnNvbmFsIEZyZWVt YWlsIFJTQSAyMDAwLjguMzACAwdmRzANBgkqhkiG9w0BAQEFAASCAQCZxlE1BFerWZIZX3z+ pj9tpPXB7dtD29fbGAiVO4uDUm8i3MTMdmK4c84EiZJI90SeHdIW3j7pHK40HMBYzAF+G3F8 K86B4wBCZ0D+TB6kQoU6vtRB84PW+bBJz7GVUQSUJCsYch7r5Icoku6xiRtbRnOYryx6vjT2 iG2qDsOGcLJhx9Wnu8kVSpvBAeqHRzS3Ux/zpj+HzMKKnhUvbrmGIoiSfaORQ895YufqvsKI SOcjKgKbbp8a6ciDOBVZYyCaT0IGpHi3iLrebSec6hjgGgam90k8+HxInwJxOxsDxlfurA76 IG3lGprOBsO53y9Wkl1GFsKp6M2XE05iQmOjAAAAAAAA --------------ms040203090507080900080005-- From charles.a.erignac@boeing.com Thu Nov 7 17:28:25 2002 From: charles.a.erignac@boeing.com (Erignac, Charles A) Date: Thu, 7 Nov 2002 09:28:25 -0800 Subject: [python-win32] Passing Arrays by Reference Message-ID: <67B3A7DA6591BE439001F2736233351211E29B@XCH-NW-28.nw.nos.boeing.com> I used Jens's example below to check that I could pass a python array by reference to a vb method that modifies it. I also checked that the CATIA.Position.GetComponents call that failed to modify the array passed by reference in python actually works from vb. So as a quick fix I created a vb proxy that places the call on behalf of python. It is not elegant but it works. This is what the proxy looks like: Public Sub GetComponents(o As Object, ByRef a() As Variant) o.GetComponents a End Sub Charles -----Original Message----- From: Jens B. Jorgensen [mailto:jens.jorgensen@tallan.com] Sent: Wednesday, November 06, 2002 1:04 PM To: Erignac, Charles A Cc: 'python-win32@python.org' Subject: Re: [python-win32] Passing Arrays by Reference Things seem to work fine for me. I created a test ActiveX DLL in VB with a single object. Here's the code for it: Public Sub DoArrayThing(larr() As Long) Dim i As Long For i = LBound(larr) To UBound(larr) larr(i) = larr(i) + 1 Next i End Sub Then in python here's what I get: ActivePython 2.2.1 Build 222 (ActiveState Corp.) based on Python 2.2.1 (#34, Apr 15 2002, 09:51:39) [MSC 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from win32com.client import Dispatch >>> o = Dispatch('TestArray.ArrManip') >>> o.DoArrayThing(range(0, 4)) (1, 2, 3, 4) >>> a = _ >>> o.DoArrayThing(a) (2, 3, 4, 5) >>> So it looks like everything python is doing is all fine and good with the arrays. Erignac, Charles A wrote: >I am calling a method on a COM object that fills in an array passed by >reference. The array must be initialized to a given size otherwise the call >will fail. Currently I am able to complete the call and the array returned >by the method is the one I passed as a parameter but unfortunately the value >of the array does not change and it should. For your information the COM >object I work with is a Position interface maintained by the CATIA COM >server. The method is Sub GetComponents(CATSafeArrayVariant array). I >understand that the CATSafeArrayVariant type is equivalent to an array of >variants. >The python call looks like this: > a = range(0,12) > b = myPosition.GetComponents(a) > print a # outputs (0,1,2,3,4,5,6,7,8,9,10,11) instead of the actual >components > print b # same output > >The call is an early binding thanks to pygen. >I would appreciate any help regarding this problem. I would like at least to >know where to look in the win32com code to understand what is going wrong. >Best regards, > >Charles > > >_______________________________________________ >Python-win32 mailing list >Python-win32@python.org >http://mail.python.org/mailman/listinfo/python-win32 > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" From jens.jorgensen@tallan.com Thu Nov 7 18:36:50 2002 From: jens.jorgensen@tallan.com (Jens B. Jorgensen) Date: Thu, 07 Nov 2002 12:36:50 -0600 Subject: [python-win32] Passing Arrays by Reference References: <67B3A7DA6591BE439001F2736233351211E29B@XCH-NW-28.nw.nos.boeing.com> Message-ID: <3DCAB2C2.2080106@tallan.com> And that makes it work?! Whoa. Weird. Erignac, Charles A wrote: >I used Jens's example below to check that I could pass a python array by >reference to a vb method that modifies it. I also checked that the >CATIA.Position.GetComponents call that failed to modify the array passed by >reference in python actually works from vb. >So as a quick fix I created a vb proxy that places the call on behalf of >python. It is not elegant but it works. This is what the proxy looks like: > >Public Sub GetComponents(o As Object, ByRef a() As Variant) > o.GetComponents a >End Sub > >Charles > >-----Original Message----- >From: Jens B. Jorgensen [mailto:jens.jorgensen@tallan.com] >Sent: Wednesday, November 06, 2002 1:04 PM >To: Erignac, Charles A >Cc: 'python-win32@python.org' >Subject: Re: [python-win32] Passing Arrays by Reference > > >Things seem to work fine for me. I created a test ActiveX DLL in VB with >a single object. Here's the code for it: > >Public Sub DoArrayThing(larr() As Long) > Dim i As Long > For i = LBound(larr) To UBound(larr) > larr(i) = larr(i) + 1 > Next i > >End Sub > >Then in python here's what I get: > >ActivePython 2.2.1 Build 222 (ActiveState Corp.) based on >Python 2.2.1 (#34, Apr 15 2002, 09:51:39) [MSC 32 bit (Intel)] on win32 >Type "help", "copyright", "credits" or "license" for more information. > >>> from win32com.client import Dispatch > >>> o = Dispatch('TestArray.ArrManip') > >>> o.DoArrayThing(range(0, 4)) >(1, 2, 3, 4) > >>> a = _ > >>> o.DoArrayThing(a) >(2, 3, 4, 5) > >>> > >So it looks like everything python is doing is all fine and good with >the arrays. > >Erignac, Charles A wrote: > > > >>I am calling a method on a COM object that fills in an array passed by >>reference. The array must be initialized to a given size otherwise the call >>will fail. Currently I am able to complete the call and the array returned >>by the method is the one I passed as a parameter but unfortunately the >> >> >value > > >>of the array does not change and it should. For your information the COM >>object I work with is a Position interface maintained by the CATIA COM >>server. The method is Sub GetComponents(CATSafeArrayVariant array). I >>understand that the CATSafeArrayVariant type is equivalent to an array of >>variants. >>The python call looks like this: >> a = range(0,12) >> b = myPosition.GetComponents(a) >> print a # outputs (0,1,2,3,4,5,6,7,8,9,10,11) instead of the actual >>components >> print b # same output >> >>The call is an early binding thanks to pygen. >>I would appreciate any help regarding this problem. I would like at least >> >> >to > > >>know where to look in the win32com code to understand what is going wrong. >>Best regards, >> >>Charles >> >> >>_______________________________________________ >>Python-win32 mailing list >>Python-win32@python.org >>http://mail.python.org/mailman/listinfo/python-win32 >> >> >> >> > > > -- Jens B. Jorgensen jens.jorgensen@tallan.com "With a focused commitment to our clients and our people, we deliver value through customized technology solutions" From mhammond@skippinet.com.au Sun Nov 10 07:06:46 2002 From: mhammond@skippinet.com.au (Mark Hammond) Date: Sun, 10 Nov 2002 18:06:46 +1100 Subject: [python-win32] Passing Arrays by Reference In-Reply-To: <3DCAB2C2.2080106@tallan.com> Message-ID: If someone is really keen, we could get this fixed once and for all in win32com. In the win32com\test directory, testvb.py does all sorts of funky argument passing between Python and VB, including arrays. Obviously not all array combinations it would seem . The VB side of this component is in the win32com source tree, or mail me for it (it is pretty small). Then if we can keep the existing semantics (which are obviously correct for byval arrays or some such) but also demonstrate this specific problem, then I will be able to find and fix the code responsible. Mark. > -----Original Message----- > From: python-win32-admin@python.org > [mailto:python-win32-admin@python.org]On Behalf Of Jens B. Jorgensen > Sent: Friday, 8 November 2002 5:37 AM > To: Erignac, Charles A > Cc: 'python-win32@python.org' > Subject: Re: [python-win32] Passing Arrays by Reference > > > And that makes it work?! Whoa. Weird. > > Erignac, Charles A wrote: > > >I used Jens's example below to check that I could pass a python array by > >reference to a vb method that modifies it. I also checked that the > >CATIA.Position.GetComponents call that failed to modify the > array passed by > >reference in python actually works from vb. > >So as a quick fix I created a vb proxy that places the call on behalf of > >python. It is not elegant but it works. This is what the proxy > looks like: > > > >Public Sub GetComponents(o As Object, ByRef a() As Variant) > > o.GetComponents a > >End Sub > > > >Charles > > > >-----Original Message----- > >From: Jens B. Jorgensen [mailto:jens.jorgensen@tallan.com] > >Sent: Wednesday, November 06, 2002 1:04 PM > >To: Erignac, Charles A > >Cc: 'python-win32@python.org' > >Subject: Re: [python-win32] Passing Arrays by Reference > > > > > >Things seem to work fine for me. I created a test ActiveX DLL in VB with > >a single object. Here's the code for it: > > > >Public Sub DoArrayThing(larr() As Long) > > Dim i As Long > > For i = LBound(larr) To UBound(larr) > > larr(i) = larr(i) + 1 > > Next i > > > >End Sub > > > >Then in python here's what I get: > > > >ActivePython 2.2.1 Build 222 (ActiveState Corp.) based on > >Python 2.2.1 (#34, Apr 15 2002, 09:51:39) [MSC 32 bit (Intel)] on win32 > >Type "help", "copyright", "credits" or "license" for more information. > > >>> from win32com.client import Dispatch > > >>> o = Dispatch('TestArray.ArrManip') > > >>> o.DoArrayThing(range(0, 4)) > >(1, 2, 3, 4) > > >>> a = _ > > >>> o.DoArrayThing(a) > >(2, 3, 4, 5) > > >>> > > > >So it looks like everything python is doing is all fine and good with > >the arrays. > > > >Erignac, Charles A wrote: > > > > > > > >>I am calling a method on a COM object that fills in an array passed by > >>reference. The array must be initialized to a given size > otherwise the call > >>will fail. Currently I am able to complete the call and the > array returned > >>by the method is the one I passed as a parameter but unfortunately the > >> > >> > >value > > > > > >>of the array does not change and it should. For your information the COM > >>object I work with is a Position interface maintained by the CATIA COM > >>server. The method is Sub GetComponents(CATSafeArrayVariant array). I > >>understand that the CATSafeArrayVariant type is equivalent to > an array of > >>variants. > >>The python call looks like this: > >> a = range(0,12) > >> b = myPosition.GetComponents(a) > >> print a # outputs (0,1,2,3,4,5,6,7,8,9,10,11) instead of the actual > >>components > >> print b # same output > >> > >>The call is an early binding thanks to pygen. > >>I would appreciate any help regarding this problem. I would > like at least > >> > >> > >to > > > > > >>know where to look in the win32com code to understand what is > going wrong. > >>Best regards, > >> > >>Charles > >> > >> > >>_______________________________________________ > >>Python-win32 mailing list > >>Python-win32@python.org > >>http://mail.python.org/mailman/listinfo/python-win32 > >> > >> > >> > >> > > > > > > > > -- > Jens B. Jorgensen > jens.jorgensen@tallan.com > > "With a focused commitment to our clients and our people, we > deliver value through customized technology solutions" > > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 From lbrannma@cablespeed.com Sun Nov 10 15:35:09 2002 From: lbrannma@cablespeed.com (Lance) Date: Sun, 10 Nov 2002 07:35:09 -0800 Subject: [python-win32] list contents disappear Message-ID: <001501c288ce$c0eaf7a0$3212eb42@MYNEWBOX> Hi All, I'm running PythonWin on Windows XP. If I print the contents of a huge list in interactive mode and place focus in the line (with my mouse or the arrow keys on the keyboard) the line disappears! This doesn't occur if I print the list contents from a file. Any advice would be appreciated. Thanks, Lance From lbrannma@cablespeed.com Sun Nov 10 15:36:24 2002 From: lbrannma@cablespeed.com (Lance) Date: Sun, 10 Nov 2002 07:36:24 -0800 Subject: [python-win32] How to clear the screen? Message-ID: <001f01c288ce$ed59efd0$3212eb42@MYNEWBOX> Hi All, I'm running WinPython. Is there a command that will clear the interactive window screen? Also, is there a command that will remove everything from the symbol table (i.e. start over with a clean interactive session?) Thanks, Lance From tony@tcapp.com Mon Nov 11 07:18:01 2002 From: tony@tcapp.com (Tony Cappellini) Date: Sun, 10 Nov 2002 23:18:01 -0800 Subject: [python-win32] Another question about PythonWin Message-ID: <5.1.0.14.0.20021110231739.04abefa0@wheresmymailserver.com> When I call os.system('cls') in Pythwonwin, a window opens then closes, but my interactive screen never gets cleared :( If I execute the same command in IDLE, IPython, or python.exe ,the screen is cleared . Why is PythonWin different in this regard ? thanks Tony From tony@tcapp.com Mon Nov 11 07:18:23 2002 From: tony@tcapp.com (Tony Cappellini) Date: Sun, 10 Nov 2002 23:18:23 -0800 Subject: [python-win32] Problems with PythonWin on Windows 2000 Message-ID: <5.1.0.14.0.20021110231810.00affd20@wheresmymailserver.com> I'm using PythonW on Windows 2000. When I make changes to a source file, and save the changes, I usually click on the Import/Reload button, or manually load the file again. However, when I execute the script after re-importing/reloading, , Pythonwin reports the same error. It even shows the OLD source code line, as if it didn't see that I had made changes to the source, saved the changes and re-imported the module. I've verified that the changes I've made are actually in the source file, by using an editor outside of PythonWin. Is this a common problem ? thanks Tony From jjorgensen@Tallan.com Mon Nov 11 16:18:31 2002 From: jjorgensen@Tallan.com (Jorgensen, Jens) Date: Mon, 11 Nov 2002 11:18:31 -0500 Subject: [python-win32] Another question about PythonWin Message-ID: VGhpcyBpcyBiZWNhdXNlIGNscyBpcyBhIGNvbnNvbGUgYXBwIGFuZCBweXRob253aW4gaXMgYSB3 aW4zMiBndWkgYXBwLiBTbywgd2hlbiBjbHMgcnVucyBhIGNvbnNvbGUgaXMgYWxsb2NhdGVkICh0 aGUgd2luZG93IHlvdSBzZWUgYmVpbmcgY3JlYXRlZCkgYW5kIHRoZW4gaXQgZG9lcyBpdHMgd29y ay4gcHl0aG9uLmV4ZSBpcyBhIGNvbnNvbGUgYXBwIGFuZCB0aHVzIGFscmVhZHkgaGFzIGEgY29u c29sZSB3aGljaCBpcyB3aGF0IGdldHMgdXNlZCBieSBjbHMgd2hlbiBpdCBydW5zLiBUaGlzIGlz IGEgV2luZG96ZSB0aGluZywgbm90IGxpa2UgdW5peCB3aGVyZSBldmVyeSBwcm9ncmFtIGhhcyBz dGRpbiwgc3Rkb3V0LCBhbmQgc3RkZXJyIHdoaWNoIG1heSBvciBtYXkgbm90IGhhdmUgYSAiY29u c29sZSIgb24gdGhlIG90aGVyIGVuZCBvZiB0aGVtLiANCg0KCS0tLS0tT3JpZ2luYWwgTWVzc2Fn ZS0tLS0tIA0KCUZyb206IFRvbnkgQ2FwcGVsbGluaSBbbWFpbHRvOnRvbnlAdGNhcHAuY29tXSAN CglTZW50OiBNb24gMTEvMTEvMjAwMiAxOjE4IEFNIA0KCVRvOiBweXRob24td2luMzJAcHl0aG9u Lm9yZyANCglDYzogDQoJU3ViamVjdDogW3B5dGhvbi13aW4zMl0gQW5vdGhlciBxdWVzdGlvbiBh Ym91dCBQeXRob25XaW4NCgkNCgkNCg0KDQoJV2hlbiBJIGNhbGwgb3Muc3lzdGVtKCdjbHMnKSBp biBQeXRod29ud2luLCBhIHdpbmRvdyBvcGVucyB0aGVuIGNsb3NlcywgYnV0DQoJbXkgaW50ZXJh Y3RpdmUgc2NyZWVuIG5ldmVyIGdldHMgY2xlYXJlZCA6KA0KCQ0KCUlmIEkgZXhlY3V0ZSB0aGUg c2FtZSBjb21tYW5kIGluIElETEUsIElQeXRob24sIG9yIHB5dGhvbi5leGUgLHRoZSBzY3JlZW4N CglpcyBjbGVhcmVkIC4NCgkNCglXaHkgaXMgUHl0aG9uV2luIGRpZmZlcmVudCBpbiB0aGlzIHJl Z2FyZCA/DQoJDQoJdGhhbmtzDQoJDQoJVG9ueQ0KCQ0KCQ0KCV9fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fDQoJUHl0aG9uLXdpbjMyIG1haWxpbmcgbGlzdA0K CVB5dGhvbi13aW4zMkBweXRob24ub3JnDQoJaHR0cDovL21haWwucHl0aG9uLm9yZy9tYWlsbWFu L2xpc3RpbmZvL3B5dGhvbi13aW4zMg0KCQ0KDQo= From tony@tcapp.com Mon Nov 11 17:23:58 2002 From: tony@tcapp.com (Tony Cappellini) Date: Mon, 11 Nov 2002 09:23:58 -0800 Subject: [python-win32] Another question about PythonWin In-Reply-To: Message-ID: <5.1.0.14.0.20021111092252.00b00ab8@tcapp.com> Thanks Jens. So the question remains- Should PythonWin intercept this console cls, and do a GUI style clear screen for the programer, or should the programmer do it manually ? At 11:18 AM 11/11/2002 -0500, Jorgensen, Jens wrote: >This is because cls is a console app and pythonwin is a win32 gui app. So, >when cls runs a console is allocated (the window you see being created) >and then it does its work. python.exe is a console app and thus already >has a console which is what gets used by cls when it runs. This is a >Windoze thing, not like unix where every program has stdin, stdout, and >stderr which may or may not have a "console" on the other end of them. > > -----Original Message----- > From: Tony Cappellini [mailto:tony@tcapp.com] > Sent: Mon 11/11/2002 1:18 AM > To: python-win32@python.org > Cc: > Subject: [python-win32] Another question about PythonWin > > > > > When I call os.system('cls') in Pythwonwin, a window opens then > closes, but > my interactive screen never gets cleared :( > > If I execute the same command in IDLE, IPython, or python.exe > ,the screen > is cleared . > > Why is PythonWin different in this regard ? > > thanks > > Tony > > > _______________________________________________ > Python-win32 mailing list > Python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 > From sakoosh@uark.edu Mon Nov 11 18:06:25 2002 From: sakoosh@uark.edu (Ari Kooshesh) Date: Mon, 11 Nov 2002 12:06:25 -0600 Subject: [python-win32] Aim clients Message-ID: <000401c289ad$0cef44b0$0100a8c0@TheWay> This is a multi-part message in MIME format. ------=_NextPart_000_0005_01C2897A.C254D4B0 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0006_01C2897A.C25745B0" ------=_NextPart_001_0006_01C2897A.C25745B0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, I'm looking into writing a aol aim plug-in. It looks like COM is the way to go, so I was wondering if anyone had any python examples. My goal is "attach" my program to a chat window and alter the text that is being sent to the other user. Thank you, Ari Kooshesh ------=_NextPart_001_0006_01C2897A.C25745B0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi,

I’m looking into writing a aol aim plug-in. It looks like COM is the way to = go, so I was wondering if anyone had

any python examples. My goal is “attach” my = program to a chat window and alter the text that is being sent to the other = user. 

Thank you,

Ari Kooshesh

------=_NextPart_001_0006_01C2897A.C25745B0-- ------=_NextPart_000_0005_01C2897A.C254D4B0 Content-Type: image/jpeg; name="image001.jpg" Content-Transfer-Encoding: base64 Content-ID: /9j/4AAQSkZJRgABAgEASABIAAD/7QVoUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA AQBIAAAAAQABOEJJTQPzAAAAAAAIAAAAAAAAAAA4QklNBAoAAAAAAAEAADhCSU0nEAAAAAAACgAB AAAAAAAAAAI4QklNA/UAAAAAAEgAL2ZmAAEAbGZmAAYAAAAAAAEAL2ZmAAEAoZmaAAYAAAAAAAEA MgAAAAEAWgAAAAYAAAAAAAEANQAAAAEALQAAAAYAAAAAAAE4QklNA/gAAAAAAHAAAP////////// //////////////////8D6AAAAAD/////////////////////////////A+gAAAAA//////////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hZkmLWKHYpdirsVbwKuGBLsKuxV2KuxV2KtYq3irsUuxV2KHYq7FXYq1XFWsK GsVf/9DpoGZjgt4q7FLq4odil2Kt4qtxQ2MUrxgSuyKXYqtrhV2KHHCq0jChbhQ7FWsVbxV2KuxV sHAreKXYq7FXYq7FXYq7FLsCuwoaxVxOKGsKuxVrFXYq/wD/0emjpmY4LeKuxV2KuxS7FXVxVrFD YxSuGBK6uBLVcUOwq7FWicVawoaOKtUxQ3TFWqYq7CrWKt4quGRS7ClsDArqYq7FWsKuwK3irRxQ 1hQtOFXYodirsUuxV//S6dmY4LsVdTFW6YEtHCrWKHYq7CrYwK3iybrgV1cVawq3gVrCh2KuxV2K uxV2KtHFDWFXAYFXDAluhGLJvAh2KtHCrWFWxgVxxVaSMKGsKGsVdTFXHFDsVdil/9Pp1MzHCbAx V2BXYVaOKtYodirsVcMVXVxS6uKuqMVdUYq7FXYq1irq4q7FWxgV2FLsUNEV2xQuQb79sBLIBcSS SCMCW9sCt7YpawoWmlcVcAK4UNbYqtNKYUNbYodirsKuxV1MCXYUOxV//9TqG2ZbhuxV2BXYVccV LWFDRxVrfFDsKtYq2OuKuHfFWx0wK75YpbFMCu2xV2KtbYVbxVv4cCW9sVb22wJbwJdhVoVxQ3ir RxVw98Vawq12xQ44q0cKtHFDWKGsKt4EtiuKt4q//9k= ------=_NextPart_000_0005_01C2897A.C254D4B0-- From jjorgensen@Tallan.com Mon Nov 11 18:25:12 2002 From: jjorgensen@Tallan.com (Jorgensen, Jens) Date: Mon, 11 Nov 2002 13:25:12 -0500 Subject: [python-win32] Another question about PythonWin Message-ID: SXQnbGwgaGF2ZSB0byBiZSB0aGUgcHJvZ3JhbW1lci4gU2luY2Ugb3Muc3lzdGVtIGV4ZWN1dGVz IGEgcHJvY2VzcyB0aGVyZSBpcyBubyB3YXkgdGhhdCBweXRob253aW4gY291bGQgKG9yIHNob3Vs ZCkgdHJ5IHRvIGludGVydmVuZSBpbiB3aGF0IGhhcHBlbnMuIFl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jbGVhcmVkIDooDQoJPg0K CT4gICAgICAgICBJZiBJIGV4ZWN1dGUgdGhlIHNhbWUgY29tbWFuZCBpbiBJRExFLCBJUHl0aG9u LCBvciBweXRob24uZXhlDQoJPiAsdGhlIHNjcmVlbg0KCT4gICAgICAgICBpcyBjbGVhcmVkIC4N Cgk+DQoJPiAgICAgICAgIFdoeSBpcyBQeXRob25XaW4gZGlmZmVyZW50IGluIHRoaXMgcmVnYXJk ID8NCgk+DQoJPiAgICAgICAgIHRoYW5rcw0KCT4NCgk+ICAgICAgICAgVG9ueQ0KCT4NCgk+DQoJ PiAgICAgICAgIF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f DQoJPiAgICAgICAgIFB5dGhvbi13aW4zMiBtYWlsaW5nIGxpc3QNCgk+ICAgICAgICAgUHl0aG9u LXdpbjMyQHB5dGhvbi5vcmcNCgk+ICAgICAgICAgaHR0cDovL21haWwucHl0aG9uLm9yZy9tYWls bWFuL2xpc3RpbmZvL3B5dGhvbi13aW4zMg0KCT4NCgkNCgkNCg0K From olson@mcs.anl.gov Mon Nov 11 20:20:40 2002 From: olson@mcs.anl.gov (Robert Olson) Date: Mon, 11 Nov 2002 14:20:40 -0600 Subject: [python-win32] Extension and local data on win32 Message-ID: <5.1.1.6.2.20021111140643.02d90828@pop.mcs.anl.gov> Hi -- I'm trying to use a library as an extension under win32. Internal to the library is a hierarchical typing system that uses as type identifiers the address of a structure describing the class; somethign like struct object_type { struct object_type *parent; func_t initializer; } const struct object_type tobj_struct = { parent_obj, init_func }; tobj_type = &tobj_struct; Then later it tags objects using the tobj_type pointer. The structure of the python interface is such that multiple extension modules are created, each linking in the C library that has the type structures. The problem is that when Windows loads the DLLs, it maps them into different address spaces. The result is that when an object created by calling one extension is passed through a method in another extension, comparisons made on the object pointers fail. I can't change the behavior of this library; does anyone have any ideas on a solution? I've tried what MSDN howto Q109619 " Share All Data in a DLL" suggests by adding ["-section:.data,rws", "-section:.bss,rws"] to the extra_link_args keyword on the Extension in setup.py on all extensions built; no change. Also, marking the structure with __declspec(dllexport) didn't help. Thank you for any advice. --bob From olson@mcs.anl.gov Mon Nov 11 20:25:23 2002 From: olson@mcs.anl.gov (Robert Olson) Date: Mon, 11 Nov 2002 14:25:23 -0600 Subject: [python-win32] Extension and local data on win32 In-Reply-To: <5.1.1.6.2.20021111140643.02d90828@pop.mcs.anl.gov> Message-ID: <5.1.1.6.2.20021111142459.01dffa18@pop.mcs.anl.gov> At 02:20 PM 11/11/2002 -0600, Robert Olson wrote: >Hi -- > >I'm trying to use a library as an extension under win32. Oh, forgot to mention this. This code works great as is on Linux; different shared lib loading semantics apparently. --bob From theller@python.net Mon Nov 11 20:29:22 2002 From: theller@python.net (Thomas Heller) Date: 11 Nov 2002 21:29:22 +0100 Subject: [python-win32] Re: Extension and local data on win32 References: <5.1.1.6.2.20021111140643.02d90828@pop.mcs.anl.gov> Message-ID: <1y5ryhnh.fsf@python.net> Robert Olson writes: > The structure of the python interface is such that multiple extension > modules are created, each linking in the C library that has the type > structures. The problem is that when Windows loads the DLLs, it maps > them into different address spaces. The result is that when an object > created by calling one extension is passed through a method in another > extension, comparisons made on the object pointers fail. > If I understand your problem correctly, you should change your code so that this library is only linked into *one* extension. If you need more than one extension module, you should probably export some interface to the library from the first extension, and use this from the other extensions. > > I can't change the behavior of this library; does anyone have any > ideas on a solution? I've tried what MSDN howto Q109619 " Share All > Data in a DLL" suggests by adding ["-section:.data,rws", > "-section:.bss,rws"] to the extra_link_args keyword on the Extension > in setup.py on all extensions built; no change. I think this shares the data of a DLL between instances of the DLL in different processes. Thomas From jjorgensen@Tallan.com Mon Nov 11 21:03:23 2002 From: jjorgensen@Tallan.com (Jorgensen, Jens) Date: Mon, 11 Nov 2002 16:03:23 -0500 Subject: [python-win32] Extension and local data on win32 Message-ID: SG93IGludGVyZXN0aW5nLiBZb3Ugc2F5IHRoYXQgeW91J3JlIGxpbmtpbmcgaW4gdGhlIEMgbGli cmFyeSBp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5dGhvbi13aW4zMiBtYWlsaW5nIGxpc3QNCglQ eXRob24td2luMzJAcHl0aG9uLm9yZw0KCWh0dHA6Ly9tYWlsLnB5dGhvbi5vcmcvbWFpbG1hbi9s aXN0aW5mby9weXRob24td2luMzINCgkNCg0K From kfarmer@thuban.org Mon Nov 11 21:07:25 2002 From: kfarmer@thuban.org (Keith J. Farmer) Date: Mon, 11 Nov 2002 13:07:25 -0800 Subject: [python-win32] Python.Interpreter? Message-ID: <8D9EC381F9E67E44B1A28256698D966B5F5B@nostromo.thuban.org> SW4gbG9va2luZyBmb3Igd2F5cyB0byBhY2Nlc3MgdGhlIGludGVycHJldGVyIGZyb20gLk5FVCwg SSBsb2NhdGVkIHRoaXM6DQogDQpodHRwOi8vZ3JvdXBzLmdvb2dsZS5jb20vZ3JvdXBzP2hsPWVu JmxyPSZpZT1VVEYtOCZzZWxtPXV3dW5tYWh4Yy5mc2YlNDBvbmxpbmUubm8NCiANCkkganVzdCAo cmUpIGluc3RhbGxlZCBBY3RpdmVTdGF0ZSdzIDIuMi4xIGRpc3RyaWJ1dGlvbi4gIEhvd2V2ZXIs IHdoZW4gSSBnbyB0byBhZGQgYSByZWZlcmVuY2UgdG8gYSBDIyBwcm9qZWN0IGluIFZTLk5FVCwg SSBjYW4ndCBsb2NhdGUgYW55IENPTSBvYmplY3QgZm9yIHRoZSBQeXRob24gaW50ZXJwcmV0ZXIu ICBJIGRvbid0IGFjdHVhbGx5IGhhdmUgbXVjaCBleHBlcmllbmNlIHdpdGggQ09NIGl0c2VsZiwg c28gSSBjb3VsZCBiZSBtaXNzaW5nIGEgcG9pbnQuDQogDQpDb21tZW50cz8NCg== From olson@mcs.anl.gov Mon Nov 11 21:07:28 2002 From: olson@mcs.anl.gov (Robert Olson) Date: Mon, 11 Nov 2002 15:07:28 -0600 Subject: [python-win32] Extension and local data on win32 In-Reply-To: Message-ID: <5.1.1.6.2.20021111150417.01e0c260@pop.mcs.anl.gov> At 04:03 PM 11/11/2002 -0500, Jorgensen, Jens wrote: >How interesting. You say that you're linking in the C library into each >.dll. Is your C library a static or shared lib? If it is a static lib then >the problem is apparent: each .dll gets a copy of that C library and thus >its own copy of the static-scoped type objects. Yes, it is a static library (dll version is not supported). >If this is the case then you'll have to restrict creation of these structs >to just one of the .dlls to make this work. Hrm. It's fairly unclear how to make that happen; I suspect I'd have to break the library in two and just link the structure defs by themselves. (ugh). >If the C library is a shared lib (.dll) itself then this is interesting. I >guess this would mean that each time the .dll is loaded the OS makes a new >copy of the data part of the image? I wouldn't think this would be the >case. I don't think Q109619 is what you want since this talks about >sharing data in a .dll among all processes and in your case this is all >within the same process. Ah, right. That'd explain why it didn't work :-). I still hold out some hope that by subtle manipulation of the compiler or runtime we can make this happen without hacking the library ... thanks for the help, --bob From olson@mcs.anl.gov Mon Nov 11 21:14:21 2002 From: olson@mcs.anl.gov (Robert Olson) Date: Mon, 11 Nov 2002 15:14:21 -0600 Subject: [python-win32] Re: Extension and local data on win32 In-Reply-To: <1y5ryhnh.fsf@python.net> References: <5.1.1.6.2.20021111140643.02d90828@pop.mcs.anl.gov> Message-ID: <5.1.1.6.2.20021111151325.02b3e1b8@pop.mcs.anl.gov> At 09:29 PM 11/11/2002 +0100, Thomas Heller wrote: >If I understand your problem correctly, you should change your code >so that this library is only linked into *one* extension. >If you need more than one extension module, you should probably >export some interface to the library from the first extension, >and use this from the other extensions. Hm, I've looked into doing that as well; looks like quite a tedious job, sigh. Can one extension have multiple modules defined in it? (this is swig-generated code). thanks, --bob From Bill Witherspoon" This is a multi-part message in MIME format. ------=_NextPart_000_0026_01C28A30.30CCB2E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have an app that opens a word document, and then modifies/adds text to it. If I use a network copy of the word doc it works fine. In an effort to speed up the program I copied the word doc locally. Now it gives me this error: File">", line 2 in Add pywintypes.com_error:(-2147352567, 'Exception Occurred', (0, 'Microsoft Word', 'This document template doesn't exist., 'c:\\Program Files\\Microsoft Office\\Office\\1033\\wdmain9.chm', 241617, -2146823151), None) I think wdmain9.chm is an old-style help file, not a template. It *does* exist on the local computer. Same behaviour on other computers regardless of Win97, Win2K. Any ideas what's going on? TIA, Bill ------=_NextPart_000_0026_01C28A30.30CCB2E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I have an app that opens a word = document, and=20 then
modifies/adds text to it.
If I use a network copy of the word doc = it works=20 fine.
 
In an effort to speed up the program I = copied the=20 word
doc locally. Now it gives me this=20 error:
 
File"<ComObject<unknown>>", = line 2 in=20 Add
pywintypes.com_error:(-2147352567, = 'Exception=20 Occurred',
(0, 'Microsoft Word', 'This document = template=20 doesn't exist.,
'c:\\Program Files\\Microsoft=20 Office\\Office\\1033\\wdmain9.chm',
241617, -2146823151), = None)
 
I think wdmain9.chm is an old-style = help file, not=20 a template.
It *does* exist on the local computer. = Same=20 behaviour on other
computers regardless of Win97, = Win2K.
 
Any ideas what's going on?
 
TIA,
Bill
------=_NextPart_000_0026_01C28A30.30CCB2E0-- From kfarmer@thuban.org Wed Nov 13 22:30:38 2002 From: kfarmer@thuban.org (Keith J. Farmer) Date: Wed, 13 Nov 2002 14:30:38 -0800 Subject: [python-win32] Exchange 2k Event Sink? Message-ID: <8D9EC381F9E67E44B1A28256698D966B5110@nostromo.thuban.org> This is a multi-part message in MIME format. ------_=_NextPart_001_01C28B64.4A9B9198 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable I know I'm not the first one to try, but if anybody's managed to do it, they've been rather quiet about it.. I've got the following saved as a wsh file: I've used the following to register it: C:\Documents and Settings\Administrator.THUBAN\Desktop>cscript smtpreg.vbs /setprop 1 onarrival SMTPOnArrival Sink ScriptName "C:\Documents and Settings\Administrator.THUBAN\Desktop\ex2k_event_sink.wsh" C:\Documents and Settings\Administrator.THUBAN\Desktop>cscript smtpreg.vbs /add 1 onarrival SMTPOnArrival CDO.SS_SMTPOnArrivalSink "rcpt to=3D*" Despite various manipulations of the script, I get no effect. I've attempted the same with the following vbs script from microsoft, which should have worked, but didn't: Suggestions? =20 ------_=_NextPart_001_01C28B64.4A9B9198 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Message

I know I'm not the first one to try, but if anybody's managed to do = it,=20 they've been rather quiet about it..

I've got the following saved as a wsh file:

<script language=3D"python">
def = ISMTPOnArrival_OnArrival(msg,=20 status):
    fout =3D open("c:\documents and=20 settings\administrator.thuban\desktop\test.txt", = "w")
   =20 fout.write("This is a test\n")
   =20 fout.close()
    status =3D 0
</script>

I've used the following to register it:

C:\Documents and Settings\Administrator.THUBAN\Desktop>cscript = smtpreg.vbs=20 /setprop 1 onarrival SMTPOnArrival Sink ScriptName "C:\Documents and=20 Settings\Administrator.THUBAN\Desktop\ex2k_event_sink.wsh"

C:\Documents and Settings\Administrator.THUBAN\Desktop>cscript = smtpreg.vbs=20 /add 1 onarrival SMTPOnArrival CDO.SS_SMTPOnArrivalSink "rcpt = to=3D*"

Despite various manipulations of the script, I get no effect.  = I've=20 attempted the same with the following vbs script from microsoft, which = should=20 have worked, but didn't:

<script language=3D"vbscript">
Private Sub=20 ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus)
    = Dim fs As=20 New Scripting.FileSystemObject
    Dim file As=20 Scripting.TextStream
    Set file =3D=20 fs.OpenTextFile("c:\documents and=20 settings\administrator.thuban\desktop\test-vb.txt", ForAppending, True=20 )
    file.Write "From: " & Msg.From &=20 "\n"
    file.Write "To: " & Msg.To &=20 "\n"
    file.Write "Subject: " & Msg.Subject = &=20 "\n"& "\n"
    file.Write Msg.TextBody & = "\n"&=20 "\n"
    file.Close
    EventStatus = =3D=20 0
End Sub
</script>

Suggestions?

 

=00 ------_=_NextPart_001_01C28B64.4A9B9198-- From kfarmer@thuban.org Wed Nov 13 22:35:13 2002 From: kfarmer@thuban.org (Keith J. Farmer) Date: Wed, 13 Nov 2002 14:35:13 -0800 Subject: [python-win32] Exchange 2k Event Sink? Message-ID: <8D9EC381F9E67E44B1A28256698D966B5F6D@nostromo.thuban.org> TkI6ICBJIGFjdHVhbGx5IGRpZCBkbyB0aGUgL2FkZCBzdGF0ZW1lbnQgYmVmb3JlIHRoZSAvc2V0 cHJvcA0KDQoJLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0gDQoJRnJvbTogS2VpdGggSi4gRmFy bWVyIA0KCVNlbnQ6IFdlZCAxMS8xMy8yMDAyIDE0OjMwIA0KCQ0KDQoJSSd2ZSB1c2VkIHRoZSBm b2xsb3dpbmcgdG8gcmVnaXN0ZXIgaXQ6DQoNCglDOlxEb2N1bWVudHMgYW5kIFNldHRpbmdzXEFk bWluaXN0cmF0b3IuVEhVQkFOXERlc2t0b3A+Y3NjcmlwdCBzbXRwcmVnLnZicyAvc2V0cHJvcCAx IG9uYXJyaXZhbCBTTVRQT25BcnJpdmFsIFNpbmsgU2NyaXB0TmFtZSAiQzpcRG9jdW1lbnRzIGFu ZCBTZXR0aW5nc1xBZG1pbmlzdHJhdG9yLlRIVUJBTlxEZXNrdG9wXGV4MmtfZXZlbnRfc2luay53 c2giDQoNCglDOlxEb2N1bWVudHMgYW5kIFNldHRpbmdzXEFkbWluaXN0cmF0b3IuVEhVQkFOXERl c2t0b3A+Y3NjcmlwdCBzbXRwcmVnLnZicyAvYWRkIDEgb25hcnJpdmFsIFNNVFBPbkFycml2YWwg Q0RPLlNTX1NNVFBPbkFycml2YWxTaW5rICJyY3B0IHRvPSoiDQoNCg== From chris.johnson@netiq.com Thu Nov 14 17:12:59 2002 From: chris.johnson@netiq.com (Chris Johnson) Date: Thu, 14 Nov 2002 11:12:59 -0600 Subject: [python-win32] access to GetNextDlgTabItem Message-ID: Can win32api access microsoft c++ GetNextDlgTabItem ? I am just learing this stuff ? cj From Pavlos Christoforou" Message-ID: <015501c28bfd$20ba4420$0e01010a@gaaros> Hello everyone ----- Original Message ----- From: "Mark Hammond" To: ; Sent: Friday, November 01, 2002 12:22 AM Subject: RE: [python-win32] Creating an installer for a COM server. > re-registering the COM servers *should* work after changing the location of > these modules. COM object registration puts the full path to > pythoncom22.dll in the registry, so changing the location of this will > require re-registering. It seems that the full path is not installed in the registry. Even if I modified it manually COM objects raise an automation error ('the specified module cannot be found') if accessed from VB but work fine if accessed from python using win32com.client.Dispatch. Basically I could not make COM servers work from VB unless PythonCOM22.dll, python22.dll, and PyWinTypes22.dll exist in the winnt/system32 directory. However I had no problem registering COM servers and using them from python after following your instructions. Thanks Pavlos From jjorgensen@Tallan.com Thu Nov 14 19:22:01 2002 From: jjorgensen@Tallan.com (Jorgensen, Jens) Date: Thu, 14 Nov 2002 14:22:01 -0500 Subject: [python-win32] access to GetNextDlgTabItem Message-ID: SG1tbSwgSSBjYW4ndCBzZWUgaXQgaW4gdGhlcmUuIEkgdHJpZWQ6DQogDQo+Pj4gaW1wb3J0IHdp bjMyZ3VpDQo+Pj4gd2luMzJndWkuR2V0TmV4dERsZ1RhYkl0ZW0NClRyYWNlYmFjayAobW9zdCBy ZWNlbnQgY2FsbCBsYXN0KToNCiAgRmlsZSAiPHN0ZGluPiIsIGxpbmUgMSwgaW4gPw0KQXR0cmli dXRlRXJyb3I6ICdtb2R1bGUnIG9iamVjdCBoYXMgbm8gYXR0cmlidXRlICdHZXROZXh0RGxnVGFi SXRlbScNCg0KYW5kIEkgd291bGQgdGhpbmsgdGhhdCdzIHdoZXJlIGl0IHdvdWxkIGJlLiBQZXJo YXBzIE1hcmsgY2FuIGFkZCBpdCBpbnRvIHRoZSBuZXh0IHJlbGVhc2UuDQogDQoNCgktLS0tLU9y aWdpbmFsIE1lc3NhZ2UtLS0tLSANCglGcm9tOiBDaHJpcyBKb2huc29uIFttYWlsdG86Y2hyaXMu am9obnNvbkBuZXRpcS5jb21dIA0KCVNlbnQ6IFRodSAxMS8xNC8yMDAyIDExOjEyIEFNIA0KCVRv OiBweXRob24td2luMzJAcHl0aG9uLm9yZyANCglDYzogDQoJU3ViamVjdDogW3B5dGhvbi13aW4z Ml0gYWNjZXNzIHRvIEdldE5leHREbGdUYWJJdGVtDQoJDQoJDQoNCglDYW4gd2luMzJhcGkgYWNj ZXNzIG1pY3Jvc29mdCBjKysgR2V0TmV4dERsZ1RhYkl0ZW0gPw0KCQ0KCQ0KCUkgYW0ganVzdCBs ZWFyaW5nIHRoaXMgc3R1ZmYgPw0KCQ0KCWNqDQoJDQoJX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX18NCglQeXRob24td2luMzIgbWFpbGluZyBsaXN0DQoJUHl0 aG9uLXdpbjMyQHB5dGhvbi5vcmcNCglodHRwOi8vbWFpbC5weXRob24ub3JnL21haWxtYW4vbGlz dGluZm8vcHl0aG9uLXdpbjMyDQoJDQoNCg== From chris.johnson@netiq.com Thu Nov 14 19:27:01 2002 From: chris.johnson@netiq.com (Chris Johnson) Date: Thu, 14 Nov 2002 13:27:01 -0600 Subject: [python-win32] access to GetNextDlgTabItem Message-ID: All: I would like to build an app that can automate gui controls similer to segue silk. I would like to use python. In order to do this i need to learn to access methods similer to vc++ GetNextDlgTabItem . These are in the vc++ (Header Declared in Winuser.h, include Windows.h Import library User32.lib) . That is from msdn docs. Or if there is a pure python way to access controls please give me a hint. cj -----Original Message----- From: Jorgensen, Jens [mailto:jjorgensen@Tallan.com] Sent: Thursday, November 14, 2002 1:22 PM To: Chris Johnson; python-win32@python.org Subject: RE: [python-win32] access to GetNextDlgTabItem Hmmm, I can't see it in there. I tried: >>> import win32gui >>> win32gui.GetNextDlgTabItem Traceback (most recent call last): File "", line 1, in ? AttributeError: 'module' object has no attribute 'GetNextDlgTabItem' and I would think that's where it would be. Perhaps Mark can add it into the next release. -----Original Message----- From: Chris Johnson [mailto:chris.johnson@netiq.com] Sent: Thu 11/14/2002 11:12 AM To: python-win32@python.org Cc: Subject: [python-win32] access to GetNextDlgTabItem Can win32api access microsoft c++ GetNextDlgTabItem ? I am just learing this stuff ? cj _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From jjorgensen@Tallan.com Thu Nov 14 20:08:54 2002 From: jjorgensen@Tallan.com (Jorgensen, Jens) Date: Thu, 14 Nov 2002 15:08:54 -0500 Subject: [python-win32] access to GetNextDlgTabItem Message-ID: TW9zdCBvZiB3aW4zMiBpcyBpbiB0aGUgcGFja2FnZSB3aW4zMmV4dGVuc2lvbnMgcGFja2FnZSBh bmQgeW91IGNhbiB1c2UgdGhvc2UganVzdCBhcyB5b3UnZCB1c2UgdGhlIHdpbjMyIGFwaS4gVGhl cmUgbWF5IGJlIHRoaW5ncyBtaXNzaW5nIGhlcmUgYW5kIHRoZXJlLiBJZiB0aGVyZSBhcmUgdGhl biBpbiB0aGUgc2hvcnQgcnVuIHlvdSBjb3VsZCBlYXNpbHkgY3JlYXRlIGFuIGV4dGVuc2lvbiAu ZGxsIGZvciBweXRob24gaW4gYysrICh0aGlzIGlzIHF1aXRlIGVhc3kgYW5kIHRoZSBkb2NzIGFy ZSBhdmFpbGFibGUgaWYgbm90IHRyZW1lbmRvdXNseSBncmVhdCBvbiBkb2luZyB0aGlzKSBhbmQg eW91IGNhbiBhbHNvIG1ha2UgaXQga25vd24gKGFzIHlvdSd2ZSBkb25lKSBhbmQgcGVyaGFwcyBN YXJrIEhhbW1vbmQsIHRoZSBhdXRob3Igb2YgdGhlIHdpbjMyIGV4dGVuc2lvbnMsIHdpbGwgYWRk IGFueXRoaW5nIHlvdSBmaW5kIG1pc3NpbmcgKHRoYXQgc2hvdWxkIGJlIHRoZXJlLCBhbnl3YXkp IGluIHRoZSBuZXh0IHJlbGVhc2UuIEkgYXNzdW1lIHlvdSBoYXZlIGluc3RhbGxlZCBhY3RpdmUg c3RhdGUncyBweXRob24gb3IgaGF2ZSBpbnN0YWxsZWQgcmVndWxhciBweXRob24gZnJvbSB0aGUg c2l0ZSBhbmQgaGF2ZSBpbnN0YWxsZWQgdGhlIHdpbjMyIGV4dGVuc2lvbnMgYWZ0ZXIgdGhhdC4g VGhlIHdpbjMyIGV4dGVuc2lvbnM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CgkgICAgICAgIENhbiB3aW4zMmFwaSBhY2Nlc3MgbWljcm9z b2Z0IGMrKyBHZXROZXh0RGxnVGFiSXRlbSA/DQoJICAgICAgIA0KCSAgICAgICANCgkgICAgICAg IEkgYW0ganVzdCBsZWFyaW5nIHRoaXMgc3R1ZmYgPw0KCSAgICAgICANCgkgICAgICAgIGNqDQoJ ICAgICAgIA0KCSAgICAgICAgX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX18NCgkgICAgICAgIFB5dGhvbi13aW4zMiBtYWlsaW5nIGxpc3QNCgkgICAgICAgIFB5 dGhvbi13aW4zMkBweXRob24ub3JnDQoJICAgICAgICBodHRwOi8vbWFpbC5weXRob24ub3JnL21h aWxtYW4vbGlzdGluZm8vcHl0aG9uLXdpbjMyDQoJICAgICAgIA0KCQ0KCQ0KCV9fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fDQoJUHl0aG9uLXdpbjMyIG1haWxp bmcgbGlzdA0KCVB5dGhvbi13aW4zMkBweXRob24ub3JnDQoJaHR0cDovL21haWwucHl0aG9uLm9y Zy9tYWlsbWFuL2xpc3RpbmZvL3B5dGhvbi13aW4zMg0KCQ0KDQo= From theller@python.net Thu Nov 14 20:40:13 2002 From: theller@python.net (Thomas Heller) Date: 14 Nov 2002 21:40:13 +0100 Subject: [python-win32] Re: access to GetNextDlgTabItem References: Message-ID: "Jorgensen, Jens" writes: [reflowed] > Most of win32 is in the package win32extensions package and you can > use those just as you'd use the win32 api. There may be things > missing here and there. If there are then in the short run you could > easily create an extension .dll for python in c++ (this is quite > easy and the docs are available if not tremendously great on doing > this) and you can also make it known (as you've done) and perhaps > Mark Hammond, the author of the win32 extensions, will add anything > you find missing (that should be there, anyway) in the next > release. I assume you have installed active state's python or have > installed regular python from the site and have installed the win32 > extensions after that. The win32 extensions should let you do > anything you need to do as far as windows goes. The best way to get something included in win32all, as with other open-source software, is to submit a patch to the author. It's not that difficult. Another possibility, or a workaround for the time you have to wait before the new version is then released, is to use Sam Rushing's calldll module to access the function, or the new kid in town, the ctypes module which I recently announced. All of this probably requires certain C programming skills. Thomas From mhammond@skippinet.com.au Thu Nov 14 21:57:25 2002 From: mhammond@skippinet.com.au (Mark Hammond) Date: Fri, 15 Nov 2002 08:57:25 +1100 Subject: [python-win32] Creating an installer for a COM server. In-Reply-To: <015501c28bfd$20ba4420$0e01010a@gaaros> Message-ID: > modified it manually COM objects raise an automation error ('the specified > module cannot be found') if accessed from VB but work fine if > accessed from > python using win32com.client.Dispatch. > > Basically I could not make COM servers work from VB unless > PythonCOM22.dll, > python22.dll, and PyWinTypes22.dll exist in the winnt/system32 directory. I think you will find that the loading of pythoncom22.dll does work - but that it then loading the modules it needs fails. When hosted by something like VB, Python still depends on Windows to load all dependent DLLs - so this generally means these files must be on your path. Mark. From mhammond@skippinet.com.au Fri Nov 15 06:58:00 2002 From: mhammond@skippinet.com.au (Mark Hammond) Date: Fri, 15 Nov 2002 17:58:00 +1100 Subject: [python-win32] access to GetNextDlgTabItem In-Reply-To: Message-ID: I just make the following patch: Index: win32gui.i =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvsroot/PyWin32/win32/src/win32gui.i,v retrieving revision 1.24 diff -r1.24 win32gui.i 1368a1369,1381 > // @pyswig HWND|GetNextDlgTabItem|Retrieves a handle to the first = control that has the WS_TABSTOP style that precedes (or follows) the = specified control. > HWND GetNextDlgTabItem( > HWND hDlg, // @pyparm int|hDlg||handle to dialog box > HWND hCtl, // @pyparm int|hCtl||handle to known control > BOOL bPrevious); // @pyparm int|bPrevious||direction flag > > // @pyswig HWND|GetNextDlgGroupItem|Retrieves a handle to the first = control in a group of controls that precedes (or follows) the specified = control in a dialog box. > HWND GetNextDlgGroupItem( > HWND hDlg, // @pyparm int|hDlg||handle to dialog box > HWND hCtl, // @pyparm int|hCtl||handle to known control > BOOL bPrevious); // @pyparm int|bPrevious||direction flag > > So sometimes when we are lucky it is very easy . > Or if there is a pure python way to access controls please give=20 > me a hint.=20 Use the EnumChildWindows (or EnumWindows, or however it is you do it!) = to walk the top-level child control list, and examine each controls = style yourself. Mark. From heo@propack-data.com Thu Nov 21 14:19:16 2002 From: heo@propack-data.com (heo@propack-data.com) Date: Thu, 21 Nov 2002 15:19:16 +0100 Subject: [python-win32] return of by reference parameters in event handlers works not like expected Message-ID: Hi! somehow I am not able to change by reference parameters in an event handler. I don't think it's a big thing, but I don't see the trick...maybe someo= ne can tell me what's going wrong... Declaration in VB : Private Sub SGGrid1_FetchScrollTip(ByVal bar As sgScrollTip, _ ByVal index As Variant, Width As stdole.OLE_XSIZE_CONTAINER, _ Height As stdole.OLE_YSIZE_CONTAINER, scrollTipText As String, _ Picture As Variant, ByVal tipStyle As IsgStyle) Static lLastRow As Long Static iLastCol As Integer If bar =3D sgScrollTipsVertical Then .... 'create tip text scrollTipText =3D "Row " & .Position & _ " of " & SGGrid1.Rows.Count tipStyle.BackColor =3D vbInfoBackground 'create tool tip border tipStyle.BorderColor =3D tipStyle.BackColor tipStyle.Borders =3D sgCellBorderTop tipStyle.BorderSize =3D _ .Position * (SGGrid1.ClientHeight / SGGrid1.RowCount) ... End With Declaration Python (in the event class:) def OnFetchScrollTip(self, bar, RowColIndex, Width, Height, ScrollTipTe= xt, Picture, TipStyle): # "Fired to retrieve scroll tip size, text, picture and style." ScrollTipText =3D 'test' return bar, RowColIndex, Width, Height, ScrollTipText, Picture, TipSty= le -> The only thing I get i a '-1'. All other "not by ref" event handlers work fine. Maybe someone has an idea?! thanks in advance! --Heiko = From Paul.Moore@atosorigin.com Thu Nov 21 15:00:46 2002 From: Paul.Moore@atosorigin.com (Moore, Paul) Date: Thu, 21 Nov 2002 15:00:46 -0000 Subject: [python-win32] return of by reference parameters in event handlers works not like expected Message-ID: <16E1010E4581B049ABC51D4975CEDB8861994C@UKDCX001.uk.int.atosorigin.com> From: heo@propack-data.com [mailto:heo@propack-data.com] > somehow I am not able to change by reference parameters in an event > handler. >=20 > I don't think it's a big thing, but I don't see the trick...maybe = someone > can tell me what's going wrong... What you do is to return a tuple consisting of the return value, = followed by the value you want to set for any "out" (ByRef) parameters. Here's an example using a simple component (WScriptEx). The Sleep method sleeps, firing OnTick events based on the second parameter - OnTick takes a = ByVal Remaining parameter (how long remaining) and a ByRef WakeUp parameter = (set to True to wake up). The "return 0,1" means to return 0 as the return = value for the event handler, and set WakeUp to 1. You need to return N+1 values, where N is the number of ByRef parameters = - ie, you need to return the ones you *don't* change, not just the ones you = do... Hope this helps, Paul. import win32com.client class wexEvents: def OnBreak(self, *args): wex.WakeUp() def OnWakeUp(self, *args): print "WakeUp", `args` def OnTick(self, Remaining, WakeUp): print "Tick...", Remaining, `WakeUp` if Remaining < 8000: return 0, 1 wex =3D win32com.client.DispatchWithEvents("WshToolbox.WScriptEx", = wexEvents) wex.Sleep(10000,1000) From heo@propack-data.com Thu Nov 21 20:19:36 2002 From: heo@propack-data.com (heo@propack-data.com) Date: Thu, 21 Nov 2002 21:19:36 +0100 Subject: [python-win32] return of by reference parameters in event handlers works not like expected Message-ID: that's it! Thanks for your help! Heiko On 11/21/2002 04:00:46 PM Moore, Paul wrote: .... = From jlawhead@bellsouth.net Sat Nov 23 22:23:40 2002 From: jlawhead@bellsouth.net (Joel Lawhead) Date: Sat, 23 Nov 2002 16:23:40 -0600 Subject: [python-win32] Eject a CD with win32file? Message-ID: <3DDFFFEC.B80DB04F@bellsouth.net> Hi, I'm trying to programatically eject a cd on a Win2k machine in Python. I found a simple working example in C with source and an executable at: . Based on that program and some research on MSDN it appears the steps for ejecting a CD-ROM are to first get a file handle for the device using win32file.CreateFile and then call win32file.DeviceIoControl() with the IOCTL_STORAGE_EJECT_MEDIA flag. I tried: import win32file from win32con import * # Get a file handle for the CD-ROM device hdevice = win32file.CreateFile('\\\\.\\G:', 0, 0,None,OPEN_EXISTING,0,0) # Eject the cd win32file.DeviceIoControl(hdevice,2,"", 0, None) The win32file.CreateFile() returns without error. But the win32file.DeviceIoControl() call returns: Traceback (most recent call last): File "", line 1, in ? pywintypes.api_error: (1, 'DeviceIoControl', 'Incorrect function.') The second parameter in DeviceIoControl is an integer but I don't know what it is and have been guessing with several numbers to no avail. All the documentation simply refers to the constant "IOCTL_STORAGE_EJECT_MEDIA" and not an integer. So I'm not sure if that call is my problem or if it's something else. To get the job done of course I could always make an os.system() call to the command line "eject.exe" program I mentioned above, but I feel like I'm pretty close to doing it with Python and the win32 extenstions. I don't have a lot of experience working with windows mfc calls so any help would be appreciated. Thanks, Joel From Paul.Moore@atosorigin.com Mon Nov 25 09:23:24 2002 From: Paul.Moore@atosorigin.com (Moore, Paul) Date: Mon, 25 Nov 2002 09:23:24 -0000 Subject: [python-win32] Eject a CD with win32file? Message-ID: <16E1010E4581B049ABC51D4975CEDB885E2E0D@UKDCX001.uk.int.atosorigin.com> I use this: import sys import win32file from win32con import * drive =3D sys.argv[1] if len(drive) !=3D 2 or drive[1] !=3D ':': print >>sys.stderr, "Invalid drive letter", drive sys.exit(1) h =3D win32file.CreateFile(r'\\.\\' + drive, GENERIC_READ, = FILE_SHARE_READ, None, OPEN_EXISTING, 0, 0) n =3D win32file.DeviceIoControl(h,0x002d4808, "", 0) win32file.CloseHandle(h) My magic 0x002d4808 is IOCTL_STORAGE_EJECT_MEDIA. I got it from the = Visual C Headers. If you don't have Visual C, the same constants are in the = Mingw win32 API library. It's a shame the values of these constants aren't documented in MSDN. I think the rest of the differences between my code and yours are = security- related - I don't know if any of them are important. Paul. -----Original Message----- From: Joel Lawhead [mailto:jlawhead@bellsouth.net] Sent: 23 November 2002 22:24 To: python-win32@python.org Subject: [python-win32] Eject a CD with win32file? Hi, I'm trying to programatically eject a cd on a Win2k machine in Python.=20 I found a simple working example in C with source and an executable at: . Based on that program and some research on MSDN it appears the steps for ejecting a CD-ROM are to first get a file handle for the device using win32file.CreateFile and then call win32file.DeviceIoControl() with the IOCTL_STORAGE_EJECT_MEDIA flag. I tried: import win32file from win32con import * # Get a file handle for the CD-ROM device hdevice =3D win32file.CreateFile('\\\\.\\G:', 0, = 0,None,OPEN_EXISTING,0,0) # Eject the cd win32file.DeviceIoControl(hdevice,2,"", 0, None) The win32file.CreateFile() returns without error. But the win32file.DeviceIoControl() call returns: Traceback (most recent call last): File "", line 1, in ? pywintypes.api_error: (1, 'DeviceIoControl', 'Incorrect function.') The second parameter in DeviceIoControl is an integer but I don't know what it is and have been guessing with several numbers to no avail. All the documentation simply refers to the constant "IOCTL_STORAGE_EJECT_MEDIA" and not an integer. So I'm not sure if that call is my problem or if it's something else. To get the job done of course I could always make an os.system() call to the command line "eject.exe" program I mentioned above, but I feel like I'm pretty close to doing it with Python and the win32 extenstions.=20 I don't have a lot of experience working with windows mfc calls so any help would be appreciated. Thanks, Joel _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32 From jeff@ccvcorp.com Mon Nov 25 17:56:08 2002 From: jeff@ccvcorp.com (Jeff Shannon) Date: Mon, 25 Nov 2002 09:56:08 -0800 Subject: [python-win32] Eject a CD with win32file? References: <20021124170007.17637.92261.Mailman@mail.python.org> Message-ID: <3DE26438.C0339414@ccvcorp.com> > From: Joel Lawhead > > Hi, > I'm trying to programatically eject a cd on a Win2k machine in Python. [...] > The second parameter in DeviceIoControl is an integer but I don't know > what it is and have been guessing with several numbers to no avail. All > the documentation simply refers to the constant > "IOCTL_STORAGE_EJECT_MEDIA" and not an integer. So I'm not sure if that > call is my problem or if it's something else. Look for the win32con module, which defines (almost) all of the constants in the Win32 API. You should be able to use win32con.IOCTL_STORAGE_EJECT_MEDIA as your parameter. (Warning -- I haven't verified that this constant is defined there, but this is the general format that works for most Win32 constants.) Jeff Shannon Technician/Programmer Credit International From Paul.Moore@atosorigin.com Tue Nov 26 09:31:53 2002 From: Paul.Moore@atosorigin.com (Moore, Paul) Date: Tue, 26 Nov 2002 09:31:53 -0000 Subject: [python-win32] Eject a CD with win32file? Message-ID: <16E1010E4581B049ABC51D4975CEDB885E2E20@UKDCX001.uk.int.atosorigin.com> From: Jeff Shannon [mailto:jeff@ccvcorp.com] > Look for the win32con module, which defines (almost) all of the = constants in > the Win32 API. You should be able to use = win32con.IOCTL_STORAGE_EJECT_MEDIA > as your parameter. (Warning -- I haven't verified that this constant = is > defined there, but this is the general format that works for most = Win32 > constants.) It isn't there. Paul. From mvmisha@yahoo.com Thu Nov 28 00:13:47 2002 From: mvmisha@yahoo.com (Misha Verplak) Date: Thu, 28 Nov 2002 00:13:47 -0000 Subject: [python-win32] Eject a CD with win32file? References: <16E1010E4581B049ABC51D4975CEDB885E2E20@UKDCX001.uk.int.atosorigin.com> Message-ID: <003401c29673$1803c1a0$02a8b5ac@grunt> From: Moore, Paul >>From: Jeff Shannon [mailto:jeff@ccvcorp.com] >> Look for the win32con module, which defines (almost) all of the constants in >> the Win32 API. You should be able to use win32con.IOCTL_STORAGE_EJECT_MEDIA >> as your parameter. (Warning -- I haven't verified that this constant is >> defined there, but this is the general format that works for most Win32 >> constants.) >It isn't there. On my machine it evaluates to 2967560. To quote bits from winioctl.h: (for gcc) #define CTL_CODE(t,f,m,a) (((t)<<16)|((a)<<14)|((f)<<2)|(m)) #define FILE_DEVICE_MASS_STORAGE 45 #define METHOD_BUFFERED 0 #define FILE_READ_ACCESS 1 #define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE #define IOCTL_STORAGE_EJECT_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS) --Misha