pywin32

What's making this security descriptor go bad?

南笙酒味 提交于 2019-12-22 06:37:42
问题 I'm trying to read the access for files and directories in Windows using this code (patterned after Tim Golden's proposed patch to os.access to make it read from ACLs on Windows): from ctypes import( windll, wintypes, c_char_p, c_void_p, byref ) from win32api import GetCurrentThread from win32security import ( GetFileSecurity, DACL_SECURITY_INFORMATION, ImpersonateSelf, SecurityImpersonation, OpenThreadToken, TOKEN_ALL_ACCESS, MapGenericMask ) from ntsecuritycon import ( FILE_READ_DATA, FILE

Error “ValueError: can't format dates this early” on one PC, works on other

旧城冷巷雨未停 提交于 2019-12-22 01:12:41
问题 I have a Python script that works perfectly fine on my development PC. Both are Windows 7 with the same Python version (2.7.9). However on the target machine I get a ValueError: can't format dates this early The error seems to come from pywin32 module. The code uses a third-party library invoked by pywin32: raw = win32com.client.Dispatch("MyLib.MyClass") and then fails later on: acq_time = raw.GetCreationDate() Now I'm lost why this is working on my PC and not on the target machine. Both have

Alternative to psutil.Process(pid).name

蹲街弑〆低调 提交于 2019-12-21 17:40:19
问题 I have measured the performance of psutil.Process(pid).name and it turns out that it is more than ten times slower than for example psutil.Process(pid).exe . Because the last one of these functions requires different privileges over the path, I cannot just just extract the filename from the path. My question is: Are there any alternatives to psutil.Process(pid).name , which does the same? 回答1: You mentioned this is for windows. I took a look at what psutil does for windows. It looks like

pywin32 and excel. Exception when writing large quantities of data

こ雲淡風輕ζ 提交于 2019-12-21 05:30:05
问题 I am currently trying to write a large amount of data to an excel spreadsheet using the pywin32 libraries. As a simple example of the problem that I am facing take the following code to generate a 1000 cell x 1000 cell multiplication table. import win32com.client from win32com.client import constants as c xl = win32com.client.gencache.EnsureDispatch("Excel.Application") xl.Visible = True Workbook = xl.Workbooks.Add() Sheets = Workbook.Sheets tableSize = 1000 for i in range(tableSize): for j

Error while working with excel using python

末鹿安然 提交于 2019-12-21 05:06:12
问题 while my script is updating one excel same time if i am going to do any other work manually with another excel error occurs i am using dispatch from win32com.client import Dispatch excel = Dispatch('Excel.Application') excel.Visible = True file_name="file_name.xls" workbook = excel.Workbooks.Open(file_name) workBook = excel.ActiveWorkbook sheet=workbook.Sheets(sheetno) I am geting error like this (, com_error(-2147418111, 'Call was rejected by callee.', None, None) Is there is any way to

How to perform file-locking on Windows without installing a new package

泄露秘密 提交于 2019-12-20 01:08:39
问题 I've added code to a Python package (brian2) that places an exclusive lock on a file to prevent a race condition. However, because this code includes calls to fcntl , it does not work on Windows. Is there a way for me to place exclusive locks on files in Windows without installing a new package, like pywin32 ? (I don't want to add a dependency to brian2 .) 回答1: Since msvcrt is part of the standard library, I assume you have it. The msvcrt (MicroSoft Visual C Run Time) module only implements a

How to perform file-locking on Windows without installing a new package

二次信任 提交于 2019-12-20 01:08:33
问题 I've added code to a Python package (brian2) that places an exclusive lock on a file to prevent a race condition. However, because this code includes calls to fcntl , it does not work on Windows. Is there a way for me to place exclusive locks on files in Windows without installing a new package, like pywin32 ? (I don't want to add a dependency to brian2 .) 回答1: Since msvcrt is part of the standard library, I assume you have it. The msvcrt (MicroSoft Visual C Run Time) module only implements a

Removing windows from the taskbar, Windows 7

淺唱寂寞╮ 提交于 2019-12-19 11:47:16
问题 I have a little Tkinter application here, as well as a handle to the Tkinter window. What I'm trying to do is remove the window from the taskbar using some combination of Windows API calls. Basically I don't want the window to show up in the task bar. import Tkinter as tk import string import win32ui import win32con root = tk.Tk() handle = string.atoi(root.wm_frame(), 0) winhandle = win32ui.CreateWindowFromHandle(handle) root.mainloop() 回答1: I hope this helps, or at least guides you somehow.

LVITEM for windows 64 bit

眉间皱痕 提交于 2019-12-19 10:18:55
问题 For a long time I tried to use the LVM_GETITEMW message with LVIF_TEXT mask to get the text of a ListView. My program worked in 32 bit but not in 64 bit architecture. I discovered that the problem was at the LVITEM struct. Shortly, my question is which struct is the appropriate one for 64 bit and why. The struct I used as the LVITEMW struct had the following fields: ('mask', c_uint32), ('iItem', c_int32), ('iSubItem', c_int32), ('state', c_uint32), ('stateMask', c_uint32), ('pszText', c

Com server build using Python on 64-bit Windows 7 machine

天涯浪子 提交于 2019-12-19 09:46:37
问题 Original post is here: http://mail.python.org/pipermail/python-win32/2010-December/011011.html I am using: OS: 64 bit Windows 7 Professional Python: python-2.7.1.amd64 Python win32 extensions: pywin32-214.win-amd64-py2.7 Py2exe: py2exe-0.6.9.win64-py2.7.amd64 I am trying to build icon overlay for Windows. It has worked fine on 32 bit Windows but not working on 64 bit Windows 7. Here are the Python modules I have created for testing: test_icon_overlay.py: ( http://mail.python.org/pipermail