<?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: Uunable to use 'arcpy.env.workspace' properly ! in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116442#M9142</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;"The file must have a .flt extension. There must be a header file in association with the floating-point binary file, with a .hdr extension."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does your .flt have an associated .hdr file?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Apr 2012 15:03:20 GMT</pubDate>
    <dc:creator>DarrenWiens2</dc:creator>
    <dc:date>2012-04-05T15:03:20Z</dc:date>
    <item>
      <title>Uunable to use 'arcpy.env.workspace' properly !</title>
      <link>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116439#M9139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;arcpy.env.workspace doest not work when we use barename for input file ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# arcpy10.py&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# CPython 2.6, ArcGIS 10, IDLE, windows_XP&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy, sys&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy.mapping&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy import env&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.overwriteOutput = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.workspace = "d:\\test"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Fullpath of input file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.FloatToRaster_conversion(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "d:\\test\\14605430.flt",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "14605430.tif")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; # No fullpath of input file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; arcpy.FloatToRaster_conversion(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "14605430.flt",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "14605430.img")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;except:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; print arcpy.GetMessages()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sys.exit()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"""&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Converting floating point file to grid ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Executing: FloatToRaster 14605430.flt d:\test\14605430.img&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Start Time: Sun Apr 01 12:58:49 2012&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000865: Input floating point raster file: 14605430.flt does not exist.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (FloatToRaster).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed at Sun Apr 01 12:58:49 2012 (Elapsed Time: 0.00 seconds)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"""&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Apr 2012 11:14:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116439#M9139</guid>
      <dc:creator>AdelItani</dc:creator>
      <dc:date>2012-04-01T11:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Uunable to use 'arcpy.env.workspace' properly !</title>
      <link>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116440#M9140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There are two ways of accessing submodules (&lt;/SPAN&gt;&lt;STRONG&gt;arcpy &lt;/STRONG&gt;&lt;SPAN&gt;is a module, &lt;/SPAN&gt;&lt;STRONG&gt;env &lt;/STRONG&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;STRONG&gt;arcpy.env) &lt;/STRONG&gt;&lt;SPAN&gt;is a submodule). In your code you are mixing them up, which is at least going to cause some issues...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Because you used: &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;from arcpy import env&lt;/PRE&gt;&lt;BR /&gt;&lt;STRONG&gt;Env &lt;/STRONG&gt;&lt;SPAN&gt;is imported as its own module, so later on you should access it with:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;env.workspace = "d:\\test"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The other way to do it is just:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;import arcpy&lt;/PRE&gt;&lt;BR /&gt;&lt;STRONG&gt;Env &lt;/STRONG&gt;&lt;SPAN&gt;is still a submodule of &lt;/SPAN&gt;&lt;STRONG&gt;arcpy&lt;/STRONG&gt;&lt;SPAN&gt;, so later on you should access it with:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.env.workspace = "d:\\test"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After that you should use the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Not Full path&lt;/SPAN&gt;&lt;SPAN&gt; method you have shown in your original post...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 03:16:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116440#M9140</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2012-04-02T03:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: Uunable to use 'arcpy.env.workspace' properly !</title>
      <link>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116441#M9141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Stacy for help, but i still have ERROR&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy
import arcpy.mapping
arcpy.env.workspace = "d:\\test"
arcpy.env.overwriteOutput = True

try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FloatToRaster_conversion(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "14605430.flt",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "14605430.tif")
except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages()
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;""" ERROR 010158: Unable to open file \14605430.flt.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ERROR 010067: Error in executing grid expression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;"""&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:51:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116441#M9141</guid>
      <dc:creator>AdelItani</dc:creator>
      <dc:date>2021-12-11T06:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Uunable to use 'arcpy.env.workspace' properly !</title>
      <link>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116442#M9142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;"The file must have a .flt extension. There must be a header file in association with the floating-point binary file, with a .hdr extension."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does your .flt have an associated .hdr file?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 15:03:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116442#M9142</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2012-04-05T15:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Uunable to use 'arcpy.env.workspace' properly !</title>
      <link>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116443#M9143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes Daren, there is two files: d:\test\14605430.flt, d:\test\14605430.hdr&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Besides that, this script with replacing arcpy by arcgisscripting,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and with small editing, was run succefully on ArcGIS 9.2 and 9.3 .&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 20:10:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116443#M9143</guid>
      <dc:creator>AdelItani</dc:creator>
      <dc:date>2012-04-05T20:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Uunable to use 'arcpy.env.workspace' properly !</title>
      <link>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116444#M9144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does it happen to work if you change the name so it doesn't start with a number? I don't know about .flt or .tif, but some file formats don't like that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, does it work properly if you use the entire filename rather than relying on the workspace environment?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 20:18:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116444#M9144</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2012-04-05T20:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: Uunable to use 'arcpy.env.workspace' properly !</title>
      <link>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116445#M9145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Darren&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I included zip-file 'p4605430_flt.zip' with files 'p4605430.flt' and 'p4605430.hdr',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and i am still facing the same error, after changing the line to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.FloatToRaster_conversion("p4605430.flt", "p4605430.tif")&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Where it does work properly with full_path_name without workspace environment.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Apr 2012 20:56:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116445#M9145</guid>
      <dc:creator>AdelItani</dc:creator>
      <dc:date>2012-04-06T20:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Uunable to use 'arcpy.env.workspace' properly !</title>
      <link>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116446#M9146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried your code with the same result (it didn't work when setting the workspace environment). I don't have any explanation, perhaps someone from ESRI can speak to this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can fake a workspace environment with the following (it's basically just using the whole path):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import arcpy.mapping
workspace = "d:\\test\\"
arcpy.env.overwriteOutput = True

try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.FloatToRaster_conversion(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; workspace + "p4605430.flt",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; workspace + "p4605430.tif")
except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:51:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/uunable-to-use-arcpy-env-workspace-properly/m-p/116446#M9146</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-11T06:51:18Z</dc:date>
    </item>
  </channel>
</rss>

