简体   繁体   English

python win32com调度因“ CrystalRuntime.Application”而失败(64位问题)

[英]python win32com Dispatch fails with 'CrystalRuntime.Application' (64bit issue)

The essential details here are as follows: 这里的基本细节如下:

  • Windows Server 2008 64bit Windows Server 2008 64位
  • Python26 64bit Python26 64位
  • Visual Studio 2008(Team) which installs Crystal Reports (both 32bit and 64bit runtimes) 安装了Crystal Reports(32位和64位运行时)的Visual Studio 2008(Team)

My problem is the following code fails when Dispatch('CrystalRuntime.Application') is called, this worked fine on same 32bit OS configuration of the above. 我的问题是,调用Dispatch('CrystalRuntime.Application')时,以下代码失败,这在上述相同的32位OS配置上正常运行。

The error being: 错误是:

(-2147221164, 'Class not registered', None, None)

I've spent hours going through various reason why this is failing and I've got nowhere.. 我已经花了几个小时来研究失败的各种原因,但我却一无所获。

I've even run makepy.py on the 'Crystal Reports ActiveX Designer Run Time Library' which contains the com interface I'm trying to create, but even this fails to deliver a result. 我什至在“ Crystal Reports ActiveX Designer运行时库”上运行makepy.py,该包含我要创建的com接口,但即使这样也无法提供结果。

I know crystal is installed correctly as it works perfectly well and I can see the com classes registered correctly. 我知道crystal安装正确,因为它可以很好地工作,并且我可以看到com类已正确注册。

I completely stuck and need help, as always i hope stack can come to my rescue again... 我完全陷入困境,需要帮助,一如既往,我希望堆栈可以再次帮助我...

Any thoughts, please bear in mind i'm not a python programmer of any magnitude... 任何想法,请记住我不是任何规模的python程序员...

import os
import sys
import re
import time
from win32com.client import Dispatch
import pythoncom

def main():

    try:
        app = Dispatch('CrystalRuntime.Application')
        print app
    except pythoncom.com_error, e:
        print "(crystal reports not installed?): '%s'" % e
        return 0

    print 'Success!!!'


if __name__ == '__main__':
    main()

When I use py26 with Excel, I've found that this syntax works better. 当我将py26与Excel结合使用时,我发现此语法效果更好。

Excel_App = win32com.client.gencache.EnsureDispatch('Excel.Application')

Maybe that can be altered to fit crystal reports.. 也许可以更改以适合水晶报表。

App= win32com.client.gencache.EnsureDispatch('CrystalRuntime.Application')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python win32com-同时安装32位和64位版本的应用程序 - Python win32com - application installed with both 32bit and 64bit versions 使用python 64位win32com(Solidworks-API)时发生异常:SldWorks.Application.InvokeTypes异常 - Exception occured during using python 64bit win32com (Solidworks-API): Exception SldWorks.Application.InvokeTypes win32com分发32位版本的TestStand - win32com Dispatch the 32 bit version of TestStand 便携应用在win32com浏览器中不显示,如何调度? - Portable application not showing in win32com browser, how to dispatch it? 使用Win32com Dispatch启动Matlab,应用程序自行关闭 - Starting matlab with win32com Dispatch, application closes itself Python-Win32Com客户端调度按计划任务挂起 - Python - Win32Com Client Dispatch Hanging as Scheduled Tasks 适用于我的应用程序的python win32com CreateShortcut密钥 - python win32com CreateShortcut key for my application 外部应用程序中的Python win32com模块保存命令 - Python win32com module save command in external application Python / win32com /尝试并除外/检查应用程序是否正在运行 - Python / win32com / try and except / check if application is running 试图使用win32com使用Python调度SASEGObjectModel COM对象的问题 - Issues trying to Dispatch a SASEGObjectModel COM Object with Python using win32com
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM