pywin32

Access denied when attempting to remove printer

痴心易碎 提交于 2020-06-17 05:07:39
问题 def on_printer_button_clicked(self, button): for i in range(len(self.printer_buttons)): if button == self.printer_buttons[i]: pHandle = win32print.OpenPrinter(self.printers[i]['pPrinterName']) win32print.DeletePrinter(pHandle) return So all I'm doing is opening the printer handle and calling the function Delete Printer, as you can see. Here's what I get in the console when I run the function: uninstall_windowGUI.py", line 57, in on_printer_button_clicked win32print.DeletePrinter(pHandle)

Access denied when attempting to remove printer

好久不见. 提交于 2020-06-17 05:06:53
问题 def on_printer_button_clicked(self, button): for i in range(len(self.printer_buttons)): if button == self.printer_buttons[i]: pHandle = win32print.OpenPrinter(self.printers[i]['pPrinterName']) win32print.DeletePrinter(pHandle) return So all I'm doing is opening the printer handle and calling the function Delete Printer, as you can see. Here's what I get in the console when I run the function: uninstall_windowGUI.py", line 57, in on_printer_button_clicked win32print.DeletePrinter(pHandle)

PyWin32 and Python 3.8.0

冷暖自知 提交于 2020-05-17 07:12:46
问题 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

Capturing screenshots with win32api python returns black image

ぃ、小莉子 提交于 2020-05-16 03:24:45
问题 I've used the following code examples to capture a screenshot: https://stackoverflow.com/a/3260811 https://stackoverflow.com/a/24352388/5858697 When taking a screenshot of Firefox or chrome, they return a blank black image. Capturing a screenshot of notepad works fine. I've done some research on this and I think it's because they're gpu accelerated. Other screenshot libraries work but I need to have it so I can capture a screenshot of an application even if it's not currently visible. Has

PyInstaller does not recognize downloaded pywin32

血红的双手。 提交于 2020-05-11 05:33:30
问题 I have downloaded Python 2.7.3, PyInstaller (compatible with 2.7) and pywin32 (compatible with 2.7) and restarted my machine, but when I enter the prompt: pyinstaller.py [opts] nameofscript.py The prompt then tells me: Error: PyInstaller for Python 2.6+ on windows needs pywin32. Please install from http://sourceforge.net/projects/pywin32/ Why is it that PyInstaller can't "see" that I have already downloaded pywin32? 回答1: If you are using Python 2.7, the compat.py in the C:/Python27/Lib/site

PyInstaller does not recognize downloaded pywin32

梦想的初衷 提交于 2020-05-11 05:32:52
问题 I have downloaded Python 2.7.3, PyInstaller (compatible with 2.7) and pywin32 (compatible with 2.7) and restarted my machine, but when I enter the prompt: pyinstaller.py [opts] nameofscript.py The prompt then tells me: Error: PyInstaller for Python 2.6+ on windows needs pywin32. Please install from http://sourceforge.net/projects/pywin32/ Why is it that PyInstaller can't "see" that I have already downloaded pywin32? 回答1: If you are using Python 2.7, the compat.py in the C:/Python27/Lib/site

PyInstaller does not recognize downloaded pywin32

人走茶凉 提交于 2020-05-11 05:32:19
问题 I have downloaded Python 2.7.3, PyInstaller (compatible with 2.7) and pywin32 (compatible with 2.7) and restarted my machine, but when I enter the prompt: pyinstaller.py [opts] nameofscript.py The prompt then tells me: Error: PyInstaller for Python 2.6+ on windows needs pywin32. Please install from http://sourceforge.net/projects/pywin32/ Why is it that PyInstaller can't "see" that I have already downloaded pywin32? 回答1: If you are using Python 2.7, the compat.py in the C:/Python27/Lib/site

python SQLServer 存储图片

馋奶兔 提交于 2020-05-09 16:19:11
需求是需要用python往 SqlServer中的image类型字段中插入二进制图片 核心代码,研究好几个小时的代码: 安装pywin32,adodbapi 安装pywin32,adodbapi image_url = " 图片链接 " try : image_result = session.get(url=image_url, headers=headers, stream= True) except : image_result = session.get(url=image_url, headers=headers, stream= True) local_filename = md5(image_url) + " .png " print " 图片下载成功 " with open(local_filename, ' wb ' ) as f: for chunk in image_result.iter_content(chunk_size=1024 ): if chunk: # filter out keep-alive new chunks f.write(chunk) f.flush() f.close() # 读取图片,二进制格式,注意是rb f1 = open(local_filename, " rb " , ) b = f1.read() f1.close()

Python GUI界面编程-初识

时间秒杀一切 提交于 2020-05-03 18:30:56
图形用户界面(Graphical User Interface,简称 GUI,又称图形用户接口)是指采用图形方式显示的计算机操作用户界面。与早期计算机使用的 命令 行界面相比,图形界面对于用户来说在视觉上更易于接受。然而这界面若要通过在显示屏的特定位置,以"各种美观而不单调的视觉消息"提示用户"状态的改变",势必得比简单的消息呈现花上更多的计算能力。 GUI概述 图形用户界面(Graphical User Interface,简称 GUI,又称图形用户接口)是指采用图形方式显示的计算机操作用户界面。与早期计算机使用的 命令 行界面相比,图形界面对于用户来说在视觉上更易于接受。然而这界面若要通过在显示屏的特定位置,以"各种美观而不单调的视觉消息"提示用户"状态的改变",势必得比简单的消息呈现花上更多的计算能力。在 GUI 中,并不只是键入文本和返回文本,用户可以看到窗口、按钮、文本框等图形,而且可以用鼠标单击,还可以通过键盘键入,GUI 是与程序交互的一种不同的方式。 Python GUI常用框架 Flexx Flexx是一个纯Python工具包,用于创建图形用户界面(GUI),它使用Web技术进行渲染。 应用程序完全用Python编写;PScript转换器动态生成必要的JavaScript。 项目地址:https://github.com/flexxui/flexx 入门指南

Python ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。

南笙酒味 提交于 2020-05-02 18:19:24
运行Python代码出现: ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。 解决方法:去下载与你所安装的Python版本对应的pywin32并安装 下载链接:https://sourceforge.net/projects/pywin32/files/pywin32/ import _win32sysloader ImportError: DLL load failed: %1 不是有效的 Win32 应 之前遇到的问题是利用pyinstaller方法打包py应用,报错 import _win32sysloader(pywin32) ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。 解决: 1.先卸载32位的pywin32,卸载如有问题,可参考: Python问题--Cannot uninstall 'pywin32'. It is a distutils installed project and thus we cannot accurately.... - 明媚如你 - 博客园 2.下载安装64位的 pywin32 D:\Python27\Scripts\pip.exe install pywin32-223-cp27-cp27m-win_amd64.whl 安装成功后