<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ArcGIS Pro ignoring arcpy.env.workspace in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-ignoring-arcpy-env-workspace/m-p/238188#M10356</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It could be that you are not using the recommended *.tif format for rasters.&lt;/P&gt;&lt;P&gt;If you are running outside of Pro, there should be no workspace or scratchWorkspace, as shown below.&lt;/P&gt;&lt;P&gt;What was your initial and desired workspaces?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
None

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Data\rasters"&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
C&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;\Data\rasters

rs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListRasters&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;rs&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'2.png'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'rasters_100sq00.tif'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'rasters_100sq01.tif'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;big snip&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;'rasters_100sq29.tif'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'rasters_100sq30.tif'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;From ....&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/functions/listrasters.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/functions/listrasters.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;ListRasters—ArcPy Functions | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;note that the env.workspace is the 'current' workspace and not a project o scratch workspace.&lt;/P&gt;&lt;P&gt;When working outside of Pro any of the&lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/functions/listdatasets.htm" rel="nofollow noopener noreferrer" target="_blank"&gt; "List*** " functions&lt;/A&gt; behave as I expect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 12:00:05 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2021-12-11T12:00:05Z</dc:date>
    <item>
      <title>ArcGIS Pro ignoring arcpy.env.workspace</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-ignoring-arcpy-env-workspace/m-p/238185#M10353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, im busy debugging a tool in ArcGIS Pro.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The tool works fine in ArcGIS Desktop or via Python itself (based on Desktop or Pro). I just noticed that my tool doesn't work right when I run it within ArcGIS Pro. The problem seems to be that within a ArcGIS Pro project the code in the tool is ignored, so arcpy.env.workspace = 'my_desired_workspace' is ignored and data is written to the default.gdb of the project. Is this a bug Esri is already aware of? Or can I do something to prevent it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like for example the tool arcpy.ListRasters() is not working correctly now because it is not checking the right workspace.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way I think it might be working correctly for vectordatasets, but for the rasters it is not working right for me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Hopefully someone can help me!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2020 13:24:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-ignoring-arcpy-env-workspace/m-p/238185#M10353</guid>
      <dc:creator>SjoerdHoekstra</dc:creator>
      <dc:date>2020-04-08T13:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro ignoring arcpy.env.workspace</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-ignoring-arcpy-env-workspace/m-p/238186#M10354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just ran a quick Python script tool where I set the workspace similar to you and ran ListRasters, and it worked fine.&amp;nbsp; I am using Pro 2.5, not sure if it is version thing.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2020 15:46:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-ignoring-arcpy-env-workspace/m-p/238186#M10354</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-04-08T15:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro ignoring arcpy.env.workspace</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-ignoring-arcpy-env-workspace/m-p/238187#M10355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joshua,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the quick reply.&lt;/P&gt;&lt;P&gt;I actually found out that the ListRasters does work well. It didnt work because the raster that I was looking for was written to the default.gdb because the arcpy.env.workspace did not seem to work. When you set it to arpcy.env.workspace and save a raster to a location does it end up in the right location? or in your default gdb as well?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2020 09:28:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-ignoring-arcpy-env-workspace/m-p/238187#M10355</guid>
      <dc:creator>SjoerdHoekstra</dc:creator>
      <dc:date>2020-04-09T09:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro ignoring arcpy.env.workspace</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-ignoring-arcpy-env-workspace/m-p/238188#M10356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It could be that you are not using the recommended *.tif format for rasters.&lt;/P&gt;&lt;P&gt;If you are running outside of Pro, there should be no workspace or scratchWorkspace, as shown below.&lt;/P&gt;&lt;P&gt;What was your initial and desired workspaces?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
None

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Data\rasters"&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
C&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;\Data\rasters

rs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListRasters&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;rs&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'2.png'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'rasters_100sq00.tif'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'rasters_100sq01.tif'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
 &lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;big snip&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;'rasters_100sq29.tif'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'rasters_100sq30.tif'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;From ....&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/functions/listrasters.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/functions/listrasters.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;ListRasters—ArcPy Functions | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;note that the env.workspace is the 'current' workspace and not a project o scratch workspace.&lt;/P&gt;&lt;P&gt;When working outside of Pro any of the&lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/functions/listdatasets.htm" rel="nofollow noopener noreferrer" target="_blank"&gt; "List*** " functions&lt;/A&gt; behave as I expect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:00:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-ignoring-arcpy-env-workspace/m-p/238188#M10356</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T12:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro ignoring arcpy.env.workspace</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-ignoring-arcpy-env-workspace/m-p/1016239#M35939</link>
      <description>&lt;P&gt;I'm having the same problem where ArcGIS Pro is totally ignoring the arcpy.env.scratchWorkspace. It is sending all my temporary files to ArcGIS default local temp folder.&lt;/P&gt;&lt;P&gt;When I print&amp;nbsp;arcpy.env.scratchWorkspace and&amp;nbsp;arcpy.env.workspace it gives back the correct paths, but when I run any tools such as&amp;nbsp;arcpy.CalculateStatistics_management() the temp output goes to the default ArcGIS temp folder and not the scratch workspace that I want.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 01:56:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcgis-pro-ignoring-arcpy-env-workspace/m-p/1016239#M35939</guid>
      <dc:creator>thiaggotayer1</dc:creator>
      <dc:date>2021-01-13T01:56:24Z</dc:date>
    </item>
  </channel>
</rss>

