laptop and a wrench

不具合

The 'Current' keyword in the script tool does not reference the project currently loaded into the application.

最後に公開された状態: November 17, 2022 ArcGIS Pro
不具合 ID 番号 BUG-000151663
送信されましたAugust 18, 2022
最終更新日June 5, 2024
適用対象ArcGIS Pro
見つかったバージョン3.0
オペレーティング システムN/A
オペレーティング システムのバージョンN/A
ステータスAs Designed

参考情報

Although the keyword 'Current' works the same in the Python window, notebooks, and script tools, the core geoprocessing functions do not return 'arcpy.mp Layer objects'. Instead, it returns 'Result objects', and it is up to the user to use the correct index to return the appropriate object from the result. The code below is modified to return a layer object from the geoprocessing 'Result object', and this works in models, stand-alone scripts, script tools, and the Python window. p = arcpy.mp.ArcGISProject('current') m = p.listMaps('Map')[0] lyr1 = m.listLayers('States_WithRegions')[0] res = arcpy.management.Merge(['States_WithRegions', 'Provinces'], os.path.join(basePath, 'GPSyncLayers.gdb', 'MergeOutputOpt1')) resLyr = m.addDataFromPath(res[0]) Note that the geoprocessing tools run from the Python window or notebooks often automatically add layer results to the table of contents. This is a geoprocessing option that can be configured, but it does not automatically add layers if run from a script tool. This is because script tools are designed to work out of process, even if views are not active to add the output to. Use the logic above to more consistently get the expected results.

対処法

Use the Python Window or notebooks in ArcGIS Pro.

再現の手順

不具合 ID: BUG-000151663

ソフトウェア:

  • ArcGIS Pro

バグのステータスが変更されたときに通知を受け取る

Esri Support アプリのダウンロード

このトピックについてさらに調べる

ArcGIS エキスパートのサポートを受ける

テクニカル サポートへのお問い合わせ

Esri Support アプリのダウンロード

ダウンロード オプションに移動