pywin32

get window handler from started process

て烟熏妆下的殇ゞ 提交于 2020-02-03 10:26:49
问题 I see there's win32process.GetWindowThreadProcess() that gets a window handler and returns it's process id. Is there a way to do the opposite: get the window handler of a running process by it's process id? Something like win32gui.GetWindowHandler(processId) ? Specifically What I'm trying to do: I have a python script that runs an external program, lets say notepad.exe. Notepad is fired when runProgram() method is called. I want to prevent this method from running Notepad more than once. I

get window handler from started process

ぐ巨炮叔叔 提交于 2020-02-03 10:26:09
问题 I see there's win32process.GetWindowThreadProcess() that gets a window handler and returns it's process id. Is there a way to do the opposite: get the window handler of a running process by it's process id? Something like win32gui.GetWindowHandler(processId) ? Specifically What I'm trying to do: I have a python script that runs an external program, lets say notepad.exe. Notepad is fired when runProgram() method is called. I want to prevent this method from running Notepad more than once. I

PyInstaller win32ctypes.pywin32.pywintypes.error: (2, 'LoadLibraryExW', 'The system cannot find the file specified.')

混江龙づ霸主 提交于 2020-01-30 05:21:19
问题 While using PyInstaller (dev version 4.0.dev0+8196c57ab), produced an OSError: [WinError 2] 'The system cannot find the file specified.' Python version: 3.7 GUI: PySide2 5.13.0 Other packages: lxml, BeautifulSoup, Matplotlib (with dependencies like numpy), Pandas, pypiwin32, reportlab, Theano Anaconda 3, Windows Compiled with PyInstaller --onedir What I've tried: Tried downgrading PyInstaller to 2.1 as suggested here: https://github.com/pyinstaller/pyinstaller/issues/3916 but doesn't work as

excel access denied with win32 python pywin32

自作多情 提交于 2020-01-24 20:03:43
问题 My code is #Opens template for creating final report excel = win32.dynamic.Dispatch('Excel.Application') template = os.path.abspath((folderpath+'\Poop.xlsx')) wb = excel.Workbooks.Open(template) freshws= wb.Sheets("Fresh") #Sheet names must match perfectly secws= wb.Sheets("sec") cur.execute("Select * from FIRALL") freshdata=list(cur.fetchall()) #writes to the first sheet datarowlen=0 for i,a in enumerate(freshdata): datarowlen = len(a) for j,b in enumerate(a): freshws.Cells(i+1,j+1).Value =

How to install pywin32 in virtualenv with python 2.7 64 bit?

隐身守侯 提交于 2020-01-22 17:53:28
问题 I wonder right way to install on virtualenv with 64 bit python 2.7 pywin32 module (Operating system is Windows 7 64 bit). I've found exe installer on Sourceforge. When i run easy_installer on command line first everything goes fine but soon i see strange behavior: while pywin32-216.win-amd64-py2.7 installs it runs pywin32-216-py2.7-win32.egg and it fails with error: No local packages or download links found for pywin32==216 Best match: None And here is my full log: (sandbox_virtenv) D:\test

win32com.client.Dispatch(“Outlook.Application”) error pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

廉价感情. 提交于 2020-01-22 12:25:08
问题 I am on windows 7 and I have windows live installed. Now when I am trying to run following code import win32com.client win32com.client.Dispatch("Outlook.Application") I am getting following error Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,c lsctx) File "C:\Python27\lib\site-packages\win32com\client\dynamic

Using PythonService.exe to host python service while using virtualenv

旧街凉风 提交于 2020-01-20 04:05:14
问题 I've got a Windows 7 environment where I need to develop a Python Windows Service using Python 3.4. I'm using pywin32's win32service module to setup the service and most of the hooks seem to be working ok. The problem is when I attempt to run the service from source code (using python service.py install followed by python service.py start ). This uses PythonService.exe to host service.py - but I'm using a venv virtual environment and the script can't find it's modules (error message

PyWin32 and Python 3.8.0

亡梦爱人 提交于 2020-01-18 17:34:34
问题 Python 3.8.0 has been recently released (on 20191014 , and can be downloaded from [Python]: Python 3.8.0). PyWin32 has builds for it on [PyPI]: pywin32 225 (released on 20190915 ). Unfortunately, after pip install ing, it doesn't work. Sample: [cfati@CFATI-5510-0:e:\Work\Dev\StackOverflow\q058631512]> sopr.bat *** Set shorter prompt to better fit when pasted in StackOverflow (or other) pages *** [prompt]> "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" Python 3.7.3 (v3.7.3

PyWin32 and Python 3.8.0

心已入冬 提交于 2020-01-18 17:24:44
问题 Python 3.8.0 has been recently released (on 20191014 , and can be downloaded from [Python]: Python 3.8.0). PyWin32 has builds for it on [PyPI]: pywin32 225 (released on 20190915 ). Unfortunately, after pip install ing, it doesn't work. Sample: [cfati@CFATI-5510-0:e:\Work\Dev\StackOverflow\q058631512]> sopr.bat *** Set shorter prompt to better fit when pasted in StackOverflow (or other) pages *** [prompt]> "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" Python 3.7.3 (v3.7.3

python win32com shell.SHFileOperation - any way to get the files that were actually deleted?

荒凉一梦 提交于 2020-01-17 04:27:07
问题 In the code I maintain I run across: from win32com.shell import shell, shellcon # ... result,nAborted,mapping = shell.SHFileOperation( (parent,operation,source,target,flags,None,None)) In Python27\Lib\site-packages\win32comext\shell\ (note win32comext) I just have a shell.pyd binary. What is the return value of shell.SHFileOperation for a deletion ( operation=FO_DELETE in the call above) ? Where is the code for the shell.pyd ? Can I get the list of files actually deleted from this return