I am coming up with a couple errors after installing:
pywin32-217.win32-py2.7
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)
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 is missing
lost sys.stderr
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:
Traceback (most recent call last): File
"Z:ESRIPythonSolstice_Tools_ScriptsPrinter_ToolsBatch_Print_From_PDF_OnlyBatchprintFromPDFOnly_Test.py",
line 34, in
win32api.ShellExecute(0, "print", pdfname, None, ".", 0) error: (31, 'ShellExecute', 'A device attached to the system is not
functioning.')
Failed to execute (BatchPrintFromPDFOnly2).
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?
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.
Thanks,
Mike
See Question&Answers more detail:
os