Problem loading local files with webkit in python
Every time I need to load a local file using webkit in python I need to start with "file://" which I need to include in all files I am working with. How can I eliminate the need to do that? I want to load files like webview.load_uri('file.html')
instead of webview.load_uri('file://file.html')
?开发者_开发问答
You can't. webview.load_uri()
takes a string containing a URI. 'file.html'
isn't a URI, 'file://file.html'
is.
webview.load_string() takes the text of an html file. you can load the file into a file object without the file:// and read it into the load_string function.
精彩评论