开发者

Problem loading local files with webkit in python

开发者 https://www.devze.com 2023-01-29 20:20 出处:网络
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 t

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消