Skip to content

Instantly share code, notes, and snippets.

@dicato
Created August 15, 2012 19:48
Show Gist options
  • Save dicato/3363034 to your computer and use it in GitHub Desktop.
Save dicato/3363034 to your computer and use it in GitHub Desktop.
@staticmethod
def local_file_uri(file_path):
'''
Helper/Utility method to take file system paths and return a file URI for use
with learn, and learn_policy methods
Args:
file_path: The file path to the policy
Returns:
an equivalent file URI
'''
full_path = urllib.pathname2url(os.path.abspath(file_path))
if file_path.startswith("file://"):
return full_path
else:
return "file://" + full_path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment