Python beginner: Downloading a pdf file from a web server on VMS.

Hans Nowak wurmy at earthlink.net
Thu Dec 13 22:49:35 EST 2001


DoggyKennel wrote:

> Basically I want to download a pdf file from a web server and print
> it. So I would need a http class that is given a URL and can return
> whatever is returned from that URL. Does such a class exist? Would
> such a class return the docuemnt as a file handle.

See the urllib module. Opening an URL is easy as opening a regular
file:

  uf = urllib.urlopen("http://bla.org/bla.html")
  data = uf.read(1000)  # read 1000 bytes
  # etc...

So, yes, urllib.urlopen returns a file-like object, that can be used
for reading.

> The second part of this is that I would like to do this under VMS. I
> am hoping that if a "http" class as I have described above exists and
> that it would be built on top of a socket class and could be ported to
> any python environment that has a socket class. And that a socket
> class is a part of standard python and has been ported to any
> environment that python has been ported to. Is that right? I beleive
> python has been ported to VMS?
> Any advice on how to search for this info would also be appreciated.

Python has been ported to VMS, see:
 
  http://www.python.org/download/download_other.html

I don't use VMS myself, so I don't know how recent this port is.
But sockets and urllib have been around for a long time, so that
shouldn't really be a problem... assuming this Python port supports
them.

> I would also be interested in any introduction to Python. I have
> looked for this before and the consenus seems to be the tutorials
> referenced in python.org. I didn't really find much else. Is there
> anything else?

There's http://diveintopython.org, but I'm not sure if that's a
tutorial or more advanced. See

  http://www.google.com/search?hl=en&q=python+tutorial

for more.

Regards,

--Hans



More information about the Python-list mailing list