This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author T L2
Recipients T L2
Date 2018-07-04.04:33:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1530678835.56.0.56676864532.issue34038@psf.upfronthosting.co.za>
In-reply-to
Content
Changing the urlopen call to a curl commnand invoke works.

$ export http_proxy=socks5://127.0.0.1:8888 https_proxy=socks5://127.0.0.1:8888

# this will raise an exception with string representation is a blank string
# at least for url: https://s3.amazonaws.com/mozilla-games/emscripten/packages/llvm/tag/linux_64bit/emscripten-llvm-e1.37.35.tar.gz

from urllib2 import urlopen, HTTPError

    u = urlopen(url)
    mkdir_p(os.path.dirname(file_name))
    with open(file_name, 'wb') as f:
      file_size = get_content_length(u)
      if file_size > 0: print("Downloading: %s from %s, %s Bytes" % (file_name, url, file_size))
      else: print("Downloading: %s from %s" % (file_name, url))

      file_size_dl = 0
      block_sz = 8192
      while True:
          buffer = u.read(block_sz)
          if not buffer:
              break

          file_size_dl += len(buffer)
          f.write(buffer)


# this alternative way works

import commands

    status, output = commands.getstatusoutput("curl -L --output " + file_name + " " + url)
History
Date User Action Args
2018-07-04 04:33:55T L2setrecipients: + T L2
2018-07-04 04:33:55T L2setmessageid: <1530678835.56.0.56676864532.issue34038@psf.upfronthosting.co.za>
2018-07-04 04:33:55T L2linkissue34038 messages
2018-07-04 04:33:54T L2create