Category : pythoncom

I tries to convert my .py file to.exe which uses PYTTSX3 module through PyInstaller command and also imported hidden imports like pyttsx3.drivers, pyttsx3.drivers.sapi5. Commmand used – pyinstaller .SCREENER.PY –hidden-import pyttsx3.drivers.sapi5 –hidden-import babel.numbers –hidden-import pythoncom SCREENER is the name of my Python File But yet I’m getting this Error in my .exe file. Please suggest me ..

Read more

I am trying to create an instance of Span COM. The manual is given here: https://www.cmegroup.com/confluence/display/pubspan/Component+Interface+for+Version+4+of+PC-SPAN%2C+SPAN+Risk+Manager%2C+and+SPAN+Risk+Manager+Clearing The code I have written: import pythoncom import win32com.client fdm = pythoncom.LoadTypeLib(‘C:Span4BinSpanCom.tlb’) clsctx=pythoncom.CLSCTX_LOCAL_SERVER pythoncom.CoInitialize() SpanCOM = win32com.client.Dispatch(‘SpanCom.Application’,clsctx) SpanCOM.Load("C:Span4cme.20210924.s.pa2",1,0) SpanCOM works but when I load using SpanCOM, it returns 1 instead of 0 as mentioned in the manual. Not sure ..

Read more

import pyWinhook as pyHook import time def OnMouseEventLeft(event): print(‘MessageName: %s’ % event.MessageName) time.sleep(2) //Intentional delay print("——") return True def OnKeyboardEvent(event): print(‘Key: %s’ % event.Key) print(‘—‘) return True hm = pyHook.HookManager() hm.MouseLeftDown = OnMouseEventLeft hm.KeyDown = OnKeyboardEvent hm.HookMouse() hm.HookKeyboard() if __name__ == ‘__main__’: import pythoncom pythoncom.PumpMessages() In the above code, if we delay one callback (OnMouseEventLeft), ..

Read more

from docx2pdf import convert import pythoncom #flask rest api @app.route(‘/api_v1/get_pdf/’,methods=[‘GET’]) def get_pdf(): if threading.currentThread ().getName () != ‘MainThread’: pythoncom.CoInitialize () convert(in_word,out_pdf ) I’m using docx2pdf to convert docx file to pdf in python, my script needs to execute when windows start( without login to windows ). in this mode the script raises error when converting ..

Read more

I am attempting to create a .exe on Windows 7 from a python3 script using cx_freeze. the Script involves using pywin32 to manipulate Excel files. I can build the .exe successfully from my setup.py file; however, when I run the .exe, the following error is thrown: Traceback (most recent call last): File “C:Python33libsite-packagescx_FreezeinitscriptsConsole3.py”, line 27, ..

Read more