pysciter icon indicating copy to clipboard operation
pysciter copied to clipboard

Unable to execute a ZIP archive example

Open Ajinkz opened this issue 5 years ago • 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

Ajinkz avatar Mar 15 '19 14:03 Ajinkz

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

pravic avatar Mar 15 '19 17:03 pravic

Nothing have changed in .ZIP handling respect.

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

c-smile avatar Mar 15 '19 18:03 c-smile

@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?

pravic avatar Nov 12 '20 15:11 pravic

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 .

c-smile avatar Nov 12 '20 18:11 c-smile

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

pravic avatar Nov 12 '20 18:11 pravic

Check if https://github.com/c-smile/sciter-sdk/blob/master/samples/zip/test-explicit-main.htm works in wsciter/usciter on your machine.

c-smile avatar Nov 12 '20 18:11 c-smile

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**

c-smile avatar Nov 12 '20 19:11 c-smile

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.

pravic avatar Nov 18 '20 19:11 pravic

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

zpfz avatar Feb 05 '23 12:02 zpfz