comtypes

Photoshop CC 2017 + Python

南楼画角 提交于 2019-12-13 08:18:00
问题 I have the exact same problem than the one described in this topic, with Photoshop CC 2017 , python 2.7.13 , comtypes 1.1.3 , windows 7 (all 64-bits) Trying to call a Photoshop method via python + comtypes raises a TypeError saying that the object is not callable: from comtypes.client import CreateObject psApp = CreateObject("Photoshop.Application.110") # edited to match photoshop CC 2017 #Create a new document- this is where it bombs out! psApp.Documents.Add(1024, 1024, 72, 'new_source

Python comtypes - '_Dispatch' object is not callable

杀马特。学长 韩版系。学妹 提交于 2019-12-11 18:29:13
问题 I have been using the comtypes module for Python to automate Photoshop, but I am getting a TypeError when I try to execute commands on windows8. These same commands have been working fine on windows7. This an example of the code I am using: from comtypes.client import CreateObject psApp = CreateObject("Photoshop.Application") #Create a new document- this is where it bombs out! psApp.Documents.Add(1024, 1024, 72, 'new_source_texture', 2, 1, 1) And this is the Traceback I get: Traceback (most

AttributeError: 'module' object as no attribute '_Application'

[亡魂溺海] 提交于 2019-12-11 18:08:59
问题 At end of my program, I am generating word file then converting this file to .pdf file format as the following: wdFormatPDF = 17 word = comtypes.client.CreateObject('Word.Application') doc = word.Documents.Open(resultfile) doc.SaveAs(resultfilepdf, FileFormat=wdFormatPDF) doc.Close() word.Quit() The program run properly but when I converting the .py to .exe using pyinstaller –onefile option I get the following error when executing the .exe file. Traceback (most recent call last): File "C:

Data Type Conversion Error while trying to dynamically add columns(fields) from excel in MS-Access database using Python

放肆的年华 提交于 2019-12-11 07:50:08
问题 I'm trying to populate the 1st row(i.e. the column names) from an excel sheet to the ms-access database, but it's giving me ' Data type conversion Error(3421) '. Any idea why this is happening ? from comtypes.client import CreateObject from xlrd import open_workbook,cellname import os from comtypes.gen import Access access = CreateObject('Access.Application') DBEngine = access.DBEngine db = DBEngine.CreateDatabase('test.mdb', Access.DB_LANG_GENERAL) excel_file = open_workbook('test_excel_file

Exception: Invalid object array with comtypes

不羁岁月 提交于 2019-12-11 05:46:46
问题 I try to implement a simple copy operation between two Autocad documents via COM in Python. from pyautocad import Autocad, APoint from comtypes.client import GetBestInterface # Get acad application acad = Autocad(create_if_not_exists=True) # Create a new document doc1 = GetBestInterface(acad.Application.Documents.Add()) # add a circle in this document and make it visible circle = GetBestInterface(doc1.ModelSpace.AddCircle(APoint(0.0, 0.0), 1.0)) doc1.Application.ZoomExtents() # create another

Python comtypes Photoshop 64-bits

*爱你&永不变心* 提交于 2019-12-11 02:53:35
问题 I have been using the comtypes module for Python to automate Photoshop CS5, but I am getting a TypeError when I try to execute commands on Photoshop 64-bit. These same commands have been working fine on Photoshop 32-bit. This an example of the code I am using: from comtypes.client import CreateObject psApp = CreateObject("Photoshop.Application") #Create a new document- this is where it bombs out! psApp.Documents.Add(1024, 1024, 72, 'new_source_texture', 2, 1, 1) And this is the Traceback I

Error when converting Excel document to pdf using comtypes in Python

ぃ、小莉子 提交于 2019-12-11 01:47:59
问题 I am trying to convert an Excel spreadsheet to PDF using Python and the comtypes package using this code: import os import comtypes.client FORMAT_PDF = 17 SOURCE_DIR = 'C:/Users/IEUser/Documents/jscript/test/resources/root3' TARGET_DIR = 'C:/Users/IEUser/Documents/jscript' app = comtypes.client.CreateObject('Excel.Application') app.Visible = False infile = os.path.join(os.path.abspath(SOURCE_DIR), 'spreadsheet1.xlsx') outfile = os.path.join(os.path.abspath(TARGET_DIR), 'spreadsheet1.pdf') doc

COM “get property” with multiple arguments

你离开我真会死。 提交于 2019-12-10 15:12:39
问题 I'm trying to call WindowsInstaller.Installer.ProductsEx from python, and can't figure out how to make it work. Here's a vbscript version of what I want to call from python: dim msi, products set msi = CreateObject("WindowsInstaller.Installer") set products = msi.ProductsEx("", "s-1-1-0", 7) I think my issue is ProductsEx is a read-only get property that takes 3 arguments, and I don't know how to convince win32com or comtypes to call it that way. I tried: >>> import win32com.client >>> msi =

Why can't I create a COM object in a new thread in Python?

瘦欲@ 提交于 2019-12-06 04:56:12
问题 I'm trying to create a COM Object from a dll in a new thread in Python - so I can run a message pump in that thread: from comtypes.client import CreateObject import threading class MessageThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.daemon = True def run(self): print "Thread starting" connection = CreateObject("IDMessaging.IDMMFileConnection") print "connection created" a = CreateObject("IDMessaging.IDMMFileConnection") print "aConnection created" t =

Can't import comtypes.gen

混江龙づ霸主 提交于 2019-12-05 15:17:48
I have comtypes 0.6.2 installed on Python 2.6. If I try this: import comtypes.gen I get: Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> import comtypes.gen ImportError: No module named gen Other imports like import comtypes and import comtypes.client , however, work fine. What am I doing wrong? From the name it seems comtypes.gen is generated code? If so, do I need certain preparatory steps before importing? I'm not logged in as administrator. Could that cause code generation to fail? Edit: The above problem is solved with a reload(comtypes.gen) (I don't understand