'IOError: [Errno 2] No such file or directory' on website -- Python
<p>I'm doing some web scraping in Python and I'm running into a strange error. Sometimes when I try to open and read an html file using a URL I get the following error:     </p>

<pre><code>'IOError: [Errno 2] No such file or directory'
</code></pre>

<p>The code that is producing this error is here: Terminal doesn't like the last line in this block of code.</p>

<pre><code>for game in games:
            url = game
            page = urllib.urlopen(url).read()
</code></pre>

<p>The list <code>games</code> is a list of urls that definitely exist. This is what <code>games</code> looks like when I print it out:</p>

<pre><code>['nba.com/games/20160323/ATLWAS/gameinfo.html', 
'nba.com/games/20160323/MILCLE/gameinfo.html',
'nba.com/games/20160323/TORBOS/gameinfo.html',
'nba.com/games/20160323/ORLDET/gameinfo.html',
'nba.com/games/20160323/NYKCHI/gameinfo.html', 
'nba.com/games/20160323/UTAHOU/gameinfo.html', 
'nba.com/games/20160323/SACMIN/gameinfo.html', 
'nba.com/games/20160323/MIASAS/gameinfo.html', 
'nba.com/games/20160323/PHIDEN/gameinfo.html', 
'nba.com/games/20160323/LALPHX/gameinfo.html', 
'nba.com/games/20160323/DALPOR/gameinfo.html', 
'nba.com/games/20160323/LACGSW/gameinfo.html']
</code></pre>

<p>Does anyone know why I'm getting this error? I actually got this error once before, and although I solved it on that occasion, I didn't understand why what I did worked so I wanted to ask the community. Previously, I had <code>games</code> set up so that instead of having the full URL, it only had part of it. </p>

<p>For example, the first element in the old <code>games</code> was <code>/games/20160323/ATLWAS/gameinfo.html</code>. Then in the for loop shown above, instead of <code>url = game</code>, I wrote <code>nba.com+url</code>. When I ran it with the changes outlined above, it ran as expected. 
Any help would be appreciated.</p>