I have script a.py that have one line:
arcpy.env.workspace = r"C:\temp"
I am running this script with the line:
proc = subprocess.Popen([r"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe", r"D:\temp\a.py"])
When I run it from the python window in Pro 3.1 it runs with no error.
When I create script b.py that have only this line and make a tool out of it I get the error the GPEnvironment
have no method workspace
This works good in Pro 2.X
Thanks
Mody
don't you need to `import arcpy`? The python window in arcgis pro doesn't need `import arcpy` since it is already imported by launching the application.
The original code has all the needed import statements.
I just did not want to put extra lines in my post.
Just did some more testing.
The "workspace" line fail even if I run it using a bat file or replace subprocess.popen with os.system.
As I say it runs from all options, direct from IDLE or from pro python window but not when I define it as a tool.
And the strangest thing - the line arcpy.env.overwriteOutput = True does work. I did not tried other env's but it looks only the workspace have a problem.