In the documentation:
.# Create the new utility network
arcpy.pt.StageUtilityNetwork(sde, service_territory, dataset, network_name)
I'm running stand-alone script, and got the error message"
in <module>
arcpy.pt.StageUtilityNetwork(
AttributeError: module 'arcpy' has no attribute 'pt'
Not sure why this is happening..
Solved! Go to Solution.
Many thanks @Vicky for the hint!
So this simply and only worked for me: arcpy.StageUtilityNetwork_pt()
Yes, I made sure I already have the cloned python environment.
What version of untools do you have installed? You can check by running the following from Python window:
import untools
print(untools.__version__)
Do you see the Utility Network Package Tools toolbox?
It's 2.3.2, I ran your command in Pro python editor.
However, if I run it in a stand-alone, it gives exception, and at the end of the long error traceback:
raise ImportError('dateutil 2.5.0 is the minimum required version')
ImportError: dateutil 2.5.0 is the minimum required version
I also upgraded both to the ArcPro 2.3.3, and untools 2.3.3, still got the same error message:
arcpy.pt.StageUtilityNetwork(
AttributeError: module 'arcpy' has no attribute 'pt'
Did this machine have a previous version of Pro (eg 2.2) installed? Can you post a screenshot of the python backstage?
Not sure if you got the solution yet.
It might worth to check with your python path where you installed the untools.
untools is normally required a clone python environment and it's a different python path from default ArcGIS Pro python location.
The different python path can be viewed from ArcGIS Pro /Python/management environment.
It will look similar to "C:\Users\Administrator\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone"
you can execute the arcpy.pt.StageUtilityNetwork() or arcpy.StageUtilityNetwork_pt() from there afer import arcpy library.
Many thanks @Vicky for the hint!
So this simply and only worked for me: arcpy.StageUtilityNetwork_pt()
Yes, I made sure I already have the cloned python environment.
Hi Sami,
Good to know that at least one of the method is working for you.
UtilityNetworkPackageTools arcpy.pt is a module of the ArcPy site package. Both arcpy.pt.StageUtilityNetwork() and arcpy.StageUtilityNetwork_pt() are the same function but use different name/way to call the function of UtilityNetworkPackageTools.
Somehow, you are not able to load the pt module but call arcpy.StageUtilityNetwork_pt() directly. It might something wrong in the python clone environment with an installed site package.
May try to clone another python environment and install untools again through ArcGIS Pro> Python Package Manager. Then test the pt model again in the new clone environment.
I used the ArcGIS Pro 2.3.3 with untools 2.3.3.