[python-win32] Getting the text of the first slide of a PowerPoint file
Hello, On to part 2 of my project. I need to be able to get the text of the first slide out of a lot of Powerpoint files. If anyone can give me some handy hints, that would be appreciated. By the way, thanks to Tim, my script to handle all the word documents is running today in 26 batches. This list has been very helpful. Thanks, Daniel Greenfeld ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] SimpleXMLRPCServer Windows service
I am trying to create a Windows service using SimpleXMLRPCServer and win32serviceutil. The service itself seems to be working properly (starts, stops, etc) and I can connect using an XMLRPC client from the localhost. However when I connect from a remote client, I either get a socket error or an xmlrpclib.ProtocolError error. If I use serve_forever() rather than handle_request(), the remote clients can connect but it breaks the Windows service functionality (can't stop the service). It would seem that the problem is related to the way the service handles remote connections, but I cannot figure out what the problem is. I have searched around, but can't find any example code. Hopefully someone can point me in the right direction. thanks, John ## XML-RPC Service import win32serviceutil import win32service import win32event import win32evtlogutil import win32file import servicemanager import SimpleXMLRPCServer class OBJECT: def hello(self): return "Hello World" class XMLRPCSERVICE(win32serviceutil.ServiceFramework): _svc_name_ = "XMLRPCSERVICE" _svc_display_name_ = "XMLRPCSERVICE" _svc_description_ = "XMLRPCSERVICE" def __init__(self, args): win32evtlogutil.AddSourceToRegistry(self._svc_display_name_, sys.executable, "Application") win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) self.hSockEvent = win32event.CreateEvent(None, 0, 0, None) def SvcStop(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) win32event.SetEvent(self.hWaitStop) def SvcDoRun(self): ## Write a started event servicemanager.LogMsg( servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STARTED, (self._svc_name_, ' (%s)' % self._svc_name_)) server = SimpleXMLRPCServer.SimpleXMLRPCServer(("", 8080)) object = OBJECT() server.register_instance(object) while 1: win32file.WSAEventSelect(server, self.hSockEvent,win32file.FD_ACCEPT) rc = win32event.WaitForMultipleObjects((self.hWaitStop,self.hSockEvent), 0, win32event.INFINITE) if rc == win32event.WAIT_OBJECT_0: break else: win32file.WSAEventSelect(server,self.hSockEvent, 0) server.handle_request() #server.serve_forever() ## Works, but breaks the Windows service functionality ## Write a stopped event win32evtlogutil.ReportEvent(self._svc_name_, servicemanager.PYS_SERVICE_STOPPED,0, servicemanager.EVENTLOG_INFORMATION_TYPE, (self._svc_name_,"")) if __name__ == '__main__': win32serviceutil.HandleCommandLine(XMLRPCSERVICE) -- ## XML-RPC Client import xmlrpclib server = xmlrpclib.ServerProxy("http://remoteserver:8080") print server.hello()___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] Referencing SimpleCOMServer-based COM object from VisStudio C# code?
Hello, I am trying to access my python class, implemented as a COM server, from my Visual Studio C# application. The problem is when I try to add a reference with Visual Studio, my COM object isn't listed. When I run PythonWin and use its COM Browser tool, my COM object is in one of the "registered categories", the Python COM server category. I based my Python code on Mark's SimpleCOMServer.py example and registered it, which seemed to work. It's in the registry and, as I said, the COM browser in PythonWin seems to know about it. But Visual Studio's COM browser doesn't list it and I don't know how else to reference it in my C# code. Mark uses SimpleCOMServer.py with a snippet of VB code, which leads me to believe that it is creating a fully-legal COM server. But Visual Studio must need something closer to a type library for me to be able to simply reference it in my C# project. Any ideas? ~Michael. ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] Python Error - Cannot Initialize OLE
I’m writing an application to control some PLC’s,and during initialization a little Window pops up with ‘Python Error’ in the title and the message ‘Cannot Initialize OLE’. It doesn’t seem to affect my application other than that error message at the start. I’ve got a GUI running in the main thread, 1 thread doing OPC communications to an OPC server (thanks to some help from Norm Petterson), and two other worker threads implementing business logic. The main thread creates a couple Queues and passes them to the other threads so they can all communicate. In the main thread, I’ve set sys.coinit_flags = 0 before importing pythoncom. Each of the other threads call pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED). I have Mark Hammond’s book on python programming on Win32, but I’m still confused on how exactly to get all my threads communicating well. This setup seems to work, except for that error window that pops up near the start (I can’t even tell exactly where it’s cropping up). Does anyone know what causes this error window, or what I’m doing wrong? Thanks for any help, Gerrat Rickert ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
[python-win32] Python Error - Cannot Initialize OLE
…ok, I found out that it’s generated by wxPython. It looks like someone in the wxWidgets mailing list had the same error message crop up and solved it by marking their thread as a single-threaded apartment. My problem is, my application is using a basic stand-alone OPC client module I wrote that doesn’t seem to work unless I mark it as multithreaded, and when I mark it as multithreaded and the rest of the application as single-threaded, they don’t work together. Gerrat Rickert ___ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32