I have a very simple script meant to fix broken map layers by replacing the data source. After talking to an ESRI tech he was saying it could be a problem with the IDE I'm using, or something possibly with the version of Python. I'm using PyScripter which is pointing to Python 2.7.13.
1.) The source \\gisfile\GISmaps\GISstaff\Jared\Hydro.gdb, as seen in the screenshot, is what I want to replace.


As a stand-alone script, this does not change anything in the Map. However, it runs with no errors and both print statements print what they're supposed to.
<SPAN class="keyword token">for</SPAN> lyr <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>ListLayers<SPAN class="punctuation token">(</SPAN>mxd<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> str<SPAN class="punctuation token">(</SPAN>lyr<SPAN class="punctuation token">.</SPAN>name<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">==</SPAN> <SPAN class="string token">"Test"</SPAN><SPAN class="punctuation token">:</SPAN>
lyr<SPAN class="punctuation token">.</SPAN>replaceDataSource<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">"\\gisfile\GISstaff\Jared\Hydro.gdb"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"FILEGDB_WORKSPACE"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Hydro_WillCounty_Waterways"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> lyr<SPAN class="punctuation token">.</SPAN>dataSource
mxd<SPAN class="punctuation token">.</SPAN>save<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">del</SPAN> mxd
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">"+++ Gut +++"</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
\\gisfile\GISstaff\Jared\Hydro<SPAN class="punctuation token">.</SPAN>gdb\Hydro_WillCounty_Waterways
<SPAN class="operator token">+</SPAN><SPAN class="operator token">+</SPAN><SPAN class="operator token">+</SPAN> Gut <SPAN class="operator token">+</SPAN><SPAN class="operator token">+</SPAN><SPAN class="operator token">+</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN></SPAN>
2.) Same thing in IDLE Python 2.7.13. It runs with no errors and both print statements print. But, nothing happens in the map.
3.) If I run the same script in the ArcMap Python pane it will work.
<SPAN class="keyword token">import</SPAN> arcpy
mxd <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>MapDocument<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"CURRENT"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> lyr <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mapping<SPAN class="punctuation token">.</SPAN>ListLayers<SPAN class="punctuation token">(</SPAN>mxd<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> str<SPAN class="punctuation token">(</SPAN>lyr<SPAN class="punctuation token">.</SPAN>name<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">==</SPAN> <SPAN class="string token">"Test"</SPAN><SPAN class="punctuation token">:</SPAN>
lyr<SPAN class="punctuation token">.</SPAN>replaceDataSource<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">"\\gisfile\GISstaff\Jared\Hydro.gdb"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"FILEGDB_WORKSPACE"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Hydro_WillCounty_Waterways"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">print</SPAN> lyr<SPAN class="punctuation token">.</SPAN>dataSource
mxd<SPAN class="punctuation token">.</SPAN>save<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">del</SPAN> mxd
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">"+++ Gut +++"</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>
I'm going to try and have PyScripter point to Python 3.x. I wanted to check here to see if anyone has seen this before.