How to error check urllib.request
<p>I have a line in python code that reads:</p>

<pre><code>req = urllib.request.urlopen(path + "robots.txt", data=None)
</code></pre>

<p>But this seems to be erroring out if the website.com/robots.txt doesn't exist. How can I add an error checking condition that just sets req to blank if this doesn't work instead?</p>