From christiaanvanzyl at gmail.com Tue Aug 12 13:28:00 2014 From: christiaanvanzyl at gmail.com (Christiaan B v Zyl) Date: Tue, 12 Aug 2014 13:28:00 +0200 Subject: [python-win32] Using COM DLL Message-ID: I have a DLL, it is an SDK for the Pastel Partner accounting system. Using Dependency Walker I can see that the DLL has the following methods: DllRegisterServer, DllUnregisterServer, DllGetClassObject With the library there came a sample VB program that referenced the DLL and instantiated it like this: Dim SDK As New PasSDK.PastelPartnerSDK The only way I've been able to use this library from python is to register it with Windows: regsvr32 PasSDK.dll And then use it in python like this: import win32com.client sdk = win32com.client.Dispatch(PasSDK.PastelPartnerSDK") sdk.SetLicense(...) etc... However, is there a way to use this library directly without registering it first? Something like: from ctypes import * sdk = cdll.LoadLibrary('PasSDK.dll') When I do this I can see that sdk.DllGetClassObject is a function, but how do I instantiate it like the VB program, is it possible? -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Wed Aug 13 08:00:32 2014 From: timr at probo.com (Tim Roberts) Date: Tue, 12 Aug 2014 23:00:32 -0700 Subject: [python-win32] Using COM DLL In-Reply-To: References: Message-ID: <1C39475F-D77C-4E89-86A4-3C69C63D63AF@probo.com> On Aug 12, 2014, at 4:28 AM, Christiaan B v Zyl > wrote: I have a DLL, it is an SDK for the Pastel Partner accounting system. Using Dependency Walker I can see that the DLL has the following methods: DllRegisterServer, DllUnregisterServer, DllGetClassObject With the library there came a sample VB program that referenced the DLL and instantiated it like this: Dim SDK As New PasSDK.PastelPartnerSDK The only way I've been able to use this library from python is to register it with Windows: regsvr32 PasSDK.dll And then use it in python like this: import win32com.client sdk = win32com.client.Dispatch(PasSDK.PastelPartnerSDK") sdk.SetLicense(...) etc... However, is there a way to use this library directly without registering it first? Something like: from ctypes import * sdk = cdll.LoadLibrary('PasSDK.dll') When I do this I can see that sdk.DllGetClassObject is a function, but how do I instantiate it like the VB program, is it possible? Are you saying that the VB program works correctly without registering the DLL first? COM servers are always accessed through the registry. The only way the operating system know where to look for the DLL is by looking in the registry. From the ?PasSDK.PastelPartnerSDK? class name, it finds the COM class GUID. From the GUID, it finds the path to the DLL. Now, regsvr32 does nothing except load the DLL and call DllRegisterServer. So, you could, in fact, do this: sdk = cdll.LoadLibrary(?PasSDK.dll?) sdk.DllRegisterServer() and then call Dispatch. I?m not sure this is any better than, for example: os.system(?regsvr32 passdk.dll?) -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From christiaanvanzyl at gmail.com Wed Aug 13 18:47:39 2014 From: christiaanvanzyl at gmail.com (Christiaan B v Zyl) Date: Wed, 13 Aug 2014 18:47:39 +0200 Subject: [python-win32] Using COM DLL Message-ID: > > > Are you saying that the VB program works correctly without registering the > DLL first? > You have to reference the DLL from the VB project. > Now, regsvr32 does nothing except load the DLL and call DllRegisterServer. > So, you could, in fact, do this: > sdk = cdll.LoadLibrary(?PasSDK.dll?) > sdk.DllRegisterServer() > > After doing this, when I then call Dispatch it fails with: "Invalid class string" And os.system("regsvr32...") probably won't work on later versions of Windows if the script is not running with administrative privileges. Guess I will have to be content with running regsvr32 as administrator as part of the installation procedure for my script. -------------- next part -------------- An HTML attachment was scrubbed... URL: From alumnifkekk at utem.edu.my Fri Aug 15 05:37:31 2014 From: alumnifkekk at utem.edu.my (ALUMNI FKEKK UTeM) Date: Fri, 15 Aug 2014 03:37:31 +0000 Subject: [python-win32] CFP - ADVCIT-APPEIC-REEGETECH 2014 in Bandung, Indonesia on 29 - 31 December 2014 In-Reply-To: <1408070084717.87294@utem.edu.my> References: , <1403144238266.11609@utem.edu.my>, <1406068476373.76143@utem.edu.my>, <1406072404407.4357@utem.edu.my>, <1406072915116.29631@utem.edu.my>, <1406083363531.1941@utem.edu.my>, <1406083990206.62511@utem.edu.my>, <1406084752716.73984@utem.edu.my>, <1406088144767.86430@utem.edu.my>, <1406089839822.1597@utem.edu.my>, <1406090018551.37000@utem.edu.my>, <1406090781284.7964@utem.edu.my>, <1407221268255.27442@utem.edu.my>, <1407221509176.28756@utem.edu.my>, <1407221829284.32088@utem.edu.my>, <1407222367097.99000@utem.edu.my>, <1407227560254.83562@utem.edu.my>, <1407228362578.66135@utem.edu.my>, <1407308763327.28493@utem.edu.my>, <1407309052769.68036@utem.edu.my>, <1407309196346.67702@utem.edu.my>, <1407309320212.56699@utem.edu.my>, <1407309641801.90193@utem.edu.my>, <1407310181369.16644@utem.edu.my>, <1407310421860.76648@utem.edu.my>, <1407310950634.86640@utem.edu.my>, <1407312149923.22280@utem.edu.my>, <1407312930349.58341@utem.edu.my>, <1407313110874 .38993@utem.edu.my>, <1407313431525.33443@utem.edu.my>, <1407313775999.17204@utem.edu.my>, <1408032104917.84979@utem.edu.my>, <1408067659869.31094@utem.edu.my>, <1408067824010.11158@utem.edu.my>, <1408067934346.6512@utem.edu.my>, <1408069119726.97837@utem.edu.my>, <1408069284727.47979@utem.edu.my>, <1408069651608.991@utem.edu.my>, <1408069836914.49133@utem.edu.my>, <1408070084717.87294@utem.edu.my> Message-ID: <1408073845310.12622@utem.edu.my> ? ???**************************************************************************************************** Apologize if you receive multiple copies of this message. Please disseminate this CFP to your colleague & contact. ========================================================================== Call for Papers Advancement in Information Technology International Conference International Conference on Applied Electromagnetics Renewable Energy and Green Technology International Conference 29th - 31st December 2014, Bandung, Indonesia Universiti Malaysia Perlis, UNIMAP is pleased to announce that it will be hosting Triple Conferences: 1) Advancement in Information Technology International Conference (Theme: Towards Innovation in Information Technology) a. All Accepted Paper will be published in Lecture Notes in Computer Science (SCOPUS and ISI) selected papers will be published in ARPN Journal of Engineering and Applied Sciences with Scopus indexed. b. EDAS link of submission: http://edas.info/N18293 2) International Conference on Applied Electromagnetics (Theme: Nurturing Applied Electromagnetics for Human Technology) a. All Accepted Paper will be published in Lecture Notes in Electrical Engineering (SCOPUS and ISI) selected papers will be published in ARPN Journal of Engineering and Applied Sciences with Scopus indexed. b. EDAS link of submission: http://edas.info/N18295 3) Renewable Energy and Green Technology International Conference (Theme: The Seeds of Our Future - Renewable Energy and Green Technology) a. All accepted papers will be published in International Journal of Applied Engineering Research (IJAER) with Scopus indexed. b. EDAS link of submission: http://edas.info/N18297 ? on 29th - 31st December 2014 in Bandung, Indonesia. This international level conference its aim to be more specific in the development and cutting-edge technology related to Information Technology. The conference provide a platform where researchers, professionals, academicians and industries to share and generate forum of the latest Information Technology. It will include keynote addresses, oral presentation of contributed papers, tutorial sessions and exhibition of products and devices from selected industries related. Important Dates:- Full paper submission deadlines 30th July 2014? 30th August 2014 Acceptance notification >From 1st September 2014 Final registration 15th September 2014 Final paper submission deadline 30th September 2014 Conference Dates 29th - 31st December 2014 Looking forward to your support, participation & contribution in our conferences! See you in Bandung, Indonesia!!! Warm Regards, Conference Chair 2014 Advancement in Information Technology International Conference (ADVCIT) Conference Website : http://advcit.com || Email: info at advcit.com 2014 International Conference on Applied Electromagnetics (APPEIC) Conference Website : http://appeic.com || Email: info at appeic.com 2014 Renewable Energy and Green Technology International Conference (REEGETECH) Conference Website : http://reegetech.com || Email: info at reegetech.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg.ewing at canterbury.ac.nz Tue Aug 19 00:39:51 2014 From: greg.ewing at canterbury.ac.nz (Gregory Ewing) Date: Tue, 19 Aug 2014 10:39:51 +1200 Subject: [python-win32] Pythoncom IEnum weird behaviour Message-ID: <53F280B7.7060100@canterbury.ac.nz> I have a COM server implemented in Python. I've created the following object implementing IEnum to automatically wrap the sequence elements in PyIDispatch objects: from win32com.server.util import ListEnumerator class Iterator(ListEnumerator): def Next(self, count): items = ListEnumerator.Next(self, count) print "Server.Iterator: items =", items result = map(autowrap, items) print "Server.Iterator: result =", result return result where autowrap() is a function that uses various strategies to wrap different types of objects. When I try to iterate over one of these, I get this: Server.Iterator: items = [] Server.Iterator: result = [] PyGEnumVariant::Next got a bad return value Traceback (most recent call last): File "F:\AFICom\AFICom2\Tests\test_nesting.py", line 14, in for leg in legs: File "E:\Python27\lib\site-packages\win32com\client\util.py", line 84, in next return _get_good_object_(self._iter_.next(), resultCLSID = self.resultCLSID) TypeError: Cant convert vectors! I don't understand what's happening here. The "Next got a bad return value" message seems to be coming from PyGEnumVARIANT::Next in PyGEnumVariant.cpp. The only ways to get there seem to be if your Next() method doesn't return a sequence, or getting its length fails, or getting an item from it fails. But as far as I can tell, I'm returning a perfectly good list object, so I can't see how any of those things can happen. I also don't know why I'm not getting the COMError exception set by that branch of the code: error: PyErr_Clear(); // just in case PyCom_LogF("PyGEnumVariant::Next got a bad return value"); Py_DECREF(result); return PyCom_SetCOMErrorFromSimple(E_FAIL, IID_IEnumVARIANT, "Next() did not return a sequence of objects"); The "Cant convert vectors" message is puzzling as well. That comes from the following piece of code in PyCom_PyObjectFromVariant in oleargs.cpp: /* ### note: we shouldn't see this, it is illegal in a VARIANT */ if (V_ISVECTOR(var)) { return OleSetTypeError(_T("Cant convert vectors!")); } Anyone have any idea what's happening? Is there something wrong with my Next() method? Is there a bug in the win32com C++ code? -- Greg This email may be confidential and subject to legal privilege, it may not reflect the views of the University of Canterbury, and it is not guaranteed to be virus free. If you are not an intended recipient, please notify the sender immediately and erase all copies of the message and any attachments. Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more information. From cappy2112 at gmail.com Sat Aug 23 05:17:38 2014 From: cappy2112 at gmail.com (Tony Cappellini) Date: Fri, 22 Aug 2014 20:17:38 -0700 Subject: [python-win32] Help with starting new processes Message-ID: Hello, I'm running Python 2.7.6 on 32-Bit Windows7 Pro. (Python 3 isn't an option at the moment) I have a parent python script which spawns two subprocesses- where each subprocess is running in a new console window. I want to watch each process running. This is why I've explicitly used creationflags=CREATE_NEW_CONSOLE in the subprocess.Popen() call. (Oddly enough, CREATE_NEW_CONSOLE is a Windows-specific flag.) The subprocesses are running a simple CLI program which are monitoring some embedded devices being tested. I don't want to use a GUI for them. Here is the code for the parent script http://pastebin.com/mNNCH1vY Ideally, I'd like the parent script to pass some information via a queue, to each subprocess. The queues have nice functionality which would allow the receiving process to work until the queue is empty, and then wait until it is no longer empty. I don't see a way to use pass a queue using the subprocess module, nor do I see a way to create a new console using the multiprocessing module. Multiprocessing makes it quite easy to pass a queue to the subprocesses. I've spent a lot of time with the documentation for both modules, but they are of no help for this particular issue. Is there a happy medium between these two modules that will help me get what I want? Thanks Tony -------------- next part -------------- An HTML attachment was scrubbed... URL: From farnworthpatrick at gmail.com Mon Aug 25 14:52:56 2014 From: farnworthpatrick at gmail.com (farnworthpatrick at gmail.com) Date: Mon, 25 Aug 2014 12:52:56 +0000 Subject: [python-win32] =?utf-8?q?PyWin32?= Message-ID: Hi, I want to use PyWin32 to make the system think a keyboard key is being pressed. I don?t know very much about WIn32 at all and nor have I been able to find out how to use the modules so any help would be really appreciated. Thanks, Patrick Farnworth -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Tue Aug 26 19:05:09 2014 From: timr at probo.com (Tim Roberts) Date: Tue, 26 Aug 2014 10:05:09 -0700 Subject: [python-win32] PyWin32 In-Reply-To: References: Message-ID: <53FCBE45.9030701@probo.com> farnworthpatrick at gmail.com wrote: > > I want to use PyWin32 to make the system think a keyboard key is being > pressed. I don?t know very much about WIn32 at all and nor have I been > able to find out how to use the modules so any help would be really > appreciated. There is a SendKeys module available in the PyPI library, although it's still for Python 2, and the download link isn't currently responding: https://pypi.python.org/pypi/SendKeys/0.3 The API you use for this is called SendInput. Here is a code snippet for Python 3 that uses the SendInput API to do this: http://stackoverflow.com/questions/1823762/sendkeys-for-python-3-1-on-windows -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: