> In python2, this work if "something" is a regular file on the system as
> well as a remote URL. The 2to3 script convert this to
> urllib.request.urlopen. But it does not work anymore if "something"
> is just a file name.
> 
> My aim is to let the user specify a "file" on the command line and have
> something that works, whatever the "file " actually is: a regular file,
> an http url, etc...

A file path, such as "/etc/passwd", isn't properly a URL, so urllib correctly 
refuses to handle it. You can make it a URL by using the file:// protocol, i.e. 
"file:///etc/passwd"... which appears to work in both python2 and python3.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to