When attaching the following to a tool box in Pro 2.1.2 and running it:
<SPAN class="keyword token">import</SPAN> os
<SPAN class="keyword token">import</SPAN> errno
<SPAN class="keyword token">import</SPAN> arcpy
curr <SPAN class="operator token">=</SPAN> dirpath <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>getcwd<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
directories <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">'Data'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Data//GPS'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Data//Working'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Data//Tabular'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Products'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'Documents'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Documents//Pics_Graphics'</SPAN><SPAN class="punctuation token">]</SPAN>
basedirectory <SPAN class="operator token">=</SPAN> curr <SPAN class="operator token">+</SPAN><SPAN class="string token">'//'</SPAN>
<SPAN class="keyword token">for</SPAN> i <SPAN class="keyword token">in</SPAN> range <SPAN class="punctuation token">(</SPAN>len <SPAN class="punctuation token">(</SPAN>directories<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
newDir <SPAN class="operator token">=</SPAN> basedirectory <SPAN class="operator token">+</SPAN> directories<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">try</SPAN><SPAN class="punctuation token">:</SPAN>
os<SPAN class="punctuation token">.</SPAN>makedirs<SPAN class="punctuation token">(</SPAN>newDir<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">except</SPAN> OSError <SPAN class="keyword token">as</SPAN> exception<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> exception<SPAN class="punctuation token">.</SPAN>errno <SPAN class="operator token">!=</SPAN> errno<SPAN class="punctuation token">.</SPAN>EEXIST<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">raise</SPAN>
<SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="string token">"\nBE CAREFUL! Directory %s already exists."</SPAN> <SPAN class="operator token">%</SPAN> newDir<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
I get the following error:
Start Time<SPAN class="punctuation token">:</SPAN> Monday<SPAN class="punctuation token">,</SPAN> June <SPAN class="number token">04</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">2018</SPAN> <SPAN class="number token">4</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">10</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">17</SPAN> PM
Running script CreateProjectFolders<SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN>
Failed script Create Project Folders<SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN>
Traceback <SPAN class="punctuation token">(</SPAN>most recent call last<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
File <SPAN class="string token">"C:\temp\Pro_Folder_Structure\NEW_FOLDERS.py"</SPAN><SPAN class="punctuation token">,</SPAN> line <SPAN class="number token">10</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">in</SPAN> <SPAN class="operator token"><</SPAN>module<SPAN class="operator token">></SPAN>
os<SPAN class="punctuation token">.</SPAN>makedirs<SPAN class="punctuation token">(</SPAN>newDir<SPAN class="punctuation token">)</SPAN>
File <SPAN class="string token">"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\os.py"</SPAN><SPAN class="punctuation token">,</SPAN> line <SPAN class="number token">220</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">in</SPAN> makedirs
mkdir<SPAN class="punctuation token">(</SPAN>name<SPAN class="punctuation token">,</SPAN> mode<SPAN class="punctuation token">)</SPAN>
PermissionError<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">[</SPAN>WinError <SPAN class="number token">5</SPAN><SPAN class="punctuation token">]</SPAN> Access <SPAN class="keyword token">is</SPAN> denied<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">'C:\\Program Files\\ArcGIS\\Pro//Data'</SPAN>
Failed to execute <SPAN class="punctuation token">(</SPAN>CreateProjectFolders<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>
Failed at Monday<SPAN class="punctuation token">,</SPAN> June <SPAN class="number token">04</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">2018</SPAN> <SPAN class="number token">4</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">10</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">17</SPAN> PM <SPAN class="punctuation token">(</SPAN>Elapsed Time<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">0.06</SPAN> seconds<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
My assumption is that os.getcwd() would get the directory that the pro project is saved to. curr = dirpath = arcpy.env.workspace doesn't appear to do anything here.