sciter-sdk/pysciter

Unable to execute a ZIP archive example

Ajinkz opened this issue · 9 comments

OS: Windows 10
Python version: 3.6
Pysciter: 0.4.29

When I was trying to run
python ./archive.zip
I got this error

(face2) D:\Ajinkya\RASA\pysciter-master\examples>python ./archive.zip
warning:dom: failed to load "//archive.zip" file, error=161
Traceback (most recent call last):
  File "D:\ai\envs\face2\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "D:\ai\envs\face2\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File ".\archive.zip\__main__.py", line 7, in <module>
  File "D:\ai\envs\face2\lib\site-packages\sciter\host.py", line 107, in load_file
    raise sciter.SciterError("Unable to load file " + uri)
sciter.error.SciterError: Unable to load file archive.zip#archived.htm

@c-smile Andrew, has something been changed in zip archive handling?

Nothing have changed in .ZIP handling respect.

Check if SciterLoadFile gets called with absolute path or absolute file URL.

@c-smile Well, it did work in past.

archive.zip contains "archived.htm".

It was referenced as "archive.zip#archived.htm" and it used to work.

Now, I get for "archive.zip#archived.htm" the following:

warning:dom: failed to load "d:/usr/lib/gui/htmlayout/pysciter/examples/archive.zip%archived.htm" file, error=2

And for "archive.zip/archived.htm":

"warning:dom: failed to load "d:/usr/lib/gui/htmlayout/pysciter/examples/archive.zip/archived.htm" file, error=3

The only thing that works is: "archive.zip" as URL with "index.htm" in it.

So, is it possible to load a specific HTML from a ZIP archive? If yes, how?

Is this relative URL:
"pysciter/examples/archive.zip%archived.htm"
?
I suspect that problem is on pysciter side - it does not provide absolute file:// .... URL or absolute path.
Again Sciter has no notion of CWD - that's completely on Python,Go,C,whatever side .

No, it's an absolute url in all cases.

No, it's an absolute url in all cases.

I suspect it is not absolute URL according to this:

raise sciter.SciterError("Unable to load file " + uri)
> Unable to load file **archive.zip#archived.htm**

Well, it's all about absolute paths.

URL "archive.zip#archived.htm" doesn't work anymore.
URL "d:/pysciter/examples/archive.zip#archived.htm" doesn't work either despite looking like an absolute URL.
URL "d:\pysciter\examples\archive.zip#archived.htm" doesn't work as well.
URL "file://d:\pysciter\examples\archive.zip#archived.htm" works. So, from some point in Sciter's history the file:// part is mandatory now.

But that leads us to a broken example with "archive.zip" - well, it was just a trick anyway.

zpfz commented

By the way,has a way to load an ZIP with ZIP's password(prevent some body to modify the core files)?