我是arcgis pro 3.0.3桌面,想分享一个工具箱,里面包含一个python脚本工具,我和同事一起创建的。在我的电脑上,我能够打开,运行和利用这个工具没有任何问题。当我共享工具箱时,我的同事可以将工具箱添加到他的地图项目中,并打开它,但在运行它时得到一个无法打开工具箱的错误。< / P >Monitoring Plots Generator 1 ===================== ParametersBoundary layer woodland_18048_ExportFeature1 Woodland ID 18048 Boundary Acres 144 Intermediate Ouput Geodatabase C:\Users\btroxel\OneDrive - American Forest Foundation\Documents - FAMILY FOREST CARBON PROGRAM\Geospatial Library\_MRV cross-regional\Python Scripts\test_properties\scratch.gdb Final Plot Save GDB C:\Users\btroxel\OneDrive - American Forest Foundation\Documents - FAMILY FOREST CARBON PROGRAM\Geospatial Library\_MRV cross-regional\Python Scripts\test_properties\test_properties.gdb Final Plot Projection GEOGCS["GCS_Assumed_Geographic_1",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] ===================== MessagesStart Time: Wednesday, January 4, 2023 12:20:06 PM Traceback (most recent call last): File "C:\Users\btroxel\OneDrive - American Forest Foundation\Documents - FAMILY FOREST CARBON PROGRAM\Geospatial Library\_MRV cross-regional\Plot_generator\MRV.atbx#MonitoringPlotsGenerator1_MRV.py", line 23, in <module> File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 171, in ImportToolbox return import_toolbox(input_file, module_name) File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\toolbox_code.py", line 486, in import_toolbox toolbox = gp.createObject("Toolbox", tbxfile) File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 389, in createObject self._gp.CreateObject(*gp_fixargs(args, True))) OSError: The toolbox file C:\Users\btroxel\American Forest Foundation\FAMILY FOREST CARBON PROGRAM - Documents\Geospatial Library\_MRV cross-regional\Plot_generator\MRV.atbx was not found.Failed script (null)... Failed to execute (MonitoringPlotsGenerator1). Failed at Wednesday, January 4, 2023 12:20:06 PM (Elapsed Time: 0.23 seconds)
Feel free to download the folder containing the python scripts and toolbox. The screenshot also shows that the toolbox does exist on his computer. I will try to summarize the tool as best as I can.
The MRV plots generator was created to randomly generate between 9-11 plots/points within a boundary that can be of any shape or size (can also be a multi-part polygon). It will take into account the acreage of the boundary and mathematically calculate the initial spacing of the points to try to get to the right number of plots. To further randomize, it will shift and rotate the points by some random amount/angle. It works great on my computer, but I need to be able to share it!
It has some hacky python scripting because I am a novice at this, but I tried to put in a comments to help describe the process. The mesh points creation, the rotation and shifting of the points is all using tools developed by @DanPatterson_Retired which were huge in making this tool possible.
Toolbox has an alias, so I know that isn't the issue. The line that brings in the toolbox is
arcpy.ImportToolbox( r"{}\American Forest Foundation\FAMILY FOREST CARBON PROGRAM - Documents\Geospatial Library\_MRV cross-regional\Plot_generator\MRV.atbx".format(os.path.expanduser('~')))I have the expand user bit in there because it is saved on OneDrive and the start of the pathname changes based on the user. This is where I am guessing the problem lies, but I am lost on how to fix it.
Any assistance is appreciated, thank you!
-
无法导入工具箱ArcGIS pro 3.0.3
//www.gamepadva.com/t5/python-questions/unable-to-import-toolbox-arcgis-pro-3-0-3/m-p/1246231#M66449
我是arcgis pro 3.0.3桌面,想分享一个工具箱,里面包含一个python脚本工具,我和同事一起创建的。在我的电脑上,我能够打开,运行和利用这个工具没有任何问题。当我共享工具箱时,我的同事可以将工具箱添加到他的地图项目中,并打开它,但在运行它时得到一个无法打开工具箱的错误。< / P >Monitoring Plots Generator 1 ===================== ParametersBoundary layer woodland_18048_ExportFeature1 Woodland ID 18048 Boundary Acres 144 Intermediate Ouput Geodatabase C:\Users\btroxel\OneDrive - American Forest Foundation\Documents - FAMILY FOREST CARBON PROGRAM\Geospatial Library\_MRV cross-regional\Python Scripts\test_properties\scratch.gdb Final Plot Save GDB C:\Users\btroxel\OneDrive - American Forest Foundation\Documents - FAMILY FOREST CARBON PROGRAM\Geospatial Library\_MRV cross-regional\Python Scripts\test_properties\test_properties.gdb Final Plot Projection GEOGCS["GCS_Assumed_Geographic_1",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] ===================== MessagesStart Time: Wednesday, January 4, 2023 12:20:06 PM Traceback (most recent call last): File "C:\Users\btroxel\OneDrive - American Forest Foundation\Documents - FAMILY FOREST CARBON PROGRAM\Geospatial Library\_MRV cross-regional\Plot_generator\MRV.atbx#MonitoringPlotsGenerator1_MRV.py", line 23, in <module> File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 171, in ImportToolbox return import_toolbox(input_file, module_name) File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\toolbox_code.py", line 486, in import_toolbox toolbox = gp.createObject("Toolbox", tbxfile) File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 389, in createObject self._gp.CreateObject(*gp_fixargs(args, True))) OSError: The toolbox file C:\Users\btroxel\American Forest Foundation\FAMILY FOREST CARBON PROGRAM - Documents\Geospatial Library\_MRV cross-regional\Plot_generator\MRV.atbx was not found.Failed script (null)... Failed to execute (MonitoringPlotsGenerator1). Failed at Wednesday, January 4, 2023 12:20:06 PM (Elapsed Time: 0.23 seconds)
Feel free to download the folder containing the python scripts and toolbox. The screenshot also shows that the toolbox does exist on his computer. I will try to summarize the tool as best as I can.
The MRV plots generator was created to randomly generate between 9-11 plots/points within a boundary that can be of any shape or size (can also be a multi-part polygon). It will take into account the acreage of the boundary and mathematically calculate the initial spacing of the points to try to get to the right number of plots. To further randomize, it will shift and rotate the points by some random amount/angle. It works great on my computer, but I need to be able to share it!
It has some hacky python scripting because I am a novice at this, but I tried to put in a comments to help describe the process. The mesh points creation, the rotation and shifting of the points is all using tools developed by @DanPatterson_Retired which were huge in making this tool possible.
Toolbox has an alias, so I know that isn't the issue. The line that brings in the toolbox is
arcpy.ImportToolbox( r"{}\American Forest Foundation\FAMILY FOREST CARBON PROGRAM - Documents\Geospatial Library\_MRV cross-regional\Plot_generator\MRV.atbx".format(os.path.expanduser('~')))I have the expand user bit in there because it is saved on OneDrive and the start of the pathname changes based on the user. This is where I am guessing the problem lies, but I am lost on how to fix it.
Any assistance is appreciated, thank you!
2023年1月6日星期五23:39:12 GMT
//www.gamepadva.com/t5/python-questions/unable-to-import-toolbox-arcgis-pro-3-0-3/m-p/1246231#M66449
NephtaliChavez
2023 - 01 - 06 - t23:39:12z