Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of zipped/tgz assets not working in MicroPython #2035

Closed
3 tasks done
ntoll opened this issue Apr 23, 2024 · 6 comments · Fixed by pyscript/polyscript#97 or #2036
Closed
3 tasks done

Use of zipped/tgz assets not working in MicroPython #2035

ntoll opened this issue Apr 23, 2024 · 6 comments · Fixed by pyscript/polyscript#97 or #2036
Labels
needs-triage Issue needs triage type: bug Something isn't working

Comments

@ntoll
Copy link
Member

ntoll commented Apr 23, 2024

Checklist

  • I added a descriptive title
  • I searched for other issues and couldn't find a solution or duplication
  • I already searched in Google and didn't find any good information or help

What happened?

Example of the problem using 2024.4.1 release: https://pyscript.com/@ntoll/zipmp/latest

Notice the settings.json uses a tgz archive to be unzipped in the browser's local FS. This results in an opaque error in the console.

What browsers are you seeing the problem on? (if applicable)

Firefox, Chrome

Console info

Uncaught (in promise) PythonError: Traceback (most recent call last):
  File "<stdin>", line 11, in <module>
OSError: 44

    at proxy_convert_mp_to_js_obj_jsside (micropython.mjs:1:116585)
    at proxy_convert_mp_to_js_obj_jsside_with_free (micropython.mjs:1:117751)
    at Object.runPython (micropython.mjs:1:108238)
    at Object.writeFile (micropython.js:72:33)
    at _utils.js:146:42
    at async Promise.all (latest/index 0)
    at async Object.engine (micropython.js:23:20)
    at async Ln (custom.js:95:19)

Additional Context

cc/ @WebReflection

@ntoll ntoll added type: bug Something isn't working needs-triage Issue needs triage labels Apr 23, 2024
@ntoll
Copy link
Member Author

ntoll commented Apr 23, 2024

Works fine with Pyodide but not MicroPython.

@WebReflection
Copy link
Contributor

WebReflection commented Apr 23, 2024

both zip and tar.gz are tested via integration tests in polyscript: https://github.com/pyscript/polyscript/blob/main/test/zip/micropython.html

true that https://github.com/pyscript/polyscript/blob/main/test/zip/tar.gz.toml parses a file with only one file, it doesn't go beyond that, but what's the content of those zip and tar.gz, if I might ask? My gut tells me it might be an order of folders issues, where in MicroPython os.mkdir can't create subfolders directly as in mkdir -p ./any/deeper/path as I don't see any other reason for this to fail with both formats ... I was trying to get those files directly to test locally, please send me both via slack as apparently attached files in GitHub are forever and used as exploit these days 😅

edit I've found a way to download those files ... investigating

@WebReflection
Copy link
Contributor

This issue is being tackled in here: pyscript/polyscript#97

@WebReflection
Copy link
Contributor

@ntoll see #2036 (comment)

@WebReflection
Copy link
Contributor

live working demo here: https://pyscript.com/@agiammarchi/zipmp-copy/latest

@WebReflection
Copy link
Contributor

@ntoll watch out, even after my fixes for the unpacking, your code uses an await in the main execution context so you better use async attribute within your script or remove that await outside any function.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "invent/__init__.py", line 27, in <module>
  File "invent/utils.py", line 34, in <listcomp>
SyntaxError: 'await' outside function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Issue needs triage type: bug Something isn't working
Projects
None yet
2 participants