I am running a fairly large script where I export to a PDF. Now I added an export to Excel along with export to PDF from the same MXD. The Python window says python.exe has stopped working, ends then says restarts. I never had python crash on me before I added the export to Excel feature. can this be a memory issue? I ran the file from the command prompt and got this error or whatever you want to call it. Not sure what it means exactly
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'GpMetadataFunctions, Version=10.2.0.0, Culture=ne
eyToken=8fc3cc631e44ad86' or one of its dependencies. The system cannot find the file specified.
File name: 'GpMetadataFunctions, Version=10.2.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackC
kMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean fo
)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIn
at System.Reflection.Assembly.Load(String assemblyString)
at GetManagedType(Char* _assembly, Char* _path, Char* _className)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
*i do not save or close the mxd
*my code is very large so if anyone needs any more information I can provide it
export to excel code
in_excel = fc
out_excel = "C:path\\{}{}.xls".format(table['County'],table['MunName'])
arcpy.TableToExcel_conversion(in_excel, out_excel)
this is my export to PDF code
table['zoom'] = arcpy.mapping.Layer("UnionLayer")
arcpy.SelectLayerByAttribute_management(table['zoom'])
df.extent = table['zoom'].getSelectedExtent()
df.scale = df.scale * 1.1
arcpy.RefreshActiveView()
PDFMap = arcpy.mapping.ExportToPDF(mxd, table['County']+" "+table['MunName']+" "+"Zoom Out")
The script always crashes on the second iteration right before the export to excel. the first iteration it works fine. the export to excel occurs before the export to PDF.
UPDATE
Instead of using the table to excel conversion I used a search cursor to extract the info i wanted and tried writing to a csv and I encountered the same problem. The answer does not seem to be in my code. Has anyone ever encountered a similar error? I have found this post https://geonet.esri.com/thread/61030 which alludes to the same message I get..the person on the post says "I had to copy GpMetadataFunctions.dll and MetadataTranslator.dll to the Global Assembly Cache (GAC) directory."
No comments:
Post a Comment