POST
|
Since enabling/disabling Backgrount geoprocessing in ArcMap (geoprocessing options) made no difference, I now uninstalled "Background Geoprocessing (64-bit)". This made a bit confusion: I could not find IDLE any more and PyScripter didn't start, so I had to reinstall PyScripter and find the IDLE.bat but now it works. And you were perfectly right: my script runs like a charm from PyScripter, from IDLE and from command prompt. Thank you very much.
... View more
02-26-2018
06:25 AM
|
0
|
0
|
249
|
POST
|
I ran the script from PyScripter, Idle, command prompt: no success I ran the script with and without background processing switched on: no difference I ran the script from PyScripter with or without ArcMap running: no difference I ran the script from the Toolbox and from a python window in ArcMap: successful! I ran the script from the Toolbox and from a python window in project.mxd or with a new ArcGIS-project open: no difference (in both cases successful). I ran the script with or without "dataset_option": no difference I modified the script for for debugging: import arcpy mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Transportation")[0] lyr = arcpy.mapping.ListLayers(mxd, "Accidents", df)[0] outPDF =r"C:\Project\Output\ProjectReport.pdf" RLFfile =r"C:\Project\Project.rlf" try: print(lyr) print(outPDF) print(RLFfile) print("start try") arcpy.mapping.ExportReport(report_source=lyr, report_layout_file=RLFfile, output_file=outPDF) print("end try") finally: print("start finally") del mxd The result (PyScripter) is: Accidents C:\Project\Output\ProjectReport.pdf C:\Project\Project.rlf start try start finally Traceback (most recent call last): File "<string>", line 254, in run_nodebug File "C:\Project\reportscript.py", line 15, in <module> output_file = outPDF) File "C:\WinApps\CAD-GIS\GIS\ArcGIS\Desktop10.6\ArcPy\arcpy\utils.py", line 182, in fn_ return fn(*args, **kw) File "C:\WinApps\CAD-GIS\GIS\ArcGIS\Desktop10.6\ArcPy\arcpy\mapping.py", line 532, in ExportReport return report_source._arc_object.ExportReport(*gp_fixargs((report_layout_file, output_file, dataset_option, report_title, starting_page_number, page_range, report_definition_query, extent, field_map), True)) RuntimeError: Error in generating report The error-message does not give me any hints. I'm stumped.
... View more
02-26-2018
02:38 AM
|
0
|
2
|
1021
|
POST
|
It seems I found the solution: I always run the script from the IDLE. If I run it by a tool (without parameters) from the toolbox it does not fail. Thank you for your help. You put me on the right path...
... View more
02-23-2018
10:15 AM
|
0
|
4
|
1021
|
POST
|
Today I updated to 10.6. No change. (Win 10 Ver.1709) I am using basic licence. But this should not make a difference because I am able to create the report using VIEWS>REPORTS>CREATE REPORTS. I am also using "Background Geoprocessing (64-bit)". The installation-Path is set by company guideline (also installation-path of python) - this is not my idea, but we never had problems with that. I didn't change anything else during installation.
... View more
02-23-2018
10:03 AM
|
0
|
0
|
1021
|
POST
|
In the "project.zip" you find the mxd, the data (accidents-shape), the report and the script. As you see I followed your suggestion with the named parameters but without success. I also tried a point-shapefile instead of a polygon-FC (default.gdb) - same result. It would be appreciated, if you could have a look into my data. Thank you. Oliver
... View more
02-23-2018
06:18 AM
|
0
|
2
|
1021
|
POST
|
Thanks for your reply. I used exactly the example from the online Help which is: import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Transportation")[0]
lyr = arcpy.mapping.ListLayers(mxd, "Accidents", df)[0]
arcpy.mapping.ExportReport(lyr,
r"C:\Project\Project.rlf",
r"C:\Project\Output\ProjectReport.pdf",
"EXTENT",
extent=df.extent)
del mxd To do so I created all necessarily Data to match the script: - Create a path in c:\Project - create a new Project.mxd - rename the "Layers"-Dataframe to "Transportation" - create a FC and Layer "Accidents" (located in the default-fGDB: C:\Users\or\Documents\ArcGIS\Default.gdb) with three polygons. - create a Project.rlf file from Layer "Accidents" by using VIEWS>REPORTS>CREATE REPORTS (Report Fields: ObjectID, Shape_length, Shape_Area; all other settings: default) Hope this helps. Oliver
... View more
02-21-2018
12:02 AM
|
0
|
4
|
1021
|
POST
|
Hello, I am using ArcGIS 10.5 Basic. I try to create an Report using Python. I always get an error. So finally I tried the Example 1 from the online-help (ExportReport—Help | ArcGIS Desktop 😞 I created a mxd with the File name C:\Project\Project.mxd, I created a Feature-Layer "Accidents" with some polygons. I created a report using VIEW > REPORTS > CREATE REPORT and saved it as "C:\Project\Project.rlf" Finally I copied the code in a script "C:\Users\or\Documents\ArcGIS\test1.py" and run. This is the message: Traceback (most recent call last): File "<string>", line 254, in run_nodebug File "C:\Users\or\Documents\ArcGIS\test1.py", line 8, in <module> "SELECTED") File "C:\WinApps\CAD-GIS\GIS\ArcGIS\Desktop10.5\ArcPy\arcpy\utils.py", line 182, in fn_ return fn(*args, **kw) File "C:\WinApps\CAD-GIS\GIS\ArcGIS\Desktop10.5\ArcPy\arcpy\mapping.py", line 532, in ExportReport return report_source._arc_object.ExportReport(*gp_fixargs((report_layout_file, output_file, dataset_option, report_title, starting_page_number, page_range, report_definition_query, extent, field_map), True)) RuntimeError: Error in generating report. Any Idears? Thanks, Oliver
... View more
02-19-2018
08:09 AM
|
0
|
12
|
1871
|
Online Status |
Offline
|
Date Last Visited |
11-30-2020
04:37 AM
|