1

I am trying to perform 'arcpy.Spatial Design Network Analysis.sDNAPrepare' command using ArcGIS Notebook on ArcGIS Pro (ver. 2.7.1). However, I have failed to run the command.

What is the problem and What should I do?

import arcpy
arcpy.ImportToolbox(r"D:/sDNA/sDNA.pyt")
arcpy.Spatial Design Network Analysis.sDNAPrepare(r"C:/Users/14009/Desktop/shanghai_sdna/shanghai_sdna_test/shanghai_network_center/shanghai_network_center.shp",  r"C:/Users/14009/Desktop/shanghai_sdna/shanghai_sdna_test/sdna_prepare_test/prepare_test.shp", None, None, "REPAIR", True, False, True, True, True, None, '', '', '', '', '', '')
-------------------------------------------------------------------
SyntaxError                       Traceback (most recent call last)
File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\ast.py, in parse:
Line 50:    return compile(source, filename, mode, flags,

SyntaxError: invalid syntax (<string>, line 3)

enter image description here

3
  • 1
    Please edit your question and include Python command and error message as text.
    – TomazicM
    Commented Apr 15, 2023 at 9:42
  • 1
    You have space characters between the text "spatial design network analysis", that is invalid syntax as the error message indicates.
    – Hornbydd
    Commented Apr 15, 2023 at 13:09
  • @user2856 you’re right - I mistook it for a picture and incorrectly voted to close it as a result.
    – PolyGeo
    Commented Apr 16, 2023 at 0:26

1 Answer 1

0

The sDNA authors have used an invalid alias for the ArcGIS Toolbox.

You can set your own alias (module_name parameter) in arcpy.ImportToolbox. E.g

arcpy.ImportToolbox(r"D:/sDNA/sDNA.pyt", "sDNA") 
arcpy.sDNA.sDNAPrepare(r"C:/Users/etc...")

Your Answer

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

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