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'?

  • Where do you run the script in example 3? in a tool box or arcgis python console? Feb 18 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.
    – KHibma
    Feb 18 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.
    – KgEcology
    Feb 19 at 18:18

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
  • This is almost exactly what I ended up with. Thank you Kadir and @Khibma both for the input.
    – KgEcology
    Feb 19 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.