<?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: os.getcwd() in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742558#M57385</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;This wasn't a question necessarily for end users, but more for the creators of the [10.1] samples in the help perhaps it can be taken offline or a followup at the UC.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the clarification, Ted. I think it's annoying that we have yet another path in the ArcGIS environment to consider (I could about six right now.) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If any of the sample authors can chime in, this would be good to see here. Some of us can't make it to San Diego, unfortunately, and this is a good venue to discuss it I think.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;[If we] give the power users on here the power to give points to themselves when it would be their opinion especially if its from their answers.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm innocent, Ted! I did not check my own answer, and if I had the power would not do it that lightly. (Note, I don't even see the check icon on my screen, either.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I agree if this power is given to MVPs we should get some guidance. One would be not to check your own answer unless the user has responded that it solved their problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Jun 2012 17:36:22 GMT</pubDate>
    <dc:creator>curtvprice</dc:creator>
    <dc:date>2012-06-08T17:36:22Z</dc:date>
    <item>
      <title>os.getcwd()</title>
      <link>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742555#M57382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So, I am being seeing more and more of the samples using os.getcwd(), is this a better approach than setting a wrksp variable with env.workspace?&amp;nbsp; I mean the code looks pretty smooth, then throw on os.path.join to combine your gdb paths with your fd/fc, does look cleaner, rather than having a lot of wrksp and swrksp 1,2,3,4 and so forth.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2012 04:04:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742555#M57382</guid>
      <dc:creator>TedCronin</dc:creator>
      <dc:date>2012-06-08T04:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: os.getcwd()</title>
      <link>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742556#M57383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;So, I am being seeing more and more of the samples using os.getcwd(), is this a better approach than setting a wrksp variable with env.workspace? &lt;/BLOCKQUOTE&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ted, I wouldn't recommend this -- in the context of ArcGIS script tools, the workspace is used in tool parameter validation (to generate default output workspace paths in output parameters) and by the geoprocessor methods, and the scratchWorkspace allows user, model, and script control of where scratch files are written.&amp;nbsp; I think that by far it is best practice to use these arcpy environments and keep consistent with what ArcGIS standard tools do.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; I mean the code looks pretty smooth, then throw on os.path.join to combine your gdb paths with your fd/fc, does look cleaner, rather than having a lot of wrksp and swrksp 1,2,3,4 and so forth.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Functions like arcpy.ListFeatureClasses() use the current workspace, and tools write to the current workspace without you having to specify paths. You still can use os.path.join(), os.path.dirname(), os.path.normpath() etc. as you need to.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I afraid I don't know what you mean by "a lot of wrksp and swrksp 1,2,3,4 and so forth."&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2012 04:27:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742556#M57383</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2012-06-08T04:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: os.getcwd()</title>
      <link>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742557#M57384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This wasn't a question necessarily for end users, but more for the creators of the samples in the help perhaps it can be taken offline or a followup at the UC.&amp;nbsp; Also, the help i am referring to is 10.1. Someone Checked as Answered; I unchecked because the answer was not answered.&amp;nbsp; I know about os, and I know about arcpy and tools.&amp;nbsp;&amp;nbsp; 1,2,3,4, etc, is really in the context of explicit over implicit for setting multiple wrksp in a script and having a natural flow for the code.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess this is an argument on why end users shouldn't give themselves a check box, or why esri shouldn't give end users the rights to give the power users on here the power to give points to themselves when it would be their opinion especially if its from their answers.&amp;nbsp; Now perhaps their ability to check an answer as answered makes sense when it wasn't them answering the question, perhaps that could be a rule &lt;/SPAN&gt;&lt;STRONG&gt;ESRI&lt;/STRONG&gt;&lt;SPAN&gt;.&amp;nbsp; If you give these Forums MVP the rights to check something as answered, it should be ONLY if they did not provide the answer.&amp;nbsp; To answer a question and then give points to oneself (NOT IMPLYING ANYTHING HERE) to receive points is very subjective, even if the answer provided did not really answer the intent of the question.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, it seems the power has been handed over to some lucky few power users (So Watch Out), I will have to be more diligent now when posting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well Perhaps Not for all the forums users....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2012 17:21:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742557#M57384</guid>
      <dc:creator>TedCronin</dc:creator>
      <dc:date>2012-06-08T17:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: os.getcwd()</title>
      <link>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742558#M57385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;This wasn't a question necessarily for end users, but more for the creators of the [10.1] samples in the help perhaps it can be taken offline or a followup at the UC.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the clarification, Ted. I think it's annoying that we have yet another path in the ArcGIS environment to consider (I could about six right now.) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If any of the sample authors can chime in, this would be good to see here. Some of us can't make it to San Diego, unfortunately, and this is a good venue to discuss it I think.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;[If we] give the power users on here the power to give points to themselves when it would be their opinion especially if its from their answers.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm innocent, Ted! I did not check my own answer, and if I had the power would not do it that lightly. (Note, I don't even see the check icon on my screen, either.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I agree if this power is given to MVPs we should get some guidance. One would be not to check your own answer unless the user has responded that it solved their problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2012 17:36:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742558#M57385</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2012-06-08T17:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: os.getcwd()</title>
      <link>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742559#M57386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks for the clarification, Ted. I think it's annoying that we have yet another path in the ArcGIS environment to consider (I could about six right now.) &lt;BR /&gt;&lt;BR /&gt;If any of the sample authors can chime in, this would be good to see here. Some of us can't make it to San Diego, unfortunately, and this is a good venue to discuss it I think.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, I follow your logic where I explicit set env.workspace alot, perhaps I could streamline my code more with using better practices (which is why I love this python category on the forums), and os methods may help in that light, but for now just reading code from the samples is very intriguing to me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;I'm innocent, Ted! I did not check my own answer, and if I had the power would not do it that lightly. (Note, I don't even see the check icon on my screen, either.)&lt;BR /&gt;&lt;BR /&gt;I agree if this power is given to MVPs we should get some guidance. One would be not to check your own answer unless the user has responded that it solved their problem.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tested myself as well and don't see any check boxes, that's good to hear Curtis.&amp;nbsp; I tweaked my response hopefully to not imply anything.&amp;nbsp; I hope its clear.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2012 17:39:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742559#M57386</guid>
      <dc:creator>TedCronin</dc:creator>
      <dc:date>2012-06-08T17:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: os.getcwd()</title>
      <link>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742560#M57387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Long story short: it matters a whole lot less than you think it does.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family:Courier New;"&gt;os.chdir()&lt;/SPAN&gt;&lt;SPAN&gt; and &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;os.getcwd()&lt;/SPAN&gt;&lt;SPAN&gt; manage the working directory of the process and therefore of builtin functions like &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;open()&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;env.workspace&lt;/SPAN&gt;&lt;SPAN&gt; does not. That is the only difference. It's not a matter of better style, it's a matter of what behavior you need to do what you need to do. &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;getcwd&lt;/SPAN&gt;&lt;SPAN&gt; works in standalone scripts that aren't necessarily script tools or ArcGIS related, &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;env.workspace&lt;/SPAN&gt;&lt;SPAN&gt; is ArcGIS Geoprocessing specific.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jun 2012 18:25:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742560#M57387</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2012-06-08T18:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: os.getcwd()</title>
      <link>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742561#M57388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Long story short: it matters a whole lot less than you think it does.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you Jason.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jun 2012 21:44:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/os-getcwd/m-p/742561#M57388</guid>
      <dc:creator>TedCronin</dc:creator>
      <dc:date>2012-06-11T21:44:33Z</dc:date>
    </item>
  </channel>
</rss>

