<?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 from os.path import expanduser in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/from-os-path-import-expanduser/m-p/613942#M47910</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to identify the current user folder as part of a larger process. I am using the code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;from os.path import expanduser HOME = expanduser("~")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I run the script in the foreground the result is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;print HOME 'C:\Users\jlay'&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However if I enable background processing the result is&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;print HOME 'H:\'&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can someone tell me why that is? And how to correct it?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Jun 2014 17:48:20 GMT</pubDate>
    <dc:creator>JohnLay</dc:creator>
    <dc:date>2014-06-17T17:48:20Z</dc:date>
    <item>
      <title>from os.path import expanduser</title>
      <link>https://community.esri.com/t5/python-questions/from-os-path-import-expanduser/m-p/613942#M47910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to identify the current user folder as part of a larger process. I am using the code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;from os.path import expanduser HOME = expanduser("~")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I run the script in the foreground the result is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;print HOME 'C:\Users\jlay'&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However if I enable background processing the result is&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;print HOME 'H:\'&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can someone tell me why that is? And how to correct it?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jun 2014 17:48:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/from-os-path-import-expanduser/m-p/613942#M47910</guid>
      <dc:creator>JohnLay</dc:creator>
      <dc:date>2014-06-17T17:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: from os.path import expanduser</title>
      <link>https://community.esri.com/t5/python-questions/from-os-path-import-expanduser/m-p/613943#M47911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not entirely sure about that behavior, but here's an alternative approach.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# Get your current user name usrName = os.getenv('USERNAME') Home = r'C:\Users\%s' % usrName&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Though this will only be useful if your path is constant and you just need to adjust for user name.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jun 2014 17:55:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/from-os-path-import-expanduser/m-p/613943#M47911</guid>
      <dc:creator>MattEiben</dc:creator>
      <dc:date>2014-06-17T17:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: from os.path import expanduser</title>
      <link>https://community.esri.com/t5/python-questions/from-os-path-import-expanduser/m-p/613944#M47912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That worked. Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jun 2014 18:07:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/from-os-path-import-expanduser/m-p/613944#M47912</guid>
      <dc:creator>JohnLay</dc:creator>
      <dc:date>2014-06-17T18:07:46Z</dc:date>
    </item>
  </channel>
</rss>

