2

I have reached a point a little bit outside of my knowledge frame. Python.

I found that I can create multiple page reports with Python in ArcGIS Pro by combine 2 reports together. I am following this link from ESRI's site. I am using Report example 3.

I continue to get the following message :

Traceback (most recent call last):|File "<string>", line 6, in <module>
AttributeError: 'str' object has no attribute 'aprx'

I have tried several thing but lack an understanding.

What would my next step be?

Create a tool box that would allow me to make this a little more stream lined?

How do I define 'self'?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Feb 18, 2021 at 18:29
3
  • Where do you run the script in example 3? in a tool box or arcgis python console? Commented Feb 18, 2021 at 18:42
  • You cannot take example 3 by itself and it'll "work". It is an incomplete, and actually misleading or incorrect code sample. Its calling self.aprx, indicating that it may have been a copy of code from a bigger object. Commented Feb 18, 2021 at 18:46
  • @KadirŞahbaz I was going through arcgis python console. After playing with the script I came up with something that was able to merge the two PDF files. Commented Feb 19, 2021 at 18:18

1 Answer 1

5

There is a missing part in example 3. self is unknown. As @KHibma stated, it might be a part of a bigger project, probably a Python tool.

I am not able to test right now, but removing selfs and specifying aprx would solve the problem if you don't make a python tool.

Try in this way:

import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\path\to\file.aprx") # add a full path
# other lines
report1 = aprx.listReports(...
report2 = aprx.listReports(...
# other lines
answered Feb 18, 2021 at 18:47
1
  • This is almost exactly what I ended up with. Thank you Kadir and @Khibma both for the input. Commented Feb 19, 2021 at 18:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.