Python 3.5: NLTK Download Default URL will not change
<p>I've updated the DEFAULT_URL in downloader.py and I'm still getting the following error. I originally tried just nltk.downloader() and the file browser updated but when I tried to download, it still reverted back to the github site.</p>

<pre><code>DEFAULT_URL = 'http://nltk.org/nltk_data/'
</code></pre>

<p>.</p>

<pre><code>import nltk
nltk.set_proxy('proxyaddress',user=None)
dl = nltk.downloader.Downloader("http://nltk.org/nltk_data/")
dl.download('all')

[nltk_data] Downloading collection 'all'
[nltk_data]    |
[nltk_data]    | Downloading package abc to C:\nltk_data...
[nltk_data]    | Error downloading 'abc' from
[nltk_data]    |     &lt;https://raw.githubusercontent.com/nltk/nltk_data
[nltk_data]    |     /gh-pages/packages/corpora/abc.zip&gt;:   &lt;urlopen
[nltk_data]    |     error [Errno 11004] getaddrinfo failed&gt;
</code></pre>

<p>Why is this still defaulting to raw.githubusercontent.com/nltk/nltk_data?</p>

<p>The problem comes from your proxy. I can't say what's wrong with your proxy configuration, but initializing a downloader with a custom download url works as intended (there is no need to modify the nltk source in <code>nltk/downloader.py</code>):</p>

<pre><code>dl = nltk.downloader.Downloader("http://example.com/my_corpus_data/index.xml")
</code></pre>

<p>Note that the custom url must resolve to an XML document describing the downloadable resources, in the format expected by the <code>nltk</code>; the code in your question points to the human-readable list at <code>http://nltk.org/nltk_data</code>, which will just result in an error. (Presumably your real code uses a different URL, and different code around the proxy settings.)</p>

<p>Anyway the problem has to be in your proxy, or the way you use it. The nltk's <code>set_proxy</code> function just calls a couple of functions from <code>urllib.request</code> to declare the proxy. It never comes near the nltk's <code>downloader</code> module, so there's no way it could affect the downloader's defaults.</p>

python nltk