From jh_wang2004 at 163.com Tue Jul 1 13:45:42 2014 From: jh_wang2004 at 163.com (jh_wang2004) Date: Tue, 01 Jul 2014 19:45:42 +0800 Subject: [python-win32] python-win32 Digest, Vol 135, Issue 13 Message-ID: <1404215141194.ei3ahsnfcx2clvddvynqjcmk@android.mail.163.com> Hi Tim: ? ? Thanks a lot for you reply. According to the COM document , the function declaration in C++ is ? ?lRet = object.ReadDeviceBlock(szDevice?lSize?*lplData) ? ? ? ?Long lRet ?(return value, 0 is read success, otherwise is read failed) ? Output ? ? ? ?CString szDevice (Device register name) ?Input ? ? ? Long lSize (Read data counter) Input ? ? ? Long *lplData (restore read value from device) Output and Visual Basic .NET is ? ?IRet = object.ReadDeviceBlock(szDevice?iSize?iData(0)) ? ? ? ?Integer ? IRet ? (return value) ? Output ? ? ? ?String ? szDevice ? (Device register name) ? Input ? ? ? ?Integer ? iSize (Read data counter) ?Input ? ? ? ?Integer ? iData(n) (Read value from device) ?Output The COM is provided by device vender, this fuction read a group(block) of data from device and wrire those data to a array. The number of data read from device is second parameter. those data will be restored to a array which first element is the third parameter, ?it's a long int pointer. I run the demo program(C++ and VB), those all write data to the array successfully. For read single data from device, the COM provide another function: ? ?lRet = object.GetDeviceValue(szDevice, *lplData) ? ? ? ?Long lRet ?(return value) ? Output ? ? ? ?CString szDevice (Device register name) ?Input ? ? ? Long *lplData (restore read value from device) Out -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Tue Jul 1 18:49:57 2014 From: timr at probo.com (Tim Roberts) Date: Tue, 1 Jul 2014 09:49:57 -0700 Subject: [python-win32] How to pass "out" parameter to win32com In-Reply-To: <1404205966458.5jskqbmokdptknumxsjhqcmz@android.mail.163.com> References: <1404205966458.5jskqbmokdptknumxsjhqcmz@android.mail.163.com> Message-ID: <53B2E6B5.8090207@probo.com> jh_wang2004 wrote: > ------------------------------------------------------------------------------------------------------ > > Hi Tim: > Thanks a lot for you reply. According to the COM document , the > function declaration in > C++ is > lRet = object.ReadDeviceBlock(szDevice?lSize?*lplData) > Long lRet (return value, 0 is read success, otherwise is read > failed) Output > CString szDevice (Device register name) Input > Long lSize (Read data counter) Input > Long *lplData (restore read value from device) Output That's not a function declaration. That's an example call of how to call it. This doesn't show how the parameters are actually declared. For example, you cannot have a CString as a COM parameter. It's not allowed. A program might pass a CString, but it will be converted to a COM string type, based on the declaration. Too many people do not understand that there are strict rules for declaring COM parameters, to make sure they work in all of the various languages that can refer to COM. Even without seeing the actual declaration, I can tell you that this API violates those rules. You can't pass a raw pointer, because some languages can't deal with raw pointers. Plus, there's no way for the called function to know how large that buffer is. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From kf7xm at yahoo.com Mon Jul 14 21:32:27 2014 From: kf7xm at yahoo.com (Vern Cole) Date: Mon, 14 Jul 2014 12:32:27 -0700 Subject: [python-win32] Fw: [adodbapi:feature-requests] #8 Use of Win32Com Cache In-Reply-To: <53c4172824b0d9467ce617e3.feature-requests@adodbapi.p.sourceforge.net> References: <53c4172824b0d9467ce617e3.feature-requests@adodbapi.p.sourceforge.net> Message-ID: <1405366347.68585.YahooMailNeo@web141101.mail.bf1.yahoo.com> Dear Gurus (you know who you are): I got this request on the adodbapi package site today. ?It seems like a reasonable request to me, but since I don't really understand what it does, I don't know whether it could cause some terrible problems somehow. Is it a good patch, or not? -- Vernon On Monday, July 14, 2014 6:45 PM, George wrote: ________________________________ [feature-requests:#8] Use of Win32Com Cache Status: open Group: Next_Release_(example) Created: Mon Jul 14, 2014 05:45 PM UTC by George Last Updated: Mon Jul 14, 2014 05:45 PM UTC Owner: nobody Could there be a way to specify that you want to use EnsureDispatch (and hence pre-build the Com scripts)? I've modified adodbapi.py to... def Dispatch(dispatch): win32com.client.gencache.is_readonly = False return win32com.client.gencache.EnsureDispatch(dispatch) And this has resolved problems I was having with dynamic.py from win32com taking up a lot of resources. The program I'm building uses thousands of short queries so the overhead really adds up. ________________________________ Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/adodbapi/feature-requests/8/ To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From anisliyana107 at gmail.com Thu Jul 17 10:19:07 2014 From: anisliyana107 at gmail.com (Anis Liyana) Date: Thu, 17 Jul 2014 16:19:07 +0800 Subject: [python-win32] Python scripting with Active Directory Message-ID: Hello, Would appreciate any help regarding my problem. Problem: I am currently on a project for back up server with python script. The project is actually arise from problem whereby when I need to back up my server (Windows Server 2003), I usually use Robocopy but, when I copy the folders from server 1 to server 2, it doesn't copy the user and group access as well. Thus, I need to manually configure the users and groups permission for each of the folders. I decided to try Python scripting as part of the solution but I'm novice with Python and windows active directory as well. I'm not sure how to copy the users and groups in active directory. I browse through the website and found python-win32, I would like to try it, but since I'm not familiar so I'm not sure how to get it done. So far, I only able to code the Python scripting on copying the folders. I hope that I can proceed with users permission as well. I am hoping for you knowledge & experienced and greatly appreciate any help. Thanks. Regards, Anis. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at timgolden.me.uk Thu Jul 17 10:47:45 2014 From: mail at timgolden.me.uk (Tim Golden) Date: Thu, 17 Jul 2014 09:47:45 +0100 Subject: [python-win32] Python scripting with Active Directory In-Reply-To: References: Message-ID: <53C78DB1.706@timgolden.me.uk> On 17/07/2014 09:19, Anis Liyana wrote: > I am currently on a project for back up server with python script. > The project is actually arise from problem whereby when I need to back > up my server (Windows Server 2003), I usually use Robocopy but, when I > copy the folders from server 1 to server 2, it doesn't copy the user and > group access as well. Thus, I need to manually configure the users and > groups permission for each of the folders. I decided to try Python > scripting as part of the solution but I'm novice with Python and windows > active directory as well. I'm not sure how to copy the users and groups > in active directory. > > I browse through the website and found python-win32, I would like to try > it, but since I'm not familiar so I'm not sure how to get it done. So > far, I only able to code the Python scripting on copying the folders. I > hope that I can proceed with users permission as well. I hesitate to say this but: are you sure that you want to be reinventing this particular wheel in Python? I can certainly point you towards information and tools (admittedly, most of them on my own website). But you say that you're new to Python and to Windows security. If this is just to hone your skills and see how it works, fine. But if you were trying to do this for professional purposes I'd be inclined to look for an existing solution. Anyhow, if you're still keen, I suggest you look at: http://timgolden.me.uk/python/win32_how_do_i/add-security-to-a-file.html and https://github.com/tjguk/winsys http://winsys.readthedocs.org/en/latest/index.html TJG From nawijn at gmail.com Thu Jul 17 18:05:08 2014 From: nawijn at gmail.com (Marco Nawijn) Date: Thu, 17 Jul 2014 18:05:08 +0200 Subject: [python-win32] Problem passing array by reference Message-ID: Dear All, I am facing a problem passing an array by reference. It is exactly the same problem as described in this thread: https://mail.python.org/pipermail/python-win32/2002-November/000562.html In short, I have a valid reference to a Position object. This object has two methods, GetComponents and SetComponents that each take a CATSafeArrayVariant as an argument. This CATSafeArrayVariant should in this case be a one-dimensional array of real values. A CATSafeArrayVariant is a typedef for a CATVariant which itself is (exactly copied from the documentation) "typedef any CATVariant". I tried the obvious ways of passing standard python tuples and lists of size 12. The calls itself succeed, however the values are never updated. I also tried the new VARIANT object with different type specifiers, but I always get the error message: TypeError: Objects for SAFEARRAYS must be sequences (of sequences), or a buffer object I do not have access to either the IDL description or sourcecode for the call. In addition, I cannot find the Get/SetComponent methods when I run makepy. All in all, not the best situation. It is a little frustrating, because I have 95% of the functionality I need up and running in Python instead of VBA. This way it perfectly fits in the rest of the code I have, so if I can avoid switching to VBA, it would be great. By the way, the call works fine in VBA. Does anybody have an idea on how to solve this? Kind regards, Marco -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Jul 17 19:36:32 2014 From: timr at probo.com (Tim Roberts) Date: Thu, 17 Jul 2014 10:36:32 -0700 Subject: [python-win32] Problem passing array by reference In-Reply-To: References: Message-ID: <53C809A0.3070802@probo.com> Marco Nawijn wrote: > > I am facing a problem passing an array by reference. It is exactly the > same problem as described in this thread: > > https://mail.python.org/pipermail/python-win32/2002-November/000562.html > > In short, I have a valid reference to a Position object. This object > has two methods, > GetComponents and SetComponents that each take a CATSafeArrayVariant as > an argument. This CATSafeArrayVariant should in this case be a > one-dimensional > array of real values. If these are declared correctly in their type library, then the array should be an output value, and Python's machinery knows how to handle that. So: hr, bfr = obj.GetComponents() hr = obj.SetComponents(bfr) -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From timr at probo.com Thu Jul 17 19:39:10 2014 From: timr at probo.com (Tim Roberts) Date: Thu, 17 Jul 2014 10:39:10 -0700 Subject: [python-win32] Python scripting with Active Directory In-Reply-To: References: Message-ID: <53C80A3E.3050703@probo.com> Anis Liyana wrote: > Hello, > Would appreciate any help regarding my problem. > > Problem: > I am currently on a project for back up server with python script. > The project is actually arise from problem whereby when I need to back > up my server (Windows Server 2003), I usually use Robocopy but, when I > copy the folders from server 1 to server 2, it doesn't copy the user > and group access as well. Thus, I need to manually configure the users > and groups permission for each of the folders. Are you not aware that robocopy has a /sec flag that tells it to copy the ACLs? In fact, for doing backups, you probably want the /copyall option, which also copies the owner and auditing information. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nawijn at gmail.com Thu Jul 17 20:36:31 2014 From: nawijn at gmail.com (Marco Nawijn) Date: Thu, 17 Jul 2014 20:36:31 +0200 Subject: [python-win32] Problem passing array by reference In-Reply-To: <53C809A0.3070802@probo.com> References: <53C809A0.3070802@probo.com> Message-ID: Hi Tim, Your answer implies that they are not declared correctly, because the parameter is really required. It throws an exception with "invalid number of parameters" if you leave it out. If the type is somehow not declared correctly, is there a workaround? Marco On Thu, Jul 17, 2014 at 7:36 PM, Tim Roberts wrote: > Marco Nawijn wrote: > > > > I am facing a problem passing an array by reference. It is exactly the > > same problem as described in this thread: > > > > https://mail.python.org/pipermail/python-win32/2002-November/000562.html > > > > In short, I have a valid reference to a Position object. This object > > has two methods, > > GetComponents and SetComponents that each take a CATSafeArrayVariant as > > an argument. This CATSafeArrayVariant should in this case be a > > one-dimensional > > array of real values. > > If these are declared correctly in their type library, then the array > should be an output value, and Python's machinery knows how to handle > that. So: > > hr, bfr = obj.GetComponents() > hr = obj.SetComponents(bfr) > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Jul 17 21:26:49 2014 From: timr at probo.com (Tim Roberts) Date: Thu, 17 Jul 2014 12:26:49 -0700 Subject: [python-win32] Problem passing array by reference In-Reply-To: References: <53C809A0.3070802@probo.com> Message-ID: <53C82379.7090409@probo.com> Marco Nawijn wrote: > > Your answer implies that they are not declared correctly, because the > parameter is really required. It throws an exception with "invalid > number of parameters" if you leave it out. Many people write their COM objects so that they work from C++ without giving a rip about the rules that allow them to play nicely with other languages. Do you get one return value, or two? Perhaps they have written it so it looks like an in/out parameter. If so, the modified array would be the second return value. > If the type is somehow not declared correctly, is there a workaround? An EASY workaround? No. With the comtypes package, you can force Python to call almost any interface that can be designed by the perverted mind, but it's not automatic. It means you have to write accurate declarations for all of the methods yourself. There are good examples on the interwebs, but if you don't have good documentation to begin with, it will be painful. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From nawijn at gmail.com Thu Jul 17 21:56:19 2014 From: nawijn at gmail.com (Marco Nawijn) Date: Thu, 17 Jul 2014 21:56:19 +0200 Subject: [python-win32] Problem passing array by reference In-Reply-To: <53C82379.7090409@probo.com> References: <53C809A0.3070802@probo.com> <53C82379.7090409@probo.com> Message-ID: Ok. Another clue (slightly blushing that I didn't notice this before..). I focus on the Position.GetComponents(...) for the moment. Recall that this should set the orientation (9 values) and the position (3 values) by means of an array passed in by reference. To my surprise, it returns the same numbers as I put in. So, the following is happening in the terminal: >>> l = range(12) >>> res = p1.Position.GetComponents(l) >>> print res (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) The values though are incorrect, I also tried with floats, but the result is the same. I get back an exact copy of what I put in. Regarding the workaround, can I mix comtypes and win32com? So, can I only (try) to use comtypes to let this call succeed? All other calls I have tried work flawlessly with win32com. Thanks for the effort! Much appreciated. On Thu, Jul 17, 2014 at 9:26 PM, Tim Roberts wrote: > Marco Nawijn wrote: > > > > Your answer implies that they are not declared correctly, because the > > parameter is really required. It throws an exception with "invalid > > number of parameters" if you leave it out. > > Many people write their COM objects so that they work from C++ without > giving a rip about the rules that allow them to play nicely with other > languages. > > Do you get one return value, or two? Perhaps they have written it so it > looks like an in/out parameter. If so, the modified array would be the > second return value. > > > > If the type is somehow not declared correctly, is there a workaround? > > An EASY workaround? No. With the comtypes package, you can force > Python to call almost any interface that can be designed by the > perverted mind, but it's not automatic. It means you have to write > accurate declarations for all of the methods yourself. There are good > examples on the interwebs, but if you don't have good documentation to > begin with, it will be painful. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Jul 17 22:22:49 2014 From: timr at probo.com (Tim Roberts) Date: Thu, 17 Jul 2014 13:22:49 -0700 Subject: [python-win32] Problem passing array by reference In-Reply-To: References: <53C809A0.3070802@probo.com> <53C82379.7090409@probo.com> Message-ID: <53C83099.9060608@probo.com> Marco Nawijn wrote: > Ok. Another clue (slightly blushing that I didn't notice this before..). > I focus on the Position.GetComponents(...) for the moment. > Recall that this should set the orientation (9 values) and the > position (3 values) by means of an array passed in by reference. > > To my surprise, it returns the same numbers as I put in. So, the > following is happening in the terminal: > >>> l = range(12) > >>> res = p1.Position.GetComponents(l) > >>> print res > (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) > > The values though are incorrect, I also tried with floats, but the > result is the same. I get back an exact copy of what I put in. That's too bad. That should have been able to work. > Regarding the workaround, can I mix comtypes and win32com? > So, can I only (try) to use comtypes to let this call succeed? > All other calls I have tried work flawlessly with win32com. I'm not sure I can give you a definitive answer. There is a fair amount of overlap between them. You do see sample code on the web that mixes the two, but you're talking about passing an interface between them, and that seems awkward. You probably have experimentation ahead of you. I don't know how extensive is the code you've already done. Comtypes can do everything Pythoncom can do; you may find that it is not that hard to convert, especially if you have a TLB. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From nawijn at gmail.com Thu Jul 17 22:51:45 2014 From: nawijn at gmail.com (Marco Nawijn) Date: Thu, 17 Jul 2014 22:51:45 +0200 Subject: [python-win32] Problem passing array by reference In-Reply-To: <53C83099.9060608@probo.com> References: <53C809A0.3070802@probo.com> <53C82379.7090409@probo.com> <53C83099.9060608@probo.com> Message-ID: Hi Tim, Ok. I will give it a try and report back. I did a quick search and found the TLB files. Never worked with them though, but I will take a look. Marco On Thu, Jul 17, 2014 at 10:22 PM, Tim Roberts wrote: > Marco Nawijn wrote: > > Ok. Another clue (slightly blushing that I didn't notice this before..). > > I focus on the Position.GetComponents(...) for the moment. > > Recall that this should set the orientation (9 values) and the > > position (3 values) by means of an array passed in by reference. > > > > To my surprise, it returns the same numbers as I put in. So, the > > following is happening in the terminal: > > >>> l = range(12) > > >>> res = p1.Position.GetComponents(l) > > >>> print res > > (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) > > > > The values though are incorrect, I also tried with floats, but the > > result is the same. I get back an exact copy of what I put in. > > That's too bad. That should have been able to work. > > > > Regarding the workaround, can I mix comtypes and win32com? > > So, can I only (try) to use comtypes to let this call succeed? > > All other calls I have tried work flawlessly with win32com. > > I'm not sure I can give you a definitive answer. There is a fair amount > of overlap between them. You do see sample code on the web that mixes > the two, but you're talking about passing an interface between them, and > that seems awkward. You probably have experimentation ahead of you. > > I don't know how extensive is the code you've already done. Comtypes > can do everything Pythoncom can do; you may find that it is not that > hard to convert, especially if you have a TLB. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nawijn at gmail.com Fri Jul 18 11:24:12 2014 From: nawijn at gmail.com (Marco Nawijn) Date: Fri, 18 Jul 2014 11:24:12 +0200 Subject: [python-win32] Problem passing array by reference In-Reply-To: References: <53C809A0.3070802@probo.com> <53C82379.7090409@probo.com> <53C83099.9060608@probo.com> Message-ID: An update on where I am at the moment. I managed to find the library that holds the definition for the GetComponents call. When I run makepy on this library I get: def GetComponents(self, oAxisComponentsArray=defaultNamedNotOptArg): return self._ApplyTypes_(1611005953, 1, (24, 0), ((8204, 3),), u'GetComponents', None,oAxisComponentsArray) The problem is that early binding does not work anymore once I have run makepy on this library (I have no idea why). It seems I end up in Python with objects that are too high in the type hierarchy. Let me explain. In order to get to the Position object that holds the calls I need to get the so-called PartDocument. This PartDocument adds two properties which don't exist on its parent (Document). When I use early binding before I used makepy on the library that contains the interface description of the GetComponents call everything is fine (except of course that the GetComponents call does nothing). If I run makepy and to the same, I get back a Document which does not have the property I need to get to the Position object. I also tried to use comtypes. The first step is to run GetModule(..) on the typelibrary. The result I get is as follows: class Position(Move): _case_insensitive_ = True _iid_ = GUID('{50884DF4-9405-11D1-A5E2-00A0C95AF74C}') _idlflags_ = ['dual', 'oleautomation'] Position._methods_ = [ COMMETHOD([dispid(1611005952)], HRESULT, 'SetComponents', ( ['in'], _midlSAFEARRAY(VARIANT), 'iAxisComponentsArray' )), COMMETHOD([dispid(1611005953)], HRESULT, 'GetComponents', ( ['in', 'out'], _midlSAFEARRAY(VARIANT), 'oAxisComponentsArray' )), ] ################################################################ ## code template for Position implementation ##class Position_Impl(object): ## def SetComponents(self, iAxisComponentsArray): ## '-no docstring-' ## #return ## ## def GetComponents(self): ## '-no docstring-' ## #return oAxisComponentsArray ## Recipients._methods_ = [ COMMETHOD([dispid(1610940416)], HRESULT, 'Add', ( ['in'], POINTER(BSTR), 'iRecipient' )), COMMETHOD([dispid(1610940417)], HRESULT, 'RemoveAll'), ] Afterwards I tried to interact with it as follows: >>> from comtypes.client import CreateObject >>> app = CreateObject('Catia.Application') >>> app.Visible = True >>> # I then interactively open a document in the application >>> p1 = app.Documents.Item(2) >>> p1 So again, I get the "wrong" document type. If I do the same but using late binding (by providing the "dynamic=True" parameter) I get the following: >>> p1 So I am stuck in a kind of "chicken or egg" problem. I cannot use the makepy/GetModules generated code, because it does not allow me to use early binding. If I use late binding, the calls I am interested (Get/Set Components) do not work. What might be an option is to figure out the proper definition of VARIANT that gets accepted by the GetComponents call. So after a long post I come to the following question: Based on the information provided above generated by makepy and GetModule(..) can you decipher what the corresponding VARIANT should look like? Marco On Thu, Jul 17, 2014 at 10:51 PM, Marco Nawijn wrote: > Hi Tim, > > Ok. I will give it a try and report back. I did a quick search and > found the TLB files. Never worked with them though, but I will > take a look. > > Marco > > > On Thu, Jul 17, 2014 at 10:22 PM, Tim Roberts wrote: > >> Marco Nawijn wrote: >> > Ok. Another clue (slightly blushing that I didn't notice this before..). >> > I focus on the Position.GetComponents(...) for the moment. >> > Recall that this should set the orientation (9 values) and the >> > position (3 values) by means of an array passed in by reference. >> > >> > To my surprise, it returns the same numbers as I put in. So, the >> > following is happening in the terminal: >> > >>> l = range(12) >> > >>> res = p1.Position.GetComponents(l) >> > >>> print res >> > (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) >> > >> > The values though are incorrect, I also tried with floats, but the >> > result is the same. I get back an exact copy of what I put in. >> >> That's too bad. That should have been able to work. >> >> >> > Regarding the workaround, can I mix comtypes and win32com? >> > So, can I only (try) to use comtypes to let this call succeed? >> > All other calls I have tried work flawlessly with win32com. >> >> I'm not sure I can give you a definitive answer. There is a fair amount >> of overlap between them. You do see sample code on the web that mixes >> the two, but you're talking about passing an interface between them, and >> that seems awkward. You probably have experimentation ahead of you. >> >> I don't know how extensive is the code you've already done. Comtypes >> can do everything Pythoncom can do; you may find that it is not that >> hard to convert, especially if you have a TLB. >> >> -- >> Tim Roberts, timr at probo.com >> Providenza & Boekelheide, Inc. >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> https://mail.python.org/mailman/listinfo/python-win32 >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Fri Jul 18 18:26:34 2014 From: timr at probo.com (Tim Roberts) Date: Fri, 18 Jul 2014 09:26:34 -0700 Subject: [python-win32] Problem passing array by reference In-Reply-To: References: <53C809A0.3070802@probo.com> <53C82379.7090409@probo.com> <53C83099.9060608@probo.com> Message-ID: <53C94ABA.1020103@probo.com> Marco Nawijn wrote: > An update on where I am at the moment. I managed to find the library that > holds the definition for the GetComponents call. When I run makepy on > this library I get: > > def GetComponents(self, oAxisComponentsArray=defaultNamedNotOptArg): > return self._ApplyTypes_(1611005953, 1, (24, 0), ((8204, 3),), > u'GetComponents', None,oAxisComponentsArray) For what it's worth, the (24,0) means the function returns "void", and (8204,3) means the parameter is an IN/OUT parameter that is an array of variants. Given that, I'm a little confused as to why your original test -- where you passed the list of 12 items -- didn't work. As an experiment, you could try changing that to say (8204,11), which means "in/out and this is the return value", but I'm not hopeful. We may need to get Mark Hammond involved in this. He has more in-the-trenches experience here than anyone. > Afterwards I tried to interact with it as follows: > > >>> from comtypes.client import CreateObject > >>> app = CreateObject('Catia.Application') > >>> app.Visible = True > >>> # I then interactively open a document in the application > >>> p1 = app.Documents.Item(2) > >>> p1 > > > So again, I get the "wrong" document type. If I do the same > but using late binding (by providing the "dynamic=True" > parameter) I get the following: > >>> p1 > Have you tried calling GetComponents with this object? This is a late-bound object, which means it fetches the names of the methods and properties on the fly. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nawijn at gmail.com Fri Jul 18 19:28:25 2014 From: nawijn at gmail.com (Marco Nawijn) Date: Fri, 18 Jul 2014 19:28:25 +0200 Subject: [python-win32] Problem passing array by reference In-Reply-To: <53C94ABA.1020103@probo.com> References: <53C809A0.3070802@probo.com> <53C82379.7090409@probo.com> <53C83099.9060608@probo.com> <53C94ABA.1020103@probo.com> Message-ID: <20140718192825.158e8965@mars> On Fri, 18 Jul 2014 09:26:34 -0700 Tim Roberts wrote: > Marco Nawijn wrote: > > An update on where I am at the moment. I managed to find the > > library that holds the definition for the GetComponents call. When > > I run makepy on this library I get: > > > > def GetComponents(self, oAxisComponentsArray=defaultNamedNotOptArg): > > return self._ApplyTypes_(1611005953, 1, (24, 0), ((8204, 3),), > > u'GetComponents', None,oAxisComponentsArray) > > For what it's worth, the (24,0) means the function returns "void", and > (8204,3) means the parameter is an IN/OUT parameter that is an array > of variants. > > Given that, I'm a little confused as to why your original test -- > where you passed the list of 12 items -- didn't work. As an > experiment, you could try changing that to say (8204,11), which means > "in/out and this is the return value", but I'm not hopeful. > > We may need to get Mark Hammond involved in this. He has more > in-the-trenches experience here than anyone. > > > > > Afterwards I tried to interact with it as follows: > > > > >>> from comtypes.client import CreateObject > > >>> app = CreateObject('Catia.Application') > > >>> app.Visible = True > > >>> # I then interactively open a document in the application > > >>> p1 = app.Documents.Item(2) > > >>> p1 > > > > > > So again, I get the "wrong" document type. If I do the same > > but using late binding (by providing the "dynamic=True" > > parameter) I get the following: > > >>> p1 > > > > Have you tried calling GetComponents with this object? This is a > late-bound object, which means it fetches the names of the methods and > properties on the fly. > From nawijn at gmail.com Fri Jul 18 21:17:11 2014 From: nawijn at gmail.com (Marco Nawijn) Date: Fri, 18 Jul 2014 21:17:11 +0200 Subject: [python-win32] Problem passing array by reference In-Reply-To: <20140718192825.158e8965@mars> References: <53C809A0.3070802@probo.com> <53C82379.7090409@probo.com> <53C83099.9060608@probo.com> <53C94ABA.1020103@probo.com> <20140718192825.158e8965@mars> Message-ID: Dear all, Sorry for the noise on the list. Epic fail of my freshly configured mail client. Marco On Fri, Jul 18, 2014 at 7:28 PM, Marco Nawijn wrote: > On Fri, 18 Jul 2014 09:26:34 -0700 > Tim Roberts wrote: > > > Marco Nawijn wrote: > > > An update on where I am at the moment. I managed to find the > > > library that holds the definition for the GetComponents call. When > > > I run makepy on this library I get: > > > > > > def GetComponents(self, oAxisComponentsArray=defaultNamedNotOptArg): > > > return self._ApplyTypes_(1611005953, 1, (24, 0), ((8204, 3),), > > > u'GetComponents', None,oAxisComponentsArray) > > > > For what it's worth, the (24,0) means the function returns "void", and > > (8204,3) means the parameter is an IN/OUT parameter that is an array > > of variants. > > > > Given that, I'm a little confused as to why your original test -- > > where you passed the list of 12 items -- didn't work. As an > > experiment, you could try changing that to say (8204,11), which means > > "in/out and this is the return value", but I'm not hopeful. > > > > We may need to get Mark Hammond involved in this. He has more > > in-the-trenches experience here than anyone. > > > > > > > > > Afterwards I tried to interact with it as follows: > > > > > > >>> from comtypes.client import CreateObject > > > >>> app = CreateObject('Catia.Application') > > > >>> app.Visible = True > > > >>> # I then interactively open a document in the application > > > >>> p1 = app.Documents.Item(2) > > > >>> p1 > > > > > > > > > So again, I get the "wrong" document type. If I do the same > > > but using late binding (by providing the "dynamic=True" > > > parameter) I get the following: > > > >>> p1 > > > > > > > Have you tried calling GetComponents with this object? This is a > > late-bound object, which means it fetches the names of the methods and > > properties on the fly. > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pfraser at spatialmedia.com Sat Jul 19 03:02:26 2014 From: pfraser at spatialmedia.com (Peter Fraser) Date: Sat, 19 Jul 2014 13:02:26 +1200 Subject: [python-win32] PythonWin on linux under wine Message-ID: <53C9C3A2.1070104@spatialmedia.com> I have tried and failed to like another Python IDE -including the $$ ones. They all feel like they have 'static language envy'. PythonWin does the best job of being an IDE for a *dynamic* language IMO (largely due to the cunning 'psuedo-shell', and also dynamic lookup for 'completion' etc). SO I find myself installing PythonWin under Wine -although it feels like a somewhat unnatural act. 1. A small fix (in case someone else tries it). ====================================== The install on Wine goes fine (Specifically: Python 2.7.8 win32 from msi installer, and then pywin32-219.win32-py2.7.exe -on Mint 17 both x64 and 32 bit machines) -but when launching PythonWin I get an error: unsupported operand type(s) for |: 'int' and 'NoneType' ..at line 91 of keycodes.py (which lives in c:/Python27/Lib/site-packages/pythonwin/pywin/scintilla) My fix was simply to edit keycodes.py and change: from return vk, flags | this_flags to return vk, flags | (this_flags or 0) I was too lazy to work out why vk, this_flags = get_vk(toks[-1]) returns None in the second item. If someone wanted to make this change (or a better one) the PythonWin IDE would at least start under Wine. 2. A workaround ================ I can't seem to enable the debugging toolbar *but* if I (try to) check it,*and restart* -it is there. 3. Does anyone have any other warnings/fixes/'run away' advice etc? ========================================================= Is PythonWin under wine a known bad plan? A world of pain for serious development, perhaps? Any wisdom appreciated.. Pete From anisliyana107 at gmail.com Mon Jul 21 03:59:26 2014 From: anisliyana107 at gmail.com (Anis Liyana) Date: Mon, 21 Jul 2014 09:59:26 +0800 Subject: [python-win32] python-win32 Digest, Vol 136, Issue 6 In-Reply-To: References: Message-ID: Hello, Would appreciate any help regarding my problem. Problem: I am currently on a project for back up server with python script. The project is actually arise from problem whereby when I need to back up my server (Windows Server 2003), I usually use Robocopy but, when I copy the folders from server 1 to server 2, it doesn't copy the user and group access as well. Thus, I need to manually configure the users and groups permission for each of the folders. I decided to try Python scripting as part of the solution but I'm novice with Python and windows active directory as well. I'm not sure how to copy the users and groups in active directory. I browse through the website and found python-win32, I would like to try it, but since I'm not familiar so I'm not sure how to get it done. So far, I only able to code the Python scripting on copying the folders. I hope that I can proceed with users permission as well. I am hoping for you knowledge & experienced and greatly appreciate any help. Thanks. Hi, regarding the problem, I have try various Robocopy command with security but it doesn't work as what I wanted. I have found this website https://zakird.com/pyad/pyad.html but I'm not really sure how should I code it since I'm not really familiar. What I would like to do is basically like this: - connect to AD - create AD object that holds the users and groups - the object will loop through the list of users and groups in AD - it will copy the users and groups permission. I hope that anyone can help me. Thanks. On Sat, Jul 19, 2014 at 10:06 AM, wrote: > Send python-win32 mailing list submissions to > python-win32 at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/python-win32 > or, via email, send a message with subject or body 'help' to > python-win32-request at python.org > > You can reach the person managing the list at > python-win32-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of python-win32 digest..." > > > Today's Topics: > > 1. Re: Problem passing array by reference (Tim Roberts) > 2. Re: Problem passing array by reference (Marco Nawijn) > 3. Re: Problem passing array by reference (Marco Nawijn) > 4. PythonWin on linux under wine (Peter Fraser) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Fri, 18 Jul 2014 09:26:34 -0700 > From: Tim Roberts > To: "python-win32 at python.org" > Subject: Re: [python-win32] Problem passing array by reference > Message-ID: <53C94ABA.1020103 at probo.com> > Content-Type: text/plain; charset="utf-8" > > Marco Nawijn wrote: > > An update on where I am at the moment. I managed to find the library that > > holds the definition for the GetComponents call. When I run makepy on > > this library I get: > > > > def GetComponents(self, oAxisComponentsArray=defaultNamedNotOptArg): > > return self._ApplyTypes_(1611005953, 1, (24, 0), ((8204, 3),), > > u'GetComponents', None,oAxisComponentsArray) > > For what it's worth, the (24,0) means the function returns "void", and > (8204,3) means the parameter is an IN/OUT parameter that is an array of > variants. > > Given that, I'm a little confused as to why your original test -- where > you passed the list of 12 items -- didn't work. As an experiment, you > could try changing that to say (8204,11), which means "in/out and this > is the return value", but I'm not hopeful. > > We may need to get Mark Hammond involved in this. He has more > in-the-trenches experience here than anyone. > > > > > Afterwards I tried to interact with it as follows: > > > > >>> from comtypes.client import CreateObject > > >>> app = CreateObject('Catia.Application') > > >>> app.Visible = True > > >>> # I then interactively open a document in the application > > >>> p1 = app.Documents.Item(2) > > >>> p1 > > > > > > So again, I get the "wrong" document type. If I do the same > > but using late binding (by providing the "dynamic=True" > > parameter) I get the following: > > >>> p1 > > > > Have you tried calling GetComponents with this object? This is a > late-bound object, which means it fetches the names of the methods and > properties on the fly. > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/python-win32/attachments/20140718/17055f87/attachment-0001.html > > > > ------------------------------ > > Message: 2 > Date: Fri, 18 Jul 2014 19:28:25 +0200 > From: Marco Nawijn > To: Tim Roberts , Tim Roberts ; > python-win32 at python.org > Cc: "python-win32 at python.org" > Subject: Re: [python-win32] Problem passing array by reference > Message-ID: <20140718192825.158e8965 at mars> > Content-Type: text/plain; charset=US-ASCII > > On Fri, 18 Jul 2014 09:26:34 -0700 > Tim Roberts wrote: > > > Marco Nawijn wrote: > > > An update on where I am at the moment. I managed to find the > > > library that holds the definition for the GetComponents call. When > > > I run makepy on this library I get: > > > > > > def GetComponents(self, oAxisComponentsArray=defaultNamedNotOptArg): > > > return self._ApplyTypes_(1611005953, 1, (24, 0), ((8204, 3),), > > > u'GetComponents', None,oAxisComponentsArray) > > > > For what it's worth, the (24,0) means the function returns "void", and > > (8204,3) means the parameter is an IN/OUT parameter that is an array > > of variants. > > > > Given that, I'm a little confused as to why your original test -- > > where you passed the list of 12 items -- didn't work. As an > > experiment, you could try changing that to say (8204,11), which means > > "in/out and this is the return value", but I'm not hopeful. > > > > We may need to get Mark Hammond involved in this. He has more > > in-the-trenches experience here than anyone. > > > > > > > > > Afterwards I tried to interact with it as follows: > > > > > > >>> from comtypes.client import CreateObject > > > >>> app = CreateObject('Catia.Application') > > > >>> app.Visible = True > > > >>> # I then interactively open a document in the application > > > >>> p1 = app.Documents.Item(2) > > > >>> p1 > > > > > > > > > So again, I get the "wrong" document type. If I do the same > > > but using late binding (by providing the "dynamic=True" > > > parameter) I get the following: > > > >>> p1 > > > > > > > Have you tried calling GetComponents with this object? This is a > > late-bound object, which means it fetches the names of the methods and > > properties on the fly. > > > > > > ------------------------------ > > Message: 3 > Date: Fri, 18 Jul 2014 21:17:11 +0200 > From: Marco Nawijn > To: Tim Roberts , "python-win32 at python.org" > > Subject: Re: [python-win32] Problem passing array by reference > Message-ID: > DZYPR1beWNViFnir5iV9i2-hmpKXB3HYhjs7f2n2cKA at mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > Dear all, > > Sorry for the noise on the list. Epic fail of my freshly configured mail > client. > > Marco > > > On Fri, Jul 18, 2014 at 7:28 PM, Marco Nawijn wrote: > > > On Fri, 18 Jul 2014 09:26:34 -0700 > > Tim Roberts wrote: > > > > > Marco Nawijn wrote: > > > > An update on where I am at the moment. I managed to find the > > > > library that holds the definition for the GetComponents call. When > > > > I run makepy on this library I get: > > > > > > > > def GetComponents(self, oAxisComponentsArray=defaultNamedNotOptArg): > > > > return self._ApplyTypes_(1611005953, 1, (24, 0), ((8204, 3),), > > > > u'GetComponents', None,oAxisComponentsArray) > > > > > > For what it's worth, the (24,0) means the function returns "void", and > > > (8204,3) means the parameter is an IN/OUT parameter that is an array > > > of variants. > > > > > > Given that, I'm a little confused as to why your original test -- > > > where you passed the list of 12 items -- didn't work. As an > > > experiment, you could try changing that to say (8204,11), which means > > > "in/out and this is the return value", but I'm not hopeful. > > > > > > We may need to get Mark Hammond involved in this. He has more > > > in-the-trenches experience here than anyone. > > > > > > > > > > > > > Afterwards I tried to interact with it as follows: > > > > > > > > >>> from comtypes.client import CreateObject > > > > >>> app = CreateObject('Catia.Application') > > > > >>> app.Visible = True > > > > >>> # I then interactively open a document in the application > > > > >>> p1 = app.Documents.Item(2) > > > > >>> p1 > > > > > > > > > > > > So again, I get the "wrong" document type. If I do the same > > > > but using late binding (by providing the "dynamic=True" > > > > parameter) I get the following: > > > > >>> p1 > > > > > > > > > > Have you tried calling GetComponents with this object? This is a > > > late-bound object, which means it fetches the names of the methods and > > > properties on the fly. > > > > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/python-win32/attachments/20140718/b9b807d8/attachment-0001.html > > > > ------------------------------ > > Message: 4 > Date: Sat, 19 Jul 2014 13:02:26 +1200 > From: Peter Fraser > To: python-win32 at python.org > Subject: [python-win32] PythonWin on linux under wine > Message-ID: <53C9C3A2.1070104 at spatialmedia.com> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > I have tried and failed to like another Python IDE -including the $$ ones. > > They all feel like they have 'static language envy'. > > PythonWin does the best job of being an IDE for a *dynamic* language > IMO (largely due to the cunning 'psuedo-shell', and also dynamic lookup > for 'completion' etc). > > SO > > I find myself installing PythonWin under Wine -although it feels > like a somewhat unnatural act. > > > > 1. A small fix (in case someone else tries it). > ====================================== > > The install on Wine goes fine (Specifically: Python 2.7.8 win32 from > msi installer, and then pywin32-219.win32-py2.7.exe -on Mint 17 both > x64 and 32 bit machines) > > -but when launching PythonWin I get an error: > > unsupported operand type(s) for |: 'int' and 'NoneType' > > ..at line 91 of keycodes.py (which lives in > c:/Python27/Lib/site-packages/pythonwin/pywin/scintilla) > > My fix was simply to edit keycodes.py and change: > > from > > return vk, flags | this_flags > > to > > return vk, flags | (this_flags or 0) > > I was too lazy to work out why vk, this_flags = get_vk(toks[-1]) returns > None in the second item. > > If someone wanted to make this change (or a better one) the PythonWin > IDE would at least start under Wine. > > > > 2. A workaround > ================ > I can't seem to enable the debugging toolbar *but* if I (try to) check > it,*and restart* -it is there. > > > > 3. Does anyone have any other warnings/fixes/'run away' advice etc? > ========================================================= > > Is PythonWin under wine a known bad plan? A world of pain for serious > development, perhaps? Any wisdom appreciated.. > > > > Pete > > > > > > > > > > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > > > ------------------------------ > > End of python-win32 Digest, Vol 136, Issue 6 > ******************************************** > -- Anis Liyana Abdul Rahman Bachelor (Hons) Information Communication & Technology Universiti Teknologi PETRONAS, Bandar Seri Iskandar, 31750 Tronoh, Perak Darul Ridzuan, Malaysia. -------------- next part -------------- An HTML attachment was scrubbed... URL: From joss at jossgray.net Thu Jul 24 17:06:10 2014 From: joss at jossgray.net (Joss Gray) Date: Thu, 24 Jul 2014 16:06:10 +0100 Subject: [python-win32] Building PyWin32 with visual studio 2013 and Windows 8.1 Message-ID: Has anybody successfully built pywin32 with Visual Studio 2013 ( v120 toolkit ) and using the windows 8.1 sdk? -------------- next part -------------- An HTML attachment was scrubbed... URL: From joss at jossgray.net Thu Jul 24 18:38:09 2014 From: joss at jossgray.net (Joss Gray) Date: Thu, 24 Jul 2014 17:38:09 +0100 Subject: [python-win32] Building PyWin32 with visual studio 2013 and Windows 8.1 In-Reply-To: References: Message-ID: I managed to build it minus lots of modules, that luckily i'm not using. On Thu, Jul 24, 2014 at 5:10 PM, Zachary Ware wrote: > On Thu, Jul 24, 2014 at 10:06 AM, Joss Gray wrote: > > Has anybody successfully built pywin32 with Visual Studio 2013 ( v120 > > toolkit ) and using the windows 8.1 sdk? > > I haven't tried, but I wouldn't expect useful results unless you're > also compiling Python yourself (which does not yet officially support > anything newer than VS 2010). > > -- > Zach > -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Jul 24 18:42:39 2014 From: timr at probo.com (Tim Roberts) Date: Thu, 24 Jul 2014 09:42:39 -0700 Subject: [python-win32] Building PyWin32 with visual studio 2013 and Windows 8.1 In-Reply-To: References: Message-ID: <53D1377F.3060304@probo.com> Joss Gray wrote: > I managed to build it minus lots of modules, that luckily i'm not using. Don't ignore Zach's comment. Unless you have also built Python itself with VS2013 (which is unlikely), you are just asking for trouble. You are mixing two different versions of the C runtime library. You will be allocating objects in one version of the CRT and freeing them in another. In might work some of the time, but you are going to have inexplicable errors. > On Thu, Jul 24, 2014 at 5:10 PM, Zachary Ware > > > wrote: > > On Thu, Jul 24, 2014 at 10:06 AM, Joss Gray > wrote: > > Has anybody successfully built pywin32 with Visual Studio 2013 ( > v120 > > toolkit ) and using the windows 8.1 sdk? > > I haven't tried, but I wouldn't expect useful results unless you're > also compiling Python yourself (which does not yet officially support > anything newer than VS 2010). > > -- > Zach > > -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zachary.ware+pydev at gmail.com Thu Jul 24 18:10:31 2014 From: zachary.ware+pydev at gmail.com (Zachary Ware) Date: Thu, 24 Jul 2014 11:10:31 -0500 Subject: [python-win32] Building PyWin32 with visual studio 2013 and Windows 8.1 In-Reply-To: References: Message-ID: On Thu, Jul 24, 2014 at 10:06 AM, Joss Gray wrote: > Has anybody successfully built pywin32 with Visual Studio 2013 ( v120 > toolkit ) and using the windows 8.1 sdk? I haven't tried, but I wouldn't expect useful results unless you're also compiling Python yourself (which does not yet officially support anything newer than VS 2010). -- Zach From joss at jossgray.net Thu Jul 24 19:08:49 2014 From: joss at jossgray.net (Joss Gray) Date: Thu, 24 Jul 2014 18:08:49 +0100 Subject: [python-win32] Building PyWin32 with visual studio 2013 and Windows 8.1 In-Reply-To: <53D1377F.3060304@probo.com> References: <53D1377F.3060304@probo.com> Message-ID: <4245E781-4490-4737-9121-FD282BE2E7A7@jossgray.net> Yeah we've built Python 2.7.8 in vs2013 already. It wasn't fun. > On 24 Jul 2014, at 17:42, Tim Roberts wrote: > > Joss Gray wrote: >> I managed to build it minus lots of modules, that luckily i'm not using. > > Don't ignore Zach's comment. Unless you have also built Python itself with VS2013 (which is unlikely), you are just asking for trouble. You are mixing two different versions of the C runtime library. You will be allocating objects in one version of the CRT and freeing them in another. In might work some of the time, but you are going to have inexplicable errors. > > > > >>> On Thu, Jul 24, 2014 at 5:10 PM, Zachary Ware wrote: >>> On Thu, Jul 24, 2014 at 10:06 AM, Joss Gray wrote: >>> > Has anybody successfully built pywin32 with Visual Studio 2013 ( v120 >>> > toolkit ) and using the windows 8.1 sdk? >>> >>> I haven't tried, but I wouldn't expect useful results unless you're >>> also compiling Python yourself (which does not yet officially support >>> anything newer than VS 2010). >>> >>> -- >>> Zach > > -- > Tim Roberts, timr at probo.com > Providenza & Boekelheide, Inc. > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From xuqingsz at gmail.com Mon Jul 28 21:58:28 2014 From: xuqingsz at gmail.com (Qing Xu) Date: Mon, 28 Jul 2014 14:58:28 -0500 Subject: [python-win32] Excel Paste Special Error Message-ID: Hi All Original code: import win32com.client import win32clipboard from win32com.client import Dispatch ws_fc_ipn.PasteSpecial(Paste=-4163) Wanted copy and paste special (paste value) to selection. Gave me "Type Error: PasteSpecial() got an unexpected keyword argument 'Paste' " If anyone knows where the mistake is that would be great! -- Qing -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Mon Jul 28 23:45:06 2014 From: timr at probo.com (Tim Roberts) Date: Mon, 28 Jul 2014 14:45:06 -0700 Subject: [python-win32] Excel Paste Special Error In-Reply-To: References: Message-ID: <53D6C462.8060308@probo.com> Qing Xu wrote: > Hi All > > Original code: > > import win32com.client > import win32clipboard > from win32com.client import Dispatch > > ws_fc_ipn.PasteSpecial(Paste=-4163) It would be better to use the symbolic names, like win32com.client.constants.xlPasteValues. Or: from win32com.client import constants ws_fc_ipn.PasteSpecial(constants.xlPasteValues) > Wanted copy and paste special (paste value) to selection. Gave me > > "Type Error: PasteSpecial() got an unexpected keyword argument 'Paste' " > > If anyone knows where the mistake is that would be great! Named parameters should work, although you can always fall back to positional parameters, like what I have above. What version of Python and Python-Win32 are you using? -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: