Is it possible to use python suds to read a wsdl file from the file system?

try to use url='file:///path/to/file'


Oneliner

# Python 3
import urllib, os 
url = urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath("service.xml")))

This is a more complete one liner that will:

  • let you specify just the local path,
  • get you the absolute path,
  • and then format it as a file-url.

Based upon:

  • the comments in the accepted answer and
  • this https://stackoverflow.com/a/14298190/622276
  • and thanks to user Sebastian the updated Python 3 implementation since we should avoid writing legacy python at this time.

Original for reference

# Python 2 (Legacy Python)
import urlparse, urllib, os

url = urlparse.urljoin('file:', urllib.pathname2url(os.path.abspath("service.xml")))