The getcwd() Python method returns the incorrect current working directory of a process when the project is launched from the Start menu.
上次发布: February 23, 2023ArcGIS Pro
漏洞 ID 编号
BUG-000154997
已提交
January 10, 2023
上次修改时间
October 7, 2024
适用范围
ArcGIS Pro
找到的版本
3.0.3
操作系统
N/A
操作系统版本
N/A
状态
As Designed
经开发团队审核,已确定此行为符合设计。 有关详细信息,请参阅“其他信息”部分。
附加信息
When an application is launched either from the start menu or from the cmd.exe session, there is a well-established 'current directory' behavior. Python simply returns whatever the application's current directory is with os.getcwd().
iPython notebooks do not provide a way to determine the current running .ipynb, refer to the discussion at https://github.com/ipython/ipython/issues/10123
If the intent is to query the current ArcGIS Pro in which the Python code is running, use the 'arcpy.mp.ArcGISProject("CURRENT").homeFolde' command.