<?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: How to implement os.getcwd() in Pro 2.1.2? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697853#M54085</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One useful way that doesn't require arcpy at all in case you work outside of arcmap is to organize your projects so that you have your scripts in a subfolder within the folder.&lt;/P&gt;&lt;P&gt;You just need to find out where the script is, then parse the path to the project&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import sys&amp;nbsp; # assuming you don't already have it
script = sys.argv[0]
script'C:/GIS/A_Tools_scripts/Table_tools/Scripts/sequential_funcs_txt.py'
proj = "/".join(script.split("/")[:-2])
proj&amp;nbsp;'C:/GIS/A_Tools_scripts/Table_tools'&amp;nbsp; # the project folder, which contains the *.aprx and the *.tbx‍‍‍‍‍‍‍‍‍‍&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The trouble with the ArcGISProject is that it only returns useful information if you are running the python script in the sad python window or from the application&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE style="background-color: #ffffff; border-collapse: collapse; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-spacing: 0px 0px; color: #4c4c4c; font-family: &amp;amp;quot; avenir next w01&amp;amp;quot;,&amp;amp;quot;avenir next w00&amp;amp;quot;,&amp;amp;quot;avenir next&amp;amp;quot;,&amp;amp;quot;avenir&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,sans-serif; font-size: 14.8px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: 0px; line-height: 26.35px; margin-bottom: 26.35px; orphans: 2; overflow: auto; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; width: 754.75px; word-spacing: 0px; border: 0.5px solid #cccccc;"&gt;&lt;TBODY style="overflow: auto; width: 100%;"&gt;&lt;TR style="border-bottom-color: #cccccc; border-bottom-style: solid; border-bottom-width: 1px; text-align: left;"&gt;&lt;TD style="border-left-color: #cccccc; border-left-style: solid; border-left-width: 1px; border-right-color: #cccccc; border-right-style: solid; border-right-width: 1px; font-weight: 300; padding: 8.67px;"&gt;activeMap&lt;DIV style="border-left-color: #4c4c4c; border-left-style: none; border-left-width: 0px; border-right-color: #4c4c4c; border-right-style: none; border-right-width: 0px; font-weight: 300; padding: 0px;"&gt;(Read Only)&lt;/DIV&gt;&lt;/TD&gt;&lt;TD style="border-left-color: #cccccc; border-left-style: solid; border-left-width: 1px; border-right-color: #cccccc; border-right-style: solid; border-right-width: 1px; font-weight: 300; padding: 8.67px;"&gt;&lt;P style="margin-bottom: 0px; margin-top: 0px;"&gt;Returns the &lt;A href="http://pro.arcgis.com/en/pro-app/arcpy/mapping/map-class.htm" style="color: #0074b8; text-decoration: none;" rel="nofollow noopener noreferrer" target="_blank"&gt;map&lt;/A&gt; object associated with the focused view within the application.&lt;SPAN style="font-family: &amp;amp;quot;"&gt;None&lt;/SPAN&gt; will be returned if there are no views open that have an associated map or when a script is run outside of the application.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;And in any event you would have to provide "CURRENT" I suppose to&amp;nbsp;&lt;/P&gt;&lt;P&gt;ArcGISProject("CURRENT") to the method... but it returns too many 'None' if as described in the help (ie no active map etc)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 05:21:34 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2021-12-12T05:21:34Z</dc:date>
    <item>
      <title>How to implement os.getcwd() in Pro 2.1.2?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697848#M54080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When attaching the following to a tool box in Pro 2.1.2 and running it:&amp;nbsp;&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; os
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; errno
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
curr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; dirpath &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getcwd&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
directories &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Data'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Data//GPS'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Data//Working'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Data//Tabular'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Products'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Documents'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Documents//Pics_Graphics'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
basedirectory &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; curr &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'//'&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; range &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;len &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;directories&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;
 newDir &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; basedirectory &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; directories&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;makedirs&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;newDir&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; OSError &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; exception&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; exception&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;errno &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; errno&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;EEXIST&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;raise&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;else&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;&lt;SPAN class="string token"&gt;"\nBE CAREFUL! Directory %s already exists."&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt; newDir&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get the following error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;Start Time&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; Monday&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; June &lt;SPAN class="number token"&gt;04&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2018&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;4&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;17&lt;/SPAN&gt; PM
Running script CreateProjectFolders&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;
Failed script Create Project Folders&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;
 Traceback &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;most recent call last&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 File &lt;SPAN class="string token"&gt;"C:\temp\Pro_Folder_Structure\NEW_FOLDERS.py"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;module&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;
 os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;makedirs&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;newDir&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
 File &lt;SPAN class="string token"&gt;"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\os.py"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;220&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; makedirs
 mkdir&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; mode&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
PermissionError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;WinError &lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; Access &lt;SPAN class="keyword token"&gt;is&lt;/SPAN&gt; denied&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'C:\\Program Files\\ArcGIS\\Pro//Data'&lt;/SPAN&gt;
 Failed to execute &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;CreateProjectFolders&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;
Failed at Monday&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; June &lt;SPAN class="number token"&gt;04&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2018&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;4&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;10&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;17&lt;/SPAN&gt; PM &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Elapsed Time&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0.06&lt;/SPAN&gt; seconds&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My assumption is that&amp;nbsp;os.getcwd() would get the directory that the pro project is saved to.&amp;nbsp;curr = dirpath = arcpy.env.workspace doesn't appear to do anything here.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:21:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697848#M54080</guid>
      <dc:creator>ThomasColson</dc:creator>
      <dc:date>2021-12-12T05:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement os.getcwd() in Pro 2.1.2?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697849#M54081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well the first bit works&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; os

curdir &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getcwd&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

curdir
&lt;SPAN class="string token"&gt;'C:\\GIS\\A_Tools_scripts\\Table_tools\\Scripts'&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But your indentation is all wrong, if you copied and pasted your code.&lt;/P&gt;&lt;P&gt;I suggest that you fix it with 4 space indentation AND&lt;/P&gt;&lt;P&gt;If you intend to use forward slashes, you only use 1 ie '/'&lt;/P&gt;&lt;P&gt;Backslashes use 2 ie '\\'&lt;/P&gt;&lt;P&gt;Throw in some print statements as you go along to see where failure actually occurs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:21:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697849#M54081</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T05:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement os.getcwd() in Pro 2.1.2?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697850#M54082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you copy the following into a file and run it as a script associated with a Toolbox, what path is returned:&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; os
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"----------------------------------------"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getcwd&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;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"----------------------------------------"&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:21:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697850#M54082</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-12T05:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement os.getcwd() in Pro 2.1.2?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697851#M54083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Of simply put the results in 'tweet' so you can use it in within and without environments&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&amp;nbsp; &lt;SPAN class="comment token"&gt;# assuming you will be using arcpy anyway&lt;/SPAN&gt;

 &lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;tweet&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;msg&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;"""Print a message for both arcpy and python.

&amp;nbsp;&amp;nbsp;&amp;nbsp; msg - a text message
&amp;nbsp;&amp;nbsp;&amp;nbsp; """&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; m &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"\n{}\n"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;msg&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddMessage&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;m&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;m&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp; 

tweet&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getcwd&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;&amp;nbsp; &lt;SPAN class="comment token"&gt;# tweet away&lt;/SPAN&gt;

C&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;\GIS\A_Tools_scripts\Table_tools\Scripts&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:21:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697851#M54083</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T05:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement os.getcwd() in Pro 2.1.2?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697852#M54084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem is not the indentation or the spaces, the problem is, when run from within a Pro toolbox, or the Pro Python window,&amp;nbsp;&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;arcpy&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;AddMessage&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;os&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;getcwd&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;) &lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;returns C:\Program Files\ArcGIS\Pro. It does not return the path to the Pro Project Folder.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The script runs fine as a stand alone, and creates the folders in what ever folder the script happens to be in. The home folder property in&amp;nbsp;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/arcpy/mapping/arcgisproject-class.htm" title="http://pro.arcgis.com/en/pro-app/arcpy/mapping/arcgisproject-class.htm"&gt;ArcGISProject—ArcPy | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;seemed promising, but all that returns is&amp;nbsp;&amp;lt;property object at 0x000000017836EF98&amp;gt; and&amp;nbsp;arcpy.mp.ArcGISProject("CURRENT").filePath returns the full path as well as the name of the aprx, which I don't need (and therefore can't use the output of&amp;nbsp;arcpy.mp.ArcGISProject("CURRENT").filePath either).&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2018 11:00:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697852#M54084</guid>
      <dc:creator>ThomasColson</dc:creator>
      <dc:date>2018-06-05T11:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement os.getcwd() in Pro 2.1.2?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697853#M54085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One useful way that doesn't require arcpy at all in case you work outside of arcmap is to organize your projects so that you have your scripts in a subfolder within the folder.&lt;/P&gt;&lt;P&gt;You just need to find out where the script is, then parse the path to the project&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import sys&amp;nbsp; # assuming you don't already have it
script = sys.argv[0]
script'C:/GIS/A_Tools_scripts/Table_tools/Scripts/sequential_funcs_txt.py'
proj = "/".join(script.split("/")[:-2])
proj&amp;nbsp;'C:/GIS/A_Tools_scripts/Table_tools'&amp;nbsp; # the project folder, which contains the *.aprx and the *.tbx‍‍‍‍‍‍‍‍‍‍&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The trouble with the ArcGISProject is that it only returns useful information if you are running the python script in the sad python window or from the application&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE style="background-color: #ffffff; border-collapse: collapse; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-spacing: 0px 0px; color: #4c4c4c; font-family: &amp;amp;quot; avenir next w01&amp;amp;quot;,&amp;amp;quot;avenir next w00&amp;amp;quot;,&amp;amp;quot;avenir next&amp;amp;quot;,&amp;amp;quot;avenir&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,sans-serif; font-size: 14.8px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: 0px; line-height: 26.35px; margin-bottom: 26.35px; orphans: 2; overflow: auto; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; width: 754.75px; word-spacing: 0px; border: 0.5px solid #cccccc;"&gt;&lt;TBODY style="overflow: auto; width: 100%;"&gt;&lt;TR style="border-bottom-color: #cccccc; border-bottom-style: solid; border-bottom-width: 1px; text-align: left;"&gt;&lt;TD style="border-left-color: #cccccc; border-left-style: solid; border-left-width: 1px; border-right-color: #cccccc; border-right-style: solid; border-right-width: 1px; font-weight: 300; padding: 8.67px;"&gt;activeMap&lt;DIV style="border-left-color: #4c4c4c; border-left-style: none; border-left-width: 0px; border-right-color: #4c4c4c; border-right-style: none; border-right-width: 0px; font-weight: 300; padding: 0px;"&gt;(Read Only)&lt;/DIV&gt;&lt;/TD&gt;&lt;TD style="border-left-color: #cccccc; border-left-style: solid; border-left-width: 1px; border-right-color: #cccccc; border-right-style: solid; border-right-width: 1px; font-weight: 300; padding: 8.67px;"&gt;&lt;P style="margin-bottom: 0px; margin-top: 0px;"&gt;Returns the &lt;A href="http://pro.arcgis.com/en/pro-app/arcpy/mapping/map-class.htm" style="color: #0074b8; text-decoration: none;" rel="nofollow noopener noreferrer" target="_blank"&gt;map&lt;/A&gt; object associated with the focused view within the application.&lt;SPAN style="font-family: &amp;amp;quot;"&gt;None&lt;/SPAN&gt; will be returned if there are no views open that have an associated map or when a script is run outside of the application.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;And in any event you would have to provide "CURRENT" I suppose to&amp;nbsp;&lt;/P&gt;&lt;P&gt;ArcGISProject("CURRENT") to the method... but it returns too many 'None' if as described in the help (ie no active map etc)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:21:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697853#M54085</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T05:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement os.getcwd() in Pro 2.1.2?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697854#M54086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That would work if there were either a fixed location of the script, or a fixed location where all projects get saved, and users were inclined to provide input to&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;sys.argv[0], and if they were so inclined, we'd start seeing&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit;"&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'Data'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'Data//GPS'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'Data//Working'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'Data//Tabular'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'Products'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'Documents'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;'Documents//Pics_Graphics'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;]&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;all over the network, anywhere in fact, instead of in the prj folder. Another limitation is we have an enforced policy on project folder organization, adding more subfolders with scripts is not in the cards. Trying to make this a hands off solution, Start Pro, click a button, there are your folders. In Arc I do this with a zip/exe which has been identified as a "security concern". What I'm really interested in is corralling the output of&amp;nbsp;arcpy.mp.ArcGISProject("CURRENT").filePath to NOT give me&amp;nbsp;'C:\\Users\\sasquatch\\Documents\\ArcGIS\\Projects\\MyProject95\\MyProject95.aprx'&amp;nbsp; but instead&amp;nbsp;&lt;SPAN&gt;'C:\\Users\\&lt;/SPAN&gt;&lt;SPAN&gt;sasquatch&lt;/SPAN&gt;&lt;SPAN&gt;\\Documents\\ArcGIS\\Projects\\MyProject95\\'&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;So, in Pro 2.1.2, is it possible to simply get the path of the current project using Python? Not the path to "Program Files" or the name of the project.....&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2018 11:28:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697854#M54086</guid>
      <dc:creator>ThomasColson</dc:creator>
      <dc:date>2018-06-05T11:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement os.getcwd() in Pro 2.1.2?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697855#M54087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'C:\\Users\\sasquatch\\Documents\\ArcGIS\\Projects\\MyProject95\\MyProject95.aprx'&lt;/SPAN&gt;
folder &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"/"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string 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;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
folderOut&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;17&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;'C:/Users/sasquatch/Documents/ArcGIS/Projects/MyProject95'&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;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:21:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697855#M54087</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T05:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement os.getcwd() in Pro 2.1.2?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697856#M54088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to have a parameter in your tool that sets the work dir&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;chdir&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;&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;&amp;nbsp; &lt;SPAN class="comment token"&gt;# set the work directory&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2018 11:41:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697856#M54088</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-06-05T11:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement os.getcwd() in Pro 2.1.2?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697857#M54089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Marked correct. But back to your original idea, how WOULD you give the user a choice? Run the tool with &lt;STRONG&gt;no&lt;/STRONG&gt; input and get the folders in the project directory, OR, specify an &lt;STRONG&gt;existing&lt;/STRONG&gt; folder in the project directory or create a &lt;STRONG&gt;new&lt;/STRONG&gt; one, and put the folders there.&amp;nbsp;&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; os
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; errno
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
curr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;filePath
folder &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"/"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;curr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;split&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string 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;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
directories &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Data'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Data\\GPS'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Data\\Working'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Data\\Tabular'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Products'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Documents'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'Documents\\Pics_Graphics'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
basedirectory &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; folder &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'\\'&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; range &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;len &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;directories&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;
 newDir &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; basedirectory &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; directories&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;i&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;makedirs&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;newDir&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; OSError &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; exception&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; exception&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;errno &lt;SPAN class="operator token"&gt;!=&lt;/SPAN&gt; errno&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;EEXIST&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;raise&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;else&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;&lt;SPAN class="string token"&gt;"\nBE CAREFUL! Directory %s already exists."&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;%&lt;/SPAN&gt; newDir&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:21:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697857#M54089</guid>
      <dc:creator>ThomasColson</dc:creator>
      <dc:date>2021-12-12T05:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement os.getcwd() in Pro 2.1.2?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697858#M54090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting.&amp;nbsp; When I run the code from a script in a Toolbox, it gives me the path to the current project and not Pro's install folder.&amp;nbsp; I realize you have found a solution, or usable workaround, but I still wonder why you are getting different results than I am with same version of Pro.&amp;nbsp; Is the Toolbox part of the project's Toolbox folder or connected/mapped to from a central location or file share?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2018 14:42:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697858#M54090</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-06-05T14:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement os.getcwd() in Pro 2.1.2?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697859#M54091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Blank project saved to default project path, with the tool box in the project folder&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2018 19:29:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697859#M54091</guid>
      <dc:creator>ThomasColson</dc:creator>
      <dc:date>2018-06-05T19:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to implement os.getcwd() in Pro 2.1.2?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697860#M54092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Depends on the level of familiarity with GIS that you users have.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;None... then they need some guidance and a pre-created structure.&lt;/LI&gt;&lt;LI&gt;Some... prefabricate some folders in a master folder and get them to copy into the PRO project folder.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We don't use a master folders for toolboxes and/or scripts.&amp;nbsp;&lt;/P&gt;&lt;P&gt;User developed toolboxes and scripts are copied into each project folder as needed.&amp;nbsp; Why? it is simple, disk space is&lt;/P&gt;&lt;P&gt;cheap and people can handle the "copy here, use here, backup there" pretty well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in short if someone wants to use something (regardless of whether it is tools or scripts or data, they copy it locally.&lt;/P&gt;&lt;P&gt;Of course, those that are required to have stuff on a central repository have to deal with those issues.&amp;nbsp; We just find the&lt;/P&gt;&lt;P&gt;work local, backup elsewhere works fine but... we don't have people tripping over themselves trying to use/update the same data at the same time.&amp;nbsp; That is an extra level of issues that fortunately we don't have to deal with.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW that doesn't apply just to teaching but to consulting work as well.&lt;/P&gt;&lt;P&gt;Best of luck&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2018 23:03:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-implement-os-getcwd-in-pro-2-1-2/m-p/697860#M54092</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-06-05T23:03:53Z</dc:date>
    </item>
  </channel>
</rss>

