Import Error When Running Toolbox

439
3
03-16-2020 10:45 AM
SumLam
by
New Contributor
I am using the Urban Network Analysis toolbox by City Form Lab Urban Network Analysis Toolbox for ArcGIS — City Form Lab. But it doesn't seem to work for me.
When I run it with the Test Files provided, the following error shows up.
Traceback (most recent call last):
  File "C:\Users\*\Urban Network Analysis Toolbox\src\Centrality_Main.py", line 7, in <module>
    from Centrality.Main import main
  File "C:\Users\*\Urban Network Analysis Toolbox\src\Centrality\Main.py", line 28, in <module>
    from arcpy import mapping
ImportError: cannot import name 'mapping'
 Failed to execute (Centrality).
It seems that mapping is now changed to mp according to this article https://pro.arcgis.com/en/pro-app/arcpy/mapping/migratingfrom10xarcpymapping.htm
But even I change mapping into mp in the code, this error repeats for 'from Adjacency_List_Computation import compute_adjacency_list', 'from Centrality_Computation import compute_centrality' and 'from Constants import xxx' from line 36 to 116 of Centrality\Main.py . 
This tool was designed to use with ArcGIS 10.2, but I am using ArcGIS Pro 2.4 since it is the version of trail available, is that the reason the toolbox doesn't work? If so, is there any way to fix it?
Alvin
0 Kudos
3 Replies
DanPatterson_Retired
MVP Emeritus

It is designed to work with ArcMap apparently.  If you are using ArcGIS Pro, it won't work without recoding.  Contact the authors and see if they have a version for ArcGIS Pro.

PS ArcMap 10.2 was a long time ago and is into the "mature" phase, meaning, nothing more will be done to support it

0 Kudos
SumLam
by
New Contributor

Thank you for the reply.

May I also know to what extend it need to be recoded? Is it possible to make it work by changing the import section only? And where could I find some tutorial?

Like mapping it should be changed to mp, does anyone have clue about 'Constants' and the remaining?

0 Kudos
DanPatterson_Retired
MVP Emeritus

on top of that, python 2 vs python 3 changes may be involved.

Urban Network Analysis Toolbox for ArcGIS — City Form Lab .... there is a forum link... try there to see if an updated version is available

0 Kudos