安装和运行pywin32 2.7时出错 [英] Error installing and running pywin32 2.7

查看:109
本文介绍了安装和运行pywin32 2.7时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装后出现几个错误:

pywin32-217.win32-py2.7

pywin32-217.win32-py2.7

我最近将ArcGIS升级到10.1,它使用Python 2.7(与ArcGIS 10.0随附的2.6相对)

I have recently upgraded ArcGIS to 10.1 and it uses Python 2.7 (as opposed to 2.6 that came with ArcGIS 10.0)

当我在Windows 7 64位系统上运行安装程序时,它会安装,但会抛出以下消息:

When I run the installer on a Windows 7 64 bit, it installs, but throws the following message:

关闭失败的文件对象析构函数:

close failed in file object destructor:

sys.excepthook丢失

sys.excepthook is missing

丢失了sys.stderr

lost sys.stderr

我有一个简单的python脚本,可以从包含.pdf文件的文件夹中打印到打印机,该文件在升级前就可以使用

I had a simple python script to print to a printer from a folder containing .pdf files which worked before my upgrade

import arcpy, glob, win32api, os

pdfLoc = arcpy.GetParameterAsText(0)

try:
    copies = int(arcpy.GetParameter(1))
except:
    copies = 1

for pdfname in glob.glob(os.path.join(pdfLoc, "*.pdf")):
    fullpath = os.path.join(pdfLoc, pdfname)
    for copy in range(copies):
        win32api.ShellExecute(0, "print", pdfname, None, ".", 0)

del fullpath
del pdfname
del pdfLoc

现在,当我运行脚本时,出现以下错误:

Now when I run the script, I get the following error:

回溯(最近通话最近):文件 "Z:\ ESRI \ Python \ Solstice_Tools_Scripts \ Printer_Tools \ Batch_Print_From_PDF_Only \ BatchprintFromPDFOnly_Test.py", 第34行,在 win32api.ShellExecute(0,"print",pdfname,None,.",0)错误:(31,'ShellExecute','连接到系统的设备未安装 功能."

Traceback (most recent call last): File "Z:\ESRI\Python\Solstice_Tools_Scripts\Printer_Tools\Batch_Print_From_PDF_Only\BatchprintFromPDFOnly_Test.py", line 34, in win32api.ShellExecute(0, "print", pdfname, None, ".", 0) error: (31, 'ShellExecute', 'A device attached to the system is not functioning.')

执行失败(BatchPrintFromPDFOnly2).

Failed to execute (BatchPrintFromPDFOnly2).

我一直在使用Google搜索,并尝试了一些解决方案,例如以故障排除模式运行可执行文件,但是错误仍然存​​在.谁能建议可能导致这种情况的原因?

I've been googling around and have tried a few solutions, like running the executable in troubleshooting mode, but the error persists. Can anyone suggest what may cause this?

作为旁注,我将公司中的4台计算机升级到了新版本的python和ArcGIS,只有其中一台抛出此错误.其余的工作正常.

As a side note, I upgraded 4 computers in my company to the new version of python and ArcGIS, and only one of them is throwing this error. The rest work fine.

谢谢, 迈克

推荐答案

我遇到了同样的问题,但是解决了一些不同的问题.不必创建另一个管理员帐户,而是可以从以以管理员身份运行开头的命令提示符下成功执行pywin32-217.win32-py2.7.exe.

I had the same problem, but solved it a bit differently. Instead of creating another admin account, I was able to execute the pywin32-217.win32-py2.7.exe successfully from a command prompt that I started with Run as Administrator.

这篇关于安装和运行pywin32 2.7时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆