From jomega.ai at gmail.com Mon Sep 4 04:58:49 2023 From: jomega.ai at gmail.com (Mohindar Rao) Date: Mon, 4 Sep 2023 10:58:49 +0200 Subject: [python-win32] Consuming COM events Message-ID: How to consume COM events from python modules generated using makepy? I instance of Test works but how to implement events? class ITest(DispatchBaseClass): 'Dispatch-Interface for the Test object' CLSID = IID('{F0691CAD-0C9D-4357-9373-CE6972E1F8A5}') coclass_clsid = IID('{E4A22390-5A45-4217-AD46-EA4E4EBBEA79}') ... ... ... def __iter__(self): "Return a Python iterator for this object" try: ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) except pythoncom.error: raise TypeError("This object does not support enumeration") return win32com.client.util.Iterator(ob, None) class ITest_Events: 'Event-Interface for the Test objects' CLSID = CLSID_Sink = IID('{7556E550-8FA7-424D-B9AD-600B9E8E983A}') coclass_clsid = IID('{E4A22390-5A45-4217-AD46-EA4E4EBBEA79}') _public_methods_ = [] # For COM Server support _dispid_to_func_ = { 1 : "OnRunProject", } def __init__(self, oobj = None): if oobj is None: self._olecp = None else: import win32com.server.util from win32com.server.policy import EventHandlerPolicy cpc=oobj._oleobj_.QueryInterface(pythoncom.IID_IConnectionPointContainer) cp=cpc.FindConnectionPoint(self.CLSID_Sink) cookie=cp.Advise(win32com.server.util.wrap(self, usePolicy=EventHandlerPolicy)) self._olecp,self._olecp_cookie = cp,cookie def __del__(self): try: self.close() except pythoncom.com_error: pass def close(self): if self._olecp is not None: cp,cookie,self._olecp,self._olecp_cookie = self._olecp,self._olecp_cookie,None,None cp.Unadvise(cookie) def _query_interface_(self, iid): import win32com.server.util if iid==self.CLSID_Sink: return win32com.server.util.wrap(self) # Event Handlers # If you create handlers, they should have the following prototypes: # def OnRunProject(self): # 'This event is fired when the project starts to run.' Any help will be much appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nasser at ennetix.com Tue Sep 5 13:46:09 2023 From: nasser at ennetix.com (Nasser Issa) Date: Tue, 5 Sep 2023 17:46:09 +0000 Subject: [python-win32] Exe not working correctly Message-ID: Hello There, Currently been working with PyWin32 to interact with the Event Log and I'm trying to turn my Python script into a Windows executable. I'm using PyInstaller to convert my script into exe, however when I run my exe the TimeCreated field from the Windows Event is 'None' but when I run the program as a script it works perfectly fine. So, I guess what I'm asking is why does the program work as a python script but not as an executable, I also try adding the DLLs like pywintype310 and few others when building exe with PyInstaller. Best, Nas -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: iWEX-exe.png Type: image/png Size: 29178 bytes Desc: iWEX-exe.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: iWEX-script.png Type: image/png Size: 39169 bytes Desc: iWEX-script.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: iWEX-script.png Type: image/png Size: 39169 bytes Desc: iWEX-script.png URL: From mhammond at skippinet.com.au Tue Sep 5 14:59:55 2023 From: mhammond at skippinet.com.au (Mark Hammond) Date: Tue, 5 Sep 2023 14:59:55 -0400 Subject: [python-win32] Exe not working correctly In-Reply-To: References: Message-ID: Is it possible that the datetime module isn't being packaged? Directly importing that module at the top-level of your script might be enough to fix it. HTH, Mark On 2023-09-05 1:46 p.m., Nasser Issa wrote: > Hello There, > > Currently been working with PyWin32 to interact with the Event Log and > I'm trying to turn my Python script into a Windows executable. I'm > using PyInstaller to convert my script into exe, however when I run my > exe the? TimeCreated field from the Windows Event is 'None' but when I > run the program as a script it works perfectly fine. So, I guess what > I'm asking is why does the program work as a python script but not as > an executable, I also try adding the DLLs like pywintype310 and few > others when building exe with PyInstaller. > > Best, > Nas > > _______________________________________________ > 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 oudouxin at gmail.com Tue Sep 5 15:11:45 2023 From: oudouxin at gmail.com (Wuping Xin) Date: Tue, 05 Sep 2023 19:11:45 +0000 Subject: [python-win32] python-win32 Digest, Vol 242, Issue 2 In-Reply-To: References: Message-ID: Did you run your "wrapped exe" package on the same computer where the package was wrapped, or on a new computer? If it was running on a new computer, probably it won't work because pywin32 is dependent on certain system registry entries. PyInstaller does not seem to package the registry. Wuping ------ Original Message ------ >From python-win32-request at python.org To python-win32 at python.org Date 9/5/2023 1:58:14 PM Subject python-win32 Digest, Vol 242, Issue 2 >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. Exe not working correctly (Nasser Issa) > > >---------------------------------------------------------------------- > >Message: 1 >Date: Tue, 5 Sep 2023 17:46:09 +0000 >From: Nasser Issa >To: "python-win32 at python.org" >Subject: [python-win32] Exe not working correctly >Message-ID: > >Content-Type: text/plain; charset="iso-8859-1" > >Hello There, > >Currently been working with PyWin32 to interact with the Event Log and I'm trying to turn my Python script into a Windows executable. I'm using PyInstaller to convert my script into exe, however when I run my exe the TimeCreated field from the Windows Event is 'None' but when I run the program as a script it works perfectly fine. So, I guess what I'm asking is why does the program work as a python script but not as an executable, I also try adding the DLLs like pywintype310 and few others when building exe with PyInstaller. > >Best, >Nas >-------------- next part -------------- >An HTML attachment was scrubbed... >URL: >-------------- next part -------------- >A non-text attachment was scrubbed... >Name: iWEX-exe.png >Type: image/png >Size: 29178 bytes >Desc: iWEX-exe.png >URL: >-------------- next part -------------- >A non-text attachment was scrubbed... >Name: iWEX-script.png >Type: image/png >Size: 39169 bytes >Desc: iWEX-script.png >URL: >-------------- next part -------------- >A non-text attachment was scrubbed... >Name: iWEX-script.png >Type: image/png >Size: 39169 bytes >Desc: iWEX-script.png >URL: > >------------------------------ > >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 242, Issue 2 >******************************************** From jacob at blindza.co.za Wed Sep 6 02:35:29 2023 From: jacob at blindza.co.za (Jacob Kruger) Date: Wed, 6 Sep 2023 08:35:29 +0200 Subject: [python-win32] Recommended web server implementation to actively run multiple flask web apps on a windows machine Message-ID: Hi there My primary development focus at the moment is web applications, using the flask web-framework, and, while, in development, I can just run them on different ports, etc. on my dev machine - windows 11 home 64 bit - in the past I worked with laragon or WAMPP when working with PHP development. Now, I know in theory it's possible to map something like virtual directorys/paths via apache, which is what WAMP is working with, but, was just wondering what is the recommended web server package to work with in this context? Laragon? nGinX? WAMP? XAMPP? TIA -- Jacob Kruger Skype: BlindZA "...resistance is futile!...acceptance is versatile..." From vernondcole at gmail.com Thu Sep 7 10:04:24 2023 From: vernondcole at gmail.com (Vernon D. Cole) Date: Thu, 7 Sep 2023 08:04:24 -0600 Subject: [python-win32] Recommended web server implementation to actively run multiple flask web apps on a windows machine In-Reply-To: References: Message-ID: I highly recommend nginx. I also highly recommend NOT running a web server on Windows. On Wed, Sep 6, 2023 at 1:14?AM Jacob Kruger wrote: > Hi there > > > My primary development focus at the moment is web applications, using > the flask web-framework, and, while, in development, I can just run them > on different ports, etc. on my dev machine - windows 11 home 64 bit - in > the past I worked with laragon or WAMPP when working with PHP development. > > > Now, I know in theory it's possible to map something like virtual > directorys/paths via apache, which is what WAMP is working with, but, > was just wondering what is the recommended web server package to work > with in this context? > > > Laragon? nGinX? WAMP? XAMPP? > > > TIA > > -- > > Jacob Kruger > Skype: BlindZA > "...resistance is futile!...acceptance is versatile..." > _______________________________________________ > 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 jacob at blindza.co.za Fri Sep 8 03:09:16 2023 From: jacob at blindza.co.za (Jacob Kruger) Date: Fri, 8 Sep 2023 09:09:16 +0200 Subject: [python-win32] Recommended web server implementation to actively run multiple flask web apps on a windows machine In-Reply-To: References: Message-ID: Vernon, this is really just for dev testing, and/or for testing a bit across machines, etc. - would also never consider running an actual production web server on windows - last time did that was a very long time ago, when classic ASP, and ASP.net, running against MSSQL server were my focus areas. Jacob Kruger Skype: BlindZA "...resistance is futile!...acceptance is versatile..." On 2023/09/07 16:04, Vernon D. Cole wrote: > I highly recommend nginx. > > I also highly recommend NOT running a web server on Windows. > > > On Wed, Sep 6, 2023 at 1:14?AM Jacob Kruger wrote: > > Hi there > > > My primary development focus at the moment is web applications, using > the flask web-framework, and, while, in development, I can just > run them > on different ports, etc. on my dev machine - windows 11 home 64 > bit - in > the past I worked with laragon or WAMPP when working with PHP > development. > > > Now, I know in theory it's possible to map something like virtual > directorys/paths via apache, which is what WAMP is working with, but, > was just wondering what is the recommended web server package to work > with in this context? > > > Laragon? nGinX? WAMP? XAMPP? > > > TIA > > -- > > Jacob Kruger > Skype: BlindZA > "...resistance is futile!...acceptance is versatile..." > _______________________________________________ > 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 jacob at blindza.co.za Fri Sep 8 03:50:16 2023 From: jacob at blindza.co.za (Jacob Kruger) Date: Fri, 8 Sep 2023 09:50:16 +0200 Subject: [python-win32] Recommended web server implementation to actively run multiple flask web apps on a windows machine In-Reply-To: References: Message-ID: <73870c4d-c310-444a-901b-066e9698204b@blindza.co.za> Thanks. More to do with that, at times, I want to run forms of apache, for things like the adminer database management, single page .php file, while sort of running flask alongside, and, yes, generally then just run flask on a different port, but, for example, when put flask in production, more or less run it under nginx on linux servers, using nginx .conf to route requests to .sock, or via gunicorn services. So, do agree that think must try out nginx running here under windows a bit more, or play around with wsgi mod under apache properly. Thanks Jacob Kruger Skype: BlindZA "...resistance is futile!...acceptance is versatile..." On 2023/09/08 09:37, Mriswithe wrote: > Not sure if this is the sort of thing you are looking for, but if what > you want is a simple http server, there is an http server in Python > stdlib (https://docs.python.org/3/library/http.server.html ) for > simple non-prod web serving purposes, but flask will run itself in the > same non-prod capacity.for development?purposes. > > On Fri, Sep 8, 2023, 2:10 AM Jacob Kruger wrote: > > Vernon, this is really just for dev testing, and/or for testing a > bit across machines, etc. - would also never consider running an > actual production web server on windows - last time did that was a > very long time ago, when classic ASP, and ASP.net, running against > MSSQL server were my focus areas. > > > Jacob Kruger > Skype: BlindZA > "...resistance is futile!...acceptance is versatile..." > On 2023/09/07 16:04, Vernon D. Cole wrote: >> I highly recommend nginx. >> >> I also highly recommend NOT running a web server on Windows. >> >> >> On Wed, Sep 6, 2023 at 1:14?AM Jacob Kruger >> wrote: >> >> Hi there >> >> >> My primary development focus at the moment is web >> applications, using >> the flask web-framework, and, while, in development, I can >> just run them >> on different ports, etc. on my dev machine - windows 11 home >> 64 bit - in >> the past I worked with laragon or WAMPP when working with PHP >> development. >> >> >> Now, I know in theory it's possible to map something like >> virtual >> directorys/paths via apache, which is what WAMP is working >> with, but, >> was just wondering what is the recommended web server package >> to work >> with in this context? >> >> >> Laragon? nGinX? WAMP? XAMPP? >> >> >> TIA >> >> -- >> >> Jacob Kruger >> Skype: BlindZA >> "...resistance is futile!...acceptance is versatile..." >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> https://mail.python.org/mailman/listinfo/python-win32 >> > _______________________________________________ > 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 waldemar.osuch at gmail.com Fri Sep 8 10:44:53 2023 From: waldemar.osuch at gmail.com (Waldemar Osuch) Date: Fri, 8 Sep 2023 08:44:53 -0600 Subject: [python-win32] Recommended web server implementation to actively run multiple flask web apps on a windows machine In-Reply-To: <73870c4d-c310-444a-901b-066e9698204b@blindza.co.za> References: <73870c4d-c310-444a-901b-066e9698204b@blindza.co.za> Message-ID: I have a small Flask app running on IIS with wfastcgi https://pypi.org/project/wfastcgi/ PyPI project seems to be dormant but the package works :-) Cheers, Waldemar On Fri, Sep 8, 2023 at 1:50?AM Jacob Kruger wrote: > Thanks. > > > More to do with that, at times, I want to run forms of apache, for things > like the adminer database management, single page .php file, while sort of > running flask alongside, and, yes, generally then just run flask on a > different port, but, for example, when put flask in production, more or > less run it under nginx on linux servers, using nginx .conf to route > requests to .sock, or via gunicorn services. > > > So, do agree that think must try out nginx running here under windows a > bit more, or play around with wsgi mod under apache properly. > > > Thanks > > Jacob Kruger > Skype: BlindZA > "...resistance is futile!...acceptance is versatile..." > On 2023/09/08 09:37, Mriswithe wrote: > > Not sure if this is the sort of thing you are looking for, but if what you > want is a simple http server, there is an http server in Python stdlib ( > https://docs.python.org/3/library/http.server.html ) for simple non-prod > web serving purposes, but flask will run itself in the same non-prod > capacity.for development purposes. > > On Fri, Sep 8, 2023, 2:10 AM Jacob Kruger wrote: > >> Vernon, this is really just for dev testing, and/or for testing a bit >> across machines, etc. - would also never consider running an actual >> production web server on windows - last time did that was a very long time >> ago, when classic ASP, and ASP.net, running against MSSQL server were my >> focus areas. >> >> Jacob Kruger >> Skype: BlindZA >> "...resistance is futile!...acceptance is versatile..." >> On 2023/09/07 16:04, Vernon D. Cole wrote: >> >> I highly recommend nginx. >> >> I also highly recommend NOT running a web server on Windows. >> >> >> On Wed, Sep 6, 2023 at 1:14?AM Jacob Kruger wrote: >> >>> Hi there >>> >>> >>> My primary development focus at the moment is web applications, using >>> the flask web-framework, and, while, in development, I can just run them >>> on different ports, etc. on my dev machine - windows 11 home 64 bit - in >>> the past I worked with laragon or WAMPP when working with PHP >>> development. >>> >>> >>> Now, I know in theory it's possible to map something like virtual >>> directorys/paths via apache, which is what WAMP is working with, but, >>> was just wondering what is the recommended web server package to work >>> with in this context? >>> >>> >>> Laragon? nGinX? WAMP? XAMPP? >>> >>> >>> TIA >>> >>> -- >>> >>> Jacob Kruger >>> Skype: BlindZA >>> "...resistance is futile!...acceptance is versatile..." >>> _______________________________________________ >>> python-win32 mailing list >>> python-win32 at python.org >>> https://mail.python.org/mailman/listinfo/python-win32 >>> >> _______________________________________________ >> python-win32 mailing list >> python-win32 at python.org >> https://mail.python.org/mailman/listinfo/python-win32 >> > _______________________________________________ > 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 dzzie at yahoo.com Sun Sep 17 10:11:41 2023 From: dzzie at yahoo.com (dzzie) Date: Sun, 17 Sep 2023 14:11:41 +0000 (UTC) Subject: [python-win32] AddObject from C References: <653964788.1468993.1694959901159.ref@mail.yahoo.com> Message-ID: <653964788.1468993.1694959901159@mail.yahoo.com> Hi guys I am working with an embedded interpreter, how can I share an existing COM object from the C api ?(without using the ROT) Background: The host process is VB6 with a C helper DLL. I have stripped down the pywin32 library to compile directly into my helper dll with just the COM access features. Right now I can createobject() and getobject() in python using the new namespaces. Experimenting with using this for app automation similar to the microsoft script control and its addobject functionality. Bringing the COM code into my helper dll to see if I can get around not being able to call PyFinalize with the full library. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dzzie at yahoo.com Sun Sep 17 16:44:34 2023 From: dzzie at yahoo.com (dzzie) Date: Sun, 17 Sep 2023 20:44:34 +0000 (UTC) Subject: [python-win32] AddObject from C In-Reply-To: <653964788.1468993.1694959901159@mail.yahoo.com> References: <653964788.1468993.1694959901159.ref@mail.yahoo.com> <653964788.1468993.1694959901159@mail.yahoo.com> Message-ID: <913951271.729047.1694983474121@mail.yahoo.com> Seems to be solved: ------------------------------------------------------------------------------------ /lib/site-packages/pycom/__init__.py def GetObject(Pathname=None, Class=None, clsctx=None): ...if Class is not None: ??????? return GetActiveObject(Class, clsctx) ??? else: ??????? #first check to see if its an in process COM object shared from VB before we check ROT ??????? v = pycomint.HostResolver(Pathname); ??????? #print(type(v)) # or ??????? if v is not None: ??????????? return __WrapDispatch(v, Pathname, clsctx=clsctx) ??????? else: ??????????? return Moniker(Pathname, clsctx) ------------------------------------------------------------------------------------ PythonCOM.cpp static PyObject *pythoncom_HostResolver(PyObject *self, PyObject *args) { ??? int rv = 0; ??? char* s; ??? if(vbHostResolver == NULL) return Py_BuildValue(""); ??? if (!PyArg_ParseTuple(args, "s", &s)) return Py_BuildValue(""); ??? //PY_INTERFACE_PRECALL; ??? rv = vbHostResolver(s, 0, 0, 0); ??? //PY_INTERFACE_POSTCALL; ?? ? ??? if (rv == 0)? return Py_BuildValue(""); ??? return PyCom_PyObjectFromIUnknown((IUnknown*)rv, IID_IDispatch, FALSE); } --------------------------------------------------------------------------------------- VB6 implementation Public Function HostResolver(ByVal buf As Long, ByVal v1 As Long, ByVal v2 As Long, ByVal v3 As Long) As Long ?? ? ??? On Error Resume Next ?? ? ??? Dim key As String ??? Dim o As Object ??? key = LCase(StringFromPointer(buf)) ??? Set o = SharedObjects(key) ?? ? ??? If Not o Is Nothing Then ??????? HostResolver = ObjPtr(o) ??? Else ??????? HostResolver = 0 ??? End If ???? ? End Function -------------- next part -------------- An HTML attachment was scrubbed... URL: From jerinsujith23 at gmail.com Wed Sep 20 13:13:31 2023 From: jerinsujith23 at gmail.com (Sujith R) Date: Wed, 20 Sep 2023 22:43:31 +0530 Subject: [python-win32] Uninstallation Command Required Message-ID: Hi Team, I need to uninstall python via windows command prompt. I tried lots of various commands but it?s not worked well. Can you please help me to solve this issue. SUMMARY: Need a proper uninstall command for windows Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bkline at rksystems.com Wed Sep 20 15:31:51 2023 From: bkline at rksystems.com (Bob Kline) Date: Wed, 20 Sep 2023 15:31:51 -0400 Subject: [python-win32] Uninstallation Command Required In-Reply-To: References: Message-ID: Depends on how it was installed. If you used the installer from python.org, it might look like this: python-3.11.1-amd64.exe /uninstall /quiet > uninstall.log (Adjust the name of the executable to match the version you installed.) If you used some other distribution (for example, from ActiveState) follow the instructions provided by that distributor. On Wed, Sep 20, 2023 at 3:19?PM Sujith R wrote: > Hi Team, > > I need to uninstall python via windows command prompt. I tried lots of > various commands but it?s not worked well. Can you please help me to solve > this issue. > > SUMMARY: Need a proper uninstall command for windows > > Thanks in advance. > _______________________________________________ > python-win32 mailing list > python-win32 at python.org > https://mail.python.org/mailman/listinfo/python-win32 > -- Bob Kline https://www.rksystems.com mailto:bkline at rksystems.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From steven at manross.net Wed Sep 20 17:04:20 2023 From: steven at manross.net (Steven Manross) Date: Wed, 20 Sep 2023 21:04:20 +0000 Subject: [python-win32] Uninstallation Command Required In-Reply-To: References: Message-ID: <5910760030854f20bfbd3860b577c624@manross.net> As well, you can look in the windows registry in the Uninstall key (but need to find the specific key for your python installer) # this registry key is for version 3.9.12 (but the only thing that would change on other versions would be the final key name: the GUID) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{33807E24-D0B9-45A0-A48D-51A432CD27E8} Once you have found the registry key for Python, look at the UninstallString value: Which is this for one of my PCs: MsiExec.exe /I{33807E24-D0B9-45A0-A48D-51A432CD27E8} From there, you could add a /q or /quiet for a quiet uninstall? For more help with the windows MSIEXEC util, run msiexec /? And it will give you a lot of help/switches I hope that between these 2 answers, we have given you everything you need. Steven From: python-win32 On Behalf Of Bob Kline Sent: Wednesday, September 20, 2023 12:32 PM To: Sujith R Cc: python-win32 at python.org Subject: Re: [python-win32] Uninstallation Command Required Depends on how it was installed. If you used the installer from python.org, it might look like this: python-3.11.1-amd64.exe /uninstall /quiet > uninstall.log (Adjust the name of the executable to match the version you installed.) If you used some other distribution (for example, from ActiveState) follow the instructions provided by that distributor. On Wed, Sep 20, 2023 at 3:19?PM Sujith R > wrote: Hi Team, I need to uninstall python via windows command prompt. I tried lots of various commands but it?s not worked well. Can you please help me to solve this issue. SUMMARY: Need a proper uninstall command for windows Thanks in advance. _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 -- Bob Kline https://www.rksystems.com mailto:bkline at rksystems.com -------------- next part -------------- An HTML attachment was scrubbed... URL: