<?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: Detect broken links with arcpy? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515711#M40471</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think James might have found the problem. If so, it's a pretty similar problem to &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/103971-Possible-Unicode-Error-Field-Calculator-Help!!"&gt;this forum page&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure if the replace functions will work. As soon as python reads in the string from the cursor (&lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;Roll = str(row[0])&lt;/SPAN&gt;&lt;SPAN&gt;), it sees any \'s as special characters. For example, it sees "Path&lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;\t&lt;/SPAN&gt;&lt;SPAN&gt;o&lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;\n&lt;/SPAN&gt;&lt;SPAN&gt;ewfolder" as "Path&lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;[tab character]&lt;/SPAN&gt;&lt;SPAN&gt;o&lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;[new line character]&lt;/SPAN&gt;&lt;SPAN&gt;ewfolder". I don't think the replace will work, because it no longer thinks \ is in the string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One (lame) workaround might be to create a new field in the attribute table (maybe called "PROJECT_DW2") and replace "\" with "\\" (using VB).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]32082[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then run your original script with "PROJECT_DW2" instead of the original path.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Mar 2014 15:26:21 GMT</pubDate>
    <dc:creator>JoshuaChisholm</dc:creator>
    <dc:date>2014-03-10T15:26:21Z</dc:date>
    <item>
      <title>Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515703#M40463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I adapted some code I found online to search for broken (moved or renamed) hyperlinks in a shapefile. It should write all broken links to a text file, but instead it is writing ALL the hyperlinks to the text file. Any advice on what to change? I know extremely little about python. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I have arcmap 10.1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thank you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy
import os

fc = r" C:\Users\GIS\Documents\TEST 2-25\project_test.shp"
fields = ["PROJECT_DW"]

with arcpy.da.SearchCursor (fc,fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Roll = str(row[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if os.path.exists(Roll):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f = open(r"C:\Users\GIS\Documents\brokenlinks.txt","a")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write(Roll + os.linesep)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.close()&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 18:59:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515703#M40463</guid>
      <dc:creator>TracyDash</dc:creator>
      <dc:date>2014-03-07T18:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515704#M40464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I adapted some code I found online to search for broken (moved or renamed) hyperlinks in a shapefile. It should write all broken links to a text file, but instead it is writing ALL the hyperlinks to the text file. Any advice on what to change? I know extremely little about python. &lt;BR /&gt;&lt;BR /&gt;Also, I have arcmap 10.1&lt;BR /&gt;&lt;BR /&gt;thank you!&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os

fc = r" C:\Users\GIS\Documents\TEST 2-25\project_test.shp"
fields = ["PROJECT_DW"]

with arcpy.da.SearchCursor (fc,fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Roll = str(row[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if os.path.exists(Roll):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f = open(r"C:\Users\GIS\Documents\brokenlinks.txt","a")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write(Roll + os.linesep)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.close()&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In other words, it is evaluating everything as "broken".&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This may seem like a silly question but is "PROJECT_DW" the correct field that contains the paths?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also: would the evaluation fail if there are blank spaces in your "Roll" string variable?&amp;nbsp; Maybe you should attempt to deal with that possibility:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Roll = str(row[0])
Roll = Roll.strip()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:31:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515704#M40464</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T22:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515705#M40465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Code looks (really) good to me. A few questions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;OL&gt;&lt;BR /&gt;&lt;LI&gt;Are the hyperlinks to a drive you are now connected to?&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Are the hyperlinks pointing to the internet? If so, try this code:&lt;/LI&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os
from urllib2 import urlopen

fc = r" C:\Users\GIS\Documents\TEST 2-25\project_test.shp"
fields = ["PROJECT_DW"]

with arcpy.da.SearchCursor (fc,fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Roll = str(row[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; urlopen(Roll)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f = open(r"C:\Users\GIS\Documents\brokenlinks.txt","a")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write(Roll + os.linesep)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.close()&lt;/PRE&gt;&lt;BR /&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:31:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515705#M40465</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2021-12-11T22:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515706#M40466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;jamesfreddyc:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's a good thought- I was just thinking that 'pass' wasn't working&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's not a silly question, but yes it is the correct field&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and thanks for the idea, tried but eliminating spaces didn't make a difference...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hua17:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. yes, the hyperlinks are on a drive I'm connected to. The drive can be a bit flaky at times (well, just when the computer falls asleep), but I think it should be OK... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. no&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 19:42:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515706#M40466</guid>
      <dc:creator>TracyDash</dc:creator>
      <dc:date>2014-03-07T19:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515707#M40467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you post an example of how the hyperlink looks?&amp;nbsp; Maybe it is a character evaluation thing that isn't working as expected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, just for kicks, print out "Roll" to verify it&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy
import os

fc = r" C:\Users\GIS\Documents\TEST 2-25\project_test.shp"
fields = ["PROJECT_DW"]

with arcpy.da.SearchCursor (fc,fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Roll = str(row[0])

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ## print out the link to verify it
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #try to print it like this first:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "{0}".format(row[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #try to print it like this too:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print str(Roll)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if os.path.exists(Roll):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f = open(r"C:\Users\GIS\Documents\brokenlinks.txt","a")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write(Roll + os.linesep)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.close()

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:31:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515707#M40467</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T22:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515708#M40468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sure, here are examples of types of hyperlinks we will search through:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;folders: F:\LP04\COPP DUNN PLANTATION&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pdfs: F:\MSL\EMAIL SURVEYS\STANDARD PACIFIC\DUNN PLANTATION\L65 GBBF 10-30-03.PDF&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dwgs: F:\LP04\COPP DUNN PLANTATION\DWG\116-03-295 LT65.DWG&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If spaces are an issue, than I'm pretty much screwed. There is way too much data to change all the names..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tried the print function- again displayed ALL the hyperlinks instead of just the broken ones (I entered some fake links for testing).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 13:46:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515708#M40468</guid>
      <dc:creator>TracyDash</dc:creator>
      <dc:date>2014-03-10T13:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515709#M40469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Sure, here are examples of types of hyperlinks we will search through:&lt;BR /&gt;&lt;BR /&gt;folders: F:\LP04\COPP DUNN PLANTATION&lt;BR /&gt;pdfs: F:\MSL\EMAIL SURVEYS\STANDARD PACIFIC\DUNN PLANTATION\L65 GBBF 10-30-03.PDF&lt;BR /&gt;dwgs: F:\LP04\COPP DUNN PLANTATION\DWG\116-03-295 LT65.DWG&lt;BR /&gt;&lt;BR /&gt;If spaces are an issue, than I'm pretty much screwed. There is way too much data to change all the names..&lt;BR /&gt;&lt;BR /&gt;Tried the print function- again displayed ALL the hyperlinks instead of just the broken ones (I entered some fake links for testing).&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tested for spaces in the filename and the os.path.exists picked it up just fine.&amp;nbsp; I am wondering if the path is not constructed well enough though.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My best guess is that you are not able to apply string literal to the evaluation.&amp;nbsp; For example, this would evaluate as "else":&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
roll = 'H:\exists\broken\dfBA D.csv'
if os.path.exists(roll):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "roll exists: " + roll

else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "roll failed"
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, this would evaluate as "exists":&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
roll = r'H:\exists\broken\dfBA D.csv'
if os.path.exists(roll):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "roll exists: " + roll

else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "roll failed"
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The difference being that the "roll" variable is set with an "r" in front of the actual string.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:31:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515709#M40469</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T22:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515710#M40470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;See if this works -- replace "\" with "\\" in your path string formation:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy
import os

fc = r" C:\Users\GIS\Documents\TEST 2-25\project_test.shp"
fields = ["PROJECT_DW"]

with arcpy.da.SearchCursor (fc,fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Roll = str(row[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Roll = Roll.replace("\\", "\\\\")&lt;/STRONG&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if os.path.exists(Roll):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f = open(r"C:\Users\GIS\Documents\brokenlinks.txt","a")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.write(Roll + os.linesep)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.close()

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is also valid way to deal with it too:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;roll = roll.replace('\\', r'/')&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:31:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515710#M40470</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T22:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515711#M40471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think James might have found the problem. If so, it's a pretty similar problem to &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/103971-Possible-Unicode-Error-Field-Calculator-Help!!"&gt;this forum page&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure if the replace functions will work. As soon as python reads in the string from the cursor (&lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;Roll = str(row[0])&lt;/SPAN&gt;&lt;SPAN&gt;), it sees any \'s as special characters. For example, it sees "Path&lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;\t&lt;/SPAN&gt;&lt;SPAN&gt;o&lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;\n&lt;/SPAN&gt;&lt;SPAN&gt;ewfolder" as "Path&lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;[tab character]&lt;/SPAN&gt;&lt;SPAN&gt;o&lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;[new line character]&lt;/SPAN&gt;&lt;SPAN&gt;ewfolder". I don't think the replace will work, because it no longer thinks \ is in the string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One (lame) workaround might be to create a new field in the attribute table (maybe called "PROJECT_DW2") and replace "\" with "\\" (using VB).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]32082[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then run your original script with "PROJECT_DW2" instead of the original path.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 15:26:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515711#M40471</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-03-10T15:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515712#M40472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That is a great thought. I had no idea that could be an issue- unfortunately I did what Joshua said and still ALL the hyperlinks showed up. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it possible to blame my sometimes occasionally flaky network? I usually don't have problems during the day, just when my computer starts up and wakes up from sleeping...or possibly some sort of other path issue?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 16:49:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515712#M40472</guid>
      <dc:creator>TracyDash</dc:creator>
      <dc:date>2014-03-10T16:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515713#M40473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Forgot to add, also tried James idea and still all showed up.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 16:50:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515713#M40473</guid>
      <dc:creator>TracyDash</dc:creator>
      <dc:date>2014-03-10T16:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515714#M40474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Forgot to add, also tried James idea and still all showed up.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Your issue is related to how Python is handling the escape characters ("\") in your path names.&amp;nbsp; As Joshua corrected my post, you will not be able to overcome your problem by simply attempting to string.replace() method on the values, and I have not found any other way to deal with this.&amp;nbsp; For now, you'd have to calculate a new field like Joshua suggested.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: I noticed you said you tried Joshua's suggestion but I think you may have missed the full solution as it worked for me.&amp;nbsp; That is if I repalce my test string to this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Roll = "H:\\exists\\broken\\dfBA D.csv"
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It will get correctly evaluated in any test logic:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if os.path.exists(Roll):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "roll exists: " + Roll
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "roll failed"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:31:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515714#M40474</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T22:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515715#M40475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, I added a new field and recalculated it so all \ became \\. Still, every single hyperlink showed up on my text file when I ran the original code after doing that (and I did change the field name). So not sure where to go from here.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 17:27:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515715#M40475</guid>
      <dc:creator>TracyDash</dc:creator>
      <dc:date>2014-03-10T17:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515716#M40476</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Well, I added a new field and recalculated it so all \ became \\. Still, every single hyperlink showed up on my text file when I ran the original code after doing that (and I did change the field name). So not sure where to go from here.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe another dumb idea but make sure you can see the F: drive from where you are executing the Python script.&amp;nbsp; I stay away from mapped drives and opt for using UNC paths for everything file/directory related (which also has an issue with character limits).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry I cannot help any more on this one as I am not sure what else I could do.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 17:44:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515716#M40476</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2014-03-10T17:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515717#M40477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, will do. Our server can be strange at times.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But thank you so much for all your help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 17:46:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515717#M40477</guid>
      <dc:creator>TracyDash</dc:creator>
      <dc:date>2014-03-10T17:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515718#M40478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok, two more dumb questions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Have you been clearing/deleting the "C:\Users\GIS\Documents\brokenlinks.txt" file before each time you've run the script. You are using the append parameter ("a"). This means every time you run the script all additional broken links (or whatever this script is spitting out) will be appended to the end of whatever already exists.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If it were me, I would organize my script a little differently:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os

fc = r" C:\Users\GIS\Documents\TEST 2-25\project_test.shp"
fields = ["PROJECT_DW2"]

toTxtFile=""

with arcpy.da.SearchCursor (fc,fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Roll = str(row[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if os.path.exists(Roll):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pass
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; toTxtFile+=Roll + os.linesep

#write to file
f = open(r"C:\Users\GIS\Documents\brokenlinks.txt","w") #note that "w" will overwrite the file if it already exists
f.write(toTxtFile)
f.close()
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Can you provide a sample (copy and paste) of the kind of links that should be working but are appearing in the brokenlinks.txt file anyway.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:31:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515718#M40478</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2021-12-11T22:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515719#M40479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;1. Yes I have&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also- tried your script (thanks!!) but it still produced the same result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. OK I attached two files- the first is a piece of the attribute table and the second is a piece of the txt file (if you scroll down on the text file there are thousands of more hyperlinks). It's a bit funny because some fields are blank (could this be an issue?? I realize now that I should have mentioned that sooner.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-also I forgot to run the second field I made with two backslashes. It has the same result, however. Sorry&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2014 19:06:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515719#M40479</guid>
      <dc:creator>TracyDash</dc:creator>
      <dc:date>2014-03-10T19:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515720#M40480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok. I'm really stumped.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let's try another few small changes to the script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
import os

fc = r"C:\Users\GIS\Documents\TEST 2-25\project_test.shp"
fields = ["PROJECT_D2"]

toTxtFile=""

with arcpy.da.SearchCursor (fc,fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Roll = str(row[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not os.path.exists(Roll):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; toTxtFile+=Roll + os.linesep

#write to file
f = open(r"C:\Users\GIS\Documents\brokenlinks.txt","w") #note that "w" will overwrite the file if it already exists
f.write(toTxtFile)
f.close()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Secondly, let's also try picking out a few hyperlinks from brokenlinks.txt that you are 100% sure actually exist (copy and paste into windows explorer). Then let's opening python (&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Start &amp;gt; All Programs &amp;gt; ArcGIS &amp;gt; Python [2.7] &amp;gt; IDLE (Python GUI)&lt;/SPAN&gt;&lt;SPAN&gt;), type in &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;import os&lt;/SPAN&gt;&lt;SPAN&gt;, and try those selected hyperlinks manually. For example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;os.path.exists(r"F:\Lp04\PROV NORTHGLEN\DWG\SHEET 1.DWG")&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Just in case, let's test these two lines too:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;os.path.exists(r"F:")
os.path.exists(r"C:")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know the results.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:31:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515720#M40480</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2021-12-11T22:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515721#M40481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;1. code yielded same results as before&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. tested true (also tried a fake hyperlink which tested false)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. true&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Mar 2014 11:40:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515721#M40481</guid>
      <dc:creator>TracyDash</dc:creator>
      <dc:date>2014-03-11T11:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Detect broken links with arcpy?</title>
      <link>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515722#M40482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;&lt;BR /&gt;2. tested true (also tried a fake hyperlink which tested false)&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is because the string literal is forced.&amp;nbsp; The problem is that because you have stored your file paths/links with single "\" backslashes, Python is evaluating these as escape characters.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you were to replace:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;os.path.exists(r"F:\Lp04\PROV NORTHGLEN\DWG\SHEET 1.DWG") &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;os.path.exists("F:\Lp04\PROV NORTHGLEN\DWG\SHEET 1.DWG")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then it will evaluate as false.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Additionally, I tested these:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;These evaluate as True:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;os.path.exists("F:\\Lp04\\PROV NORTHGLEN\\DWG\\SHEET 1.DWG")&lt;/PRE&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;os.path.exists("F:/Lp04/PROV NORTHGLEN/DWG/SHEET 1.DWG")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I didn't find any way to apply a .replace method on the stored paths you have because it will always incorrectly evaluate the second backslash in each stored path and fail.&amp;nbsp; You will have to correct the source data with some other means as far as I can tell.&amp;nbsp; Although I'd really like to see a Python solution.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Mar 2014 12:04:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/detect-broken-links-with-arcpy/m-p/515722#M40482</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2014-03-11T12:04:54Z</dc:date>
    </item>
  </channel>
</rss>

