Using file path in python on Windows machine

I had a python script that passes a local file as a parameter that executes perfectly on a linux machine. The same script when ported over to Windows didn’t work, returning an error:


Eventually I had to substitute the relative path by the absolute path, and that too in a special format:

wsdl_file = 'file:///C:/Users/varun.verma/Work/Company_Enterprise_Sandbox.wsdl.xml'

I am sure there’s a better way to access a file using relative path, but just adding some notes here for now.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s