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:\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.')
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
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.