From kb at sparklight.com Wed Nov 4 18:22:46 2015 From: kb at sparklight.com (Ken Brooks) Date: Wed, 4 Nov 2015 15:22:46 -0800 Subject: [python-win32] Building my own C extension Message-ID: I have joined this list because I need to learn how to rebuild my antiquated Python extension properly for Windows. I need to build for Python 2.7, which is old and relies upon old compilers. I downloaded the suggested compiler: http://download.microsoft.com/download/A/5/4/A54BADB6-9C3F-478D-8657-93B3FC9FE62D/vcsetup.exe I downloaded the thing that is supposed to correctly glue it to Python: https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi But I can't see where to go from there. In my old world I never actually learned how to use distutils or setuptools; I was just building my extension with my VC and then shoving it into site-packages. As I read the documentation for distutils and setuptools, I am SO LOST! I see much about how to install someone else's package, but little about how to create and script my own package for building a Python extension written in C. Please, can someone point me to a good sample extension package that I can copy from? A "hello world" or something? Apart from that, can someone please point me to the documentation for the current "right" way of building things, as an extension developer? Thanks in advance, Ken -------------- next part -------------- An HTML attachment was scrubbed... URL: From zturner at google.com Wed Nov 4 20:33:39 2015 From: zturner at google.com (Zachary Turner) Date: Thu, 05 Nov 2015 01:33:39 +0000 Subject: [python-win32] Building my own C extension In-Reply-To: References: Message-ID: Two questions: 1) Are you embedding this extension in your own application or do you only need to be able to load it into a stock Python distribution? 2) Is Python 3.5 out of the question? On Wed, Nov 4, 2015 at 5:10 PM Ken Brooks wrote: > I have joined this list because I need to learn how to rebuild my > antiquated Python extension properly for Windows. I need to build for > Python 2.7, which is old and relies upon old compilers. I downloaded the > suggested compiler: > > > http://download.microsoft.com/download/A/5/4/A54BADB6-9C3F-478D-8657-93B3FC9FE62D/vcsetup.exe > > I downloaded the thing that is supposed to correctly glue it to Python: > > > https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi > > But I can't see where to go from there. > > In my old world I never actually learned how to use distutils or > setuptools; I was just building my extension with my VC and then shoving it > into site-packages. As I read the documentation for distutils and > setuptools, I am SO LOST! I see much about how to install someone else's > package, but little about how to create and script my own package for > building a Python extension written in C. Please, can someone point me to a > good sample extension package that I can copy from? A "hello world" or > something? > > Apart from that, can someone please point me to the documentation for the > current "right" way of building things, as an extension developer? > > Thanks in advance, > > Ken > _______________________________________________ > 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 Andrew.MacIntyre at acma.gov.au Wed Nov 4 22:35:36 2015 From: Andrew.MacIntyre at acma.gov.au (Andrew MacIntyre) Date: Thu, 5 Nov 2015 03:35:36 +0000 Subject: [python-win32] Building my own C extension [SEC=UNCLASSIFIED] Message-ID: > From: python-win32 On Behalf Of Ken Brooks > Sent: Thursday, 5 November 2015 10:23 AM {...} > Apart from that, can someone please point me to the documentation for the current "right" way of building things, as an extension developer? The "Distributing Python Modules" section of the Python 2.7 documentation is the reference I have used. The "Single extension module" example is essentially a "hello world" level albeit lacking actual C extension source code. Once the right compiler is installed, the distutils setup.py script you create (if correct) should be able to build an installer or build and install the extension directly. Binary installer info is in the "Creating Built Distributions" section. There are more advance toolsets (e.g. setuptools, pip etc) that can be used, but I've always found Distutils sufficient for my needs on Python 2.x (not tried on Python 3.x yet). Regards, Andrew. -------------------------> "These thoughts are mine alone!" <--------- Andrew MacIntyre?????????? Operations, Services and Technologies Branch tel:?? +61 2 6219 5356???? Communications Infrastructure Division fax:?? +61 2 6219 5347???? Australian Communications & Media Authority email: andrew.macintyre at acma.gov.au??????????? http://www.acma.gov.au/ NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. From tritium-list at sdamon.com Thu Nov 5 08:57:09 2015 From: tritium-list at sdamon.com (Alexander Walters) Date: Thu, 05 Nov 2015 08:57:09 -0500 Subject: [python-win32] Building my own C extension In-Reply-To: References: Message-ID: <563B6035.5030401@sdamon.com> The 'thing that glues it together' IS the suggested compiler. You need nothing else to compile ANSI C python extensions with no C dependencies. for the most part, if the extension has a setup.py, it should Just Work with that and 2.7 (and ONLY that and 2.7) installed. If your project does not have a setup.py, that is something you will have to make (and we may be able to help you with that). On 11/4/2015 18:22, Ken Brooks wrote: > > I have joined this list because I need to learn how to rebuild my > antiquated Python extension properly for Windows. I need to build for > Python 2.7, which is old and relies upon old compilers. I downloaded > the suggested compiler: > > http://download.microsoft.com/download/A/5/4/A54BADB6-9C3F-478D-8657-93B3FC9FE62D/vcsetup.exe > > I downloaded the thing that is supposed to correctly glue it to Python: > > https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi > > But I can't see where to go from there. > > In my old world I never actually learned how to use distutils or > setuptools; I was just building my extension with my VC and then > shoving it into site-packages. As I read the documentation for > distutils and setuptools, I am SO LOST! I see much about how to > install someone else's package, but little about how to create and > script my own package for building a Python extension written in C. > Please, can someone point me to a good sample extension package that I > can copy from? A "hello world" or something? > > Apart from that, can someone please point me to the documentation for > the current "right" way of building things, as an extension developer? > > Thanks in advance, > > Ken > > > > _______________________________________________ > 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 framstag at rus.uni-stuttgart.de Thu Nov 19 08:56:52 2015 From: framstag at rus.uni-stuttgart.de (Ulli Horlacher) Date: Thu, 19 Nov 2015 14:56:52 +0100 Subject: [python-win32] pyinstaller: failed to create process Message-ID: <20151119135652.GA20736@rus.uni-stuttgart.de> I have to compile my Python scripts into standalone Windows executables which I can give to Windows users without Python. I use PyInstaller on Windows 7 for this task. It runs without problems with Python 2.7.10 But I am not able to get it working with Python 3.5 First, I was not able to install PyInstaller at all. I got C:\Users\admin>pip install pypiwin32 Collecting pypiwin32 Downloading pypiwin32-219-cp35-none-win32.whl (7.9MB) 100% |################################| 7.9MB 61kB/s Installing collected packages: pypiwin32 Exception: (...) File "c:\program files (x86)\python 3.5\lib\shutil.py", line 115, in copyfile with open(dst, 'wb') as fdst: PermissionError: [Errno 13] Permission denied: 'c:\\program files (x86)\\python3.5\\Lib\\site-packages\\PyWin32.chm' I found, I have to deactivate Windows UAC with: C:\Windows\System32\UserAccountControlSettings.exe Then I was able to run pip install pypiwin32 pip install pyinstaller without errors. BUT pyinstaller does not work: S:\python>pyinstaller.exe --onefile tk.py failed to create process. S:\python>pyinstaller --version failed to create process. What is wrong? -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlacher at tik.uni-stuttgart.de Universitaet Stuttgart Tel: ++49-711-68565868 Allmandring 30a Fax: ++49-711-682357 70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/ REF:<20151119135652.GA20736 at rus.uni-stuttgart.de> From lac at openend.se Thu Nov 19 10:19:42 2015 From: lac at openend.se (Laura Creighton) Date: Thu, 19 Nov 2015 16:19:42 +0100 Subject: [python-win32] pyinstaller: failed to create process In-Reply-To: <20151119135652.GA20736@rus.uni-stuttgart.de> References: <20151119135652.GA20736@rus.uni-stuttgart.de> Message-ID: <201511191519.tAJFJghT001048@fido.openend.se> In a message of Thu, 19 Nov 2015 14:56:52 +0100, Ulli Horlacher writes: >I have to compile my Python scripts into standalone Windows executables >which I can give to Windows users without Python. >I use PyInstaller on Windows 7 for this task. >It runs without problems with Python 2.7.10 >But I am not able to get it working with Python 3.5 > >First, I was not able to install PyInstaller at all. I got > >C:\Users\admin>pip install pypiwin32 > >Collecting pypiwin32 > Downloading pypiwin32-219-cp35-none-win32.whl (7.9MB) > 100% |################################| 7.9MB 61kB/s >Installing collected packages: pypiwin32 >Exception: >(...) > File "c:\program files (x86)\python 3.5\lib\shutil.py", line 115, in copyfile > with open(dst, 'wb') as fdst: >PermissionError: [Errno 13] Permission denied: 'c:\\program files (x86)\\python3.5\\Lib\\site-packages\\PyWin32.chm' > >I found, I have to deactivate Windows UAC with: > >C:\Windows\System32\UserAccountControlSettings.exe > >Then I was able to run > >pip install pypiwin32 >pip install pyinstaller > >without errors. > >BUT pyinstaller does not work: > >S:\python>pyinstaller.exe --onefile tk.py >failed to create process. > >S:\python>pyinstaller --version >failed to create process. > > >What is wrong? > >-- >Ullrich Horlacher Server und Virtualisierung >Rechenzentrum IZUS/TIK E-Mail: horlacher at tik.uni-stuttgart.de >Universitaet Stuttgart Tel: ++49-711-68565868 >Allmandring 30a Fax: ++49-711-682357 >70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/ >REF:<20151119135652.GA20736 at rus.uni-stuttgart.de> I think you have this bug. http://bugs.python.org/issue25148 But I don't know what the workaround is, since I really only use linux. Laura From framstag at rus.uni-stuttgart.de Thu Nov 19 10:55:05 2015 From: framstag at rus.uni-stuttgart.de (Ulli Horlacher) Date: Thu, 19 Nov 2015 16:55:05 +0100 Subject: [python-win32] pyinstaller: failed to create process In-Reply-To: References: <20151119135652.GA20736@rus.uni-stuttgart.de> Message-ID: <20151119155505.GA12563@rus.uni-stuttgart.de> On Thu 2015-11-19 (15:26), Graham Bloice wrote: > > C:\Users\admin>pip install pypiwin32 > > > > Collecting pypiwin32 > > Downloading pypiwin32-219-cp35-none-win32.whl (7.9MB) > > 100% |################################| 7.9MB 61kB/s > > Installing collected packages: pypiwin32 > > Exception: > > (...) > > File "c:\program files (x86)\python 3.5\lib\shutil.py", line 115, in > > copyfile > > with open(dst, 'wb') as fdst: > > PermissionError: [Errno 13] Permission denied: 'c:\\program files > > (x86)\\python3.5\\Lib\\site-packages\\PyWin32.chm' > > > > > Maybe Python 3.5 shouldn't be installed in the "C:\Program Files (x86)" > directory, as that does fall under UAC. I've always installed Python in > its own top level direcotyr, e.g. C:\Python3.5 "C:\Program Files (x86)\python 3.5" is the default installation path, suggested by the Python installer. But as I wrote: I deactivated Windows UAC with: C:\Windows\System32\UserAccountControlSettings.exe Then I was able to run pip install pypiwin32 pip install pyinstaller without errors. The problem now is: S:\python>pyinstaller --version failed to create process. -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlacher at tik.uni-stuttgart.de Universitaet Stuttgart Tel: ++49-711-68565868 Allmandring 30a Fax: ++49-711-682357 70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/ REF: From lewis.thompson at gmail.com Thu Nov 19 14:48:04 2015 From: lewis.thompson at gmail.com (Lewis Thompson) Date: Thu, 19 Nov 2015 19:48:04 +0000 (UTC) Subject: [python-win32] win32com error of 'invalid parameters' Message-ID: (-2147352567, 'Exception occurred.', (0, u'Xtapi.TTInstrObj.1', u'Invalid Parameters', None, 0, -2147352567), None) Does this mean that an argument needs to be passed as a keyword arg? From timr at probo.com Thu Nov 19 15:16:10 2015 From: timr at probo.com (Tim Roberts) Date: Thu, 19 Nov 2015 12:16:10 -0800 Subject: [python-win32] win32com error of 'invalid parameters' In-Reply-To: References: Message-ID: <564E2E0A.9080804@probo.com> Lewis Thompson wrote: > (-2147352567, 'Exception occurred.', (0, u'Xtapi.TTInstrObj.1', u'Invalid > Parameters', None, 0, -2147352567), None) > > Does this mean that an argument needs to be passed as a keyword arg? There's no way to tell. -2147352567 is 0x80020009, which is the unhelpful DISP_E_EXCEPTION. It might refer to a pointer or a bad address. The "Invalid Parameters" string suggests you should double-check all of your parameters. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From apilotti at cloudbasesolutions.com Sat Nov 21 07:31:36 2015 From: apilotti at cloudbasesolutions.com (Alessandro Pilotti) Date: Sat, 21 Nov 2015 12:31:36 +0000 Subject: [python-win32] PyMI - Windows Management Infrastructure API module Message-ID: <7A80ED82-D2DB-49D5-80AA-22B30C3F441E@cloudbasesolutions.com> Hi all, As a result of some limitations with the Python WMI module, specifically performance and lack of support for Nano Server, here?s an alternative replacement that uses the newer Windows Management Infrastructure (MI) API in place of the slower COM interface used by WMI.py (https://pypi.python.org/pypi/WMI): https://github.com/cloudbase/PyMI/tree/master/PyMI Pre-compiled wheels are available on Pypi: https://pypi.python.org/pypi/PyMI The package includes a native "mi" extension, providing a wrapper over the MI API and a "wmi" module which in turn wraps the lower level interface with an interface meant to be compatible with https://pypi.python.org/pypi/WMI. Benchmarks show rough execution speed improvements ranging from 50% on method calls to 500% and more on loops over query results. Early tests by just swapping the old WMI module with PyMI (without changes in the code) on the OpenStack Hyper-V Nova driver show a 50% performance improvement under heavy load. Supports Python 2.7 and 3.x on any x86 or x64 Windows version with the MI API, starting with Windows 7 (SP1) and Windows Server 2008 (SP2), including also Nano Server 2016. It does not use or require pywin32, making it much very easy to distribute. All basic features are already available on the current pre release, with events and async API support on the roadmap. WMI.py compatibility is currently limited to the features required by our target projects (e.g. OpenStack). A full test suite is planned to ensure increased compatibily and check for regressions. Thanks! Alessandro Pilotti Cloudbase Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From chris at athcon.org Thu Nov 26 18:11:39 2015 From: chris at athcon.org (Christian Papathanasiou) Date: Thu, 26 Nov 2015 23:11:39 +0000 Subject: [python-win32] Python Windows Service works in debug mode, does not work in normal mode. Message-ID: Hi, I have written a Python Windows service that does two things: a) Writes some data to disk b) Initiates a websocket When I try to install/start the Windows service normally, neither of these two functions work. Specifically, I get a 'Permission denied' error when creating / writing the file to disk and no data is seen on the web socket receiving server. I have installed the Windows service with full Windows Administrator privileges and it currently starts with the Administrator user account. Even with these privs I still get errors. Running on Win Vista. When I run this Windows service using pythonservice.exe -debug it works perfectly. Anyone have any tips that can help? I've pretty much read most things online that I could find within Googling distance and asked in a few places and pretty much at the point that I'm stumped :-) Your help is very much appreciated, Christian -------------- next part -------------- An HTML attachment was scrubbed... URL: From jcasale at activenetwerx.com Thu Nov 26 19:37:26 2015 From: jcasale at activenetwerx.com (Joseph L. Casale) Date: Fri, 27 Nov 2015 00:37:26 +0000 Subject: [python-win32] Python Windows Service works in debug mode, does not work in normal mode. In-Reply-To: References: Message-ID: <535c431a210744c08e68f00578418816@activenetwerx.com> > When I try to install/start the Windows service normally, neither of these two functions work. Specifically, I get a 'Permission denied' error when creating / writing the file to disk and no data is seen on the web socket receiving server. Don't start it with an interactive account, try Local System. jlc From chris at athcon.org Thu Nov 26 22:08:55 2015 From: chris at athcon.org (Christian Papathanasiou) Date: Fri, 27 Nov 2015 03:08:55 +0000 Subject: [python-win32] Python Windows Service works in debug mode, does not work in normal mode. In-Reply-To: <535c431a210744c08e68f00578418816@activenetwerx.com> References: <535c431a210744c08e68f00578418816@activenetwerx.com> Message-ID: Hi Joseph, thank you for the suggestion. I tried that too unfortunately with similar results. Kind regards, Christian On Fri, Nov 27, 2015 at 12:37 AM, Joseph L. Casale < jcasale at activenetwerx.com> wrote: > > When I try to install/start the Windows service normally, neither of > these two functions work. Specifically, I get a 'Permission denied' error > when creating / writing the file to disk and no data is seen on the web > socket receiving server. > > Don't start it with an interactive account, try Local System. > jlc > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matteo.boscolo at boscolini.eu Fri Nov 27 02:34:35 2015 From: matteo.boscolo at boscolini.eu (Matteo Boscolo) Date: Fri, 27 Nov 2015 08:34:35 +0100 Subject: [python-win32] hoto cast pyobject to ccompnt In-Reply-To: References: Message-ID: <5658078B.6050101@boscolini.eu> Hi I'm extending python with a cpp code in my cpp code I have my function that recive a com objetc from python into args from here I'm not able to cast such an object into a ccompnt static PyObject * connect(PyObject * self, PyObject * args) { PyObject * pyApplication; CComPtr pUnk; //try to get active object if (!PyArg_ParseTuple(args, "O", &pyApplication)) return NULL; pUnk=(CComPtr )pyApplication; //<<---- not able to cast HRESULT hRes = pUnk->QueryInterface(&pApp); Py_INCREF(Py_None); return Py_None; } I pass the dispached object via win32com as follows _application = Dispatch('TD_appl.Application', clsctx=CLSCTX_LOCAL_SERVER | CLSCTX_ACTIVATE_64_BIT_SERVER) td.connect(_application) td is my extended module any hint is really apprecieted best regards, Matteo --- Questa e-mail ? stata controllata per individuare virus con Avast antivirus. http://www.avast.com From timr at probo.com Sat Nov 28 02:30:02 2015 From: timr at probo.com (Tim Roberts) Date: Fri, 27 Nov 2015 23:30:02 -0800 Subject: [python-win32] hoto cast pyobject to ccompnt In-Reply-To: <5658078B.6050101@boscolini.eu> References: <5658078B.6050101@boscolini.eu> Message-ID: On Nov 26, 2015, at 11:34 PM, Matteo Boscolo wrote: > > in my cpp code I have my function that recive a com objetc from python > into args > from here I'm not able to cast such an object into a ccompnt > > static PyObject * > connect(PyObject * self, PyObject * args) > { > PyObject * pyApplication; > CComPtr pUnk; > //try to get active object > if (!PyArg_ParseTuple(args, "O", &pyApplication)) > return NULL; > pUnk=(CComPtr )pyApplication; //<<---- not able to cast You are just getting a compile-time error, right? That?s because the smart pointer wrapper (CComPtr)will only accept a pointer that actually derives from the type it is wrapping. In this case, that?s not so. You will probably have to force the pointer to be an IUnknown* before you can wrap it in a smart pointer. pUnk = (IUnknown*)pyApplication; ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From matteo.boscolo at boscolini.eu Sat Nov 28 03:02:24 2015 From: matteo.boscolo at boscolini.eu (Matteo Boscolo) Date: Sat, 28 Nov 2015 09:02:24 +0100 Subject: [python-win32] hoto cast pyobject to ccompnt In-Reply-To: References: <5658078B.6050101@boscolini.eu> Message-ID: <56595F90.3000208@boscolini.eu> Il 28/11/2015 08:30, Tim Roberts ha scritto: > On Nov 26, 2015, at 11:34 PM, Matteo Boscolo wrote: >> in my cpp code I have my function that recive a com objetc from python >> into args >> from here I'm not able to cast such an object into a ccompnt >> >> static PyObject * >> connect(PyObject * self, PyObject * args) >> { >> PyObject * pyApplication; >> CComPtr pUnk; >> //try to get active object >> if (!PyArg_ParseTuple(args, "O", &pyApplication)) >> return NULL; >> pUnk=(CComPtr )pyApplication; //<<---- not able to cast > You are just getting a compile-time error, right? That?s because the smart pointer wrapper (CComPtr)will only accept a pointer that actually derives from the type it is wrapping. In this case, that?s not so. You will probably have to force the pointer to be an IUnknown* before you can wrap it in a smart pointer. > > pUnk = (IUnknown*)pyApplication; > > ? > 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 > thanks for your replay.. but if i made the suggested cast i get ../pyThinkdesign.cpp(59) : error C2259: 'IUnknown' : cannot instantiate abstract class due to following members: 'HRESULT IUnknown::QueryInterface(const IID &,void **)' : is abstract C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\unknwn.h(116) : see declaration of 'IUnknown::QueryInterface' 'ULONG IUnknown::AddRef(void)' : is abstract C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\unknwn.h(120) : see declaration of 'IUnknown::AddRef' 'ULONG IUnknown::Release(void)' : is abstract C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\unknwn.h(122) : see declaration of 'IUnknown::Release' error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\cl.exe' failed with exit status 2 best refgards Matteo --- Questa e-mail ? stata controllata per individuare virus con Avast antivirus. http://www.avast.com From matteo.boscolo at boscolini.eu Sat Nov 28 03:05:07 2015 From: matteo.boscolo at boscolini.eu (Matteo Boscolo) Date: Sat, 28 Nov 2015 09:05:07 +0100 Subject: [python-win32] hoto cast pyobject to ccompnt In-Reply-To: References: <5658078B.6050101@boscolini.eu> Message-ID: <56596033.5080501@boscolini.eu> Il 28/11/2015 08:30, Tim Roberts ha scritto: > On Nov 26, 2015, at 11:34 PM, Matteo Boscolo wrote: >> in my cpp code I have my function that recive a com objetc from python >> into args >> from here I'm not able to cast such an object into a ccompnt >> >> static PyObject * >> connect(PyObject * self, PyObject * args) >> { >> PyObject * pyApplication; >> CComPtr pUnk; >> //try to get active object >> if (!PyArg_ParseTuple(args, "O", &pyApplication)) >> return NULL; >> pUnk=(CComPtr )pyApplication; //<<---- not able to cast > You are just getting a compile-time error, right? That?s because the smart pointer wrapper (CComPtr)will only accept a pointer that actually derives from the type it is wrapping. In this case, that?s not so. You will probably have to force the pointer to be an IUnknown* before you can wrap it in a smart pointer. > > pUnk = (IUnknown*)pyApplication; > > ? > 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 > sorry i did a mistake your cast seems to be ok for compyling .. --- Questa e-mail ? stata controllata per individuare virus con Avast antivirus. http://www.avast.com From matteo.boscolo at boscolini.eu Sat Nov 28 03:08:26 2015 From: matteo.boscolo at boscolini.eu (Matteo Boscolo) Date: Sat, 28 Nov 2015 09:08:26 +0100 Subject: [python-win32] hoto cast pyobject to ccompnt In-Reply-To: <56596033.5080501@boscolini.eu> References: <5658078B.6050101@boscolini.eu> <56596033.5080501@boscolini.eu> Message-ID: <565960FA.7030106@boscolini.eu> pUnk = (IUnknown*)pyApplication; >> >> ? >> 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 >> > sorry i did a mistake your cast seems to be ok for compyling .. > > > > --- > Questa e-mail ? stata controllata per individuare virus con Avast > antivirus. > http://www.avast.com > > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > Unfortunately when i execute the code i get an acces violation .. :((( --- Questa e-mail ? stata controllata per individuare virus con Avast antivirus. http://www.avast.com From matteo.boscolo at boscolini.eu Sun Nov 29 01:22:59 2015 From: matteo.boscolo at boscolini.eu (Matteo Boscolo) Date: Sun, 29 Nov 2015 07:22:59 +0100 Subject: [python-win32] hoto cast pyobject to ccompnt In-Reply-To: <565960FA.7030106@boscolini.eu> References: <5658078B.6050101@boscolini.eu> <56596033.5080501@boscolini.eu> <565960FA.7030106@boscolini.eu> Message-ID: <565A99C3.6050201@boscolini.eu> Il 28/11/2015 09:08, Matteo Boscolo ha scritto: > pUnk = (IUnknown*)pyApplication; >>> >>> ? >>> 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 >>> >> sorry i did a mistake your cast seems to be ok for compyling .. >> >> >> >> --- >> Questa e-mail ? stata controllata per individuare virus con Avast >> antivirus. >> http://www.avast.com >> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> https://mail.python.org/mailman/listinfo/python-win32 >> > Unfortunately when i execute the code i get an acces violation .. :((( > I solve it by using the pythoncom.h in this way .. . .. ... #include "PythonCOM.h" ..... ... .. static PyObject * connect(PyObject * self, PyObject * args) { PyObject * pyApplication; CComPtr pUnk; IUnknown *ret; //try to get active object if (!PyArg_ParseTuple(args, "O", &pyApplication)) return NULL; pUnk = ((PyIUnknown *)pyApplication)->m_obj; HRESULT hRes = pUnk->QueryInterface(&pApp); Py_INCREF(Py_None); return Py_None; } regards, Matteo --- Questa e-mail ? stata controllata per individuare virus con Avast antivirus. http://www.avast.com