Skip to content

Cannot run web after built it #5250

@wanfir

Description

@wanfir

I have built the flet as web using 'built' command. It is a successful. However, when I run the web in my computer using this command:
"python -m http.server --directory build\web"

then i open the web in my chrome browser with this url:
"http://localhost:8000/"

but, the web cannot be run. I have built the flet app multiple times, but the outcome still the same. the console always shows the same thing. I try built the web using 'flet publish' command and it is successful and able to run it on chrome.

console error:

"""
Uncaught ReferenceError: micropipIncludePre is not defined
at python.js:18:41
pyodide.asm.js:10 Loading micropip, packaging
pyodide.asm.js:10 Loaded micropip, packaging
pyodide.asm.js:10 Uncaught (in promise) PythonError: Traceback (most recent call last):
File "/lib/python312.zip/shutil.py", line 1267, in _unpack_tarfile
tarobj = tarfile.open(filename)
^^^^^^^^^^^^^^^^^^^^^^
File "/lib/python312.zip/tarfile.py", line 1842, in open
raise ReadError(f"file could not be opened successfully:\n{error_msgs_summary}")
tarfile.ReadError: file could not be opened successfully:

  • method gz: ReadError('not a gzip file')
  • method bz2: ReadError('not a bzip2 file')
  • method xz: CompressionError('lzma module is not available')
  • method tar: ReadError('truncated header')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/lib/python312.zip/_pyodide/_base.py", line 597, in eval_code_async
await CodeRunner(
File "/lib/python312.zip/_pyodide/_base.py", line 413, in run_async
await coroutine
File "", line 6, in
File "/lib/python312.zip/pyodide/http.py", line 137, in wrapper
return await method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/lib/python312.zip/pyodide/http.py", line 386, in unpack_archive
unpack_buffer(buf, filename=filename, format=format, extract_dir=extract_dir)
File "/lib/python312.zip/pyodide/_package_loader.py", line 251, in unpack_buffer
shutil.unpack_archive(f.name, extract_path, format)
File "/lib/python312.zip/shutil.py", line 1351, in unpack_archive
func(filename, extract_dir, **kwargs)
File "/lib/python312.zip/shutil.py", line 1269, in _unpack_tarfile
raise ReadError(
shutil.ReadError: /tmp/tmp91ni2ie_app.tar.gz is not a compressed or uncompressed tar file

at new_error (pyodide.asm.js:10:10009)
at pyodide.asm.wasm:0x16e356
at pyodide.asm.wasm:0x17849f
at pyodide.asm.wasm:0x328567
at pyodide.asm.wasm:0x1c441a
at pyodide.asm.wasm:0x2ca2cc
at pyodide.asm.wasm:0x20c217
at pyodide.asm.wasm:0x1c4b01
at pyodide.asm.wasm:0x1c4e10
at pyodide.asm.wasm:0x1c4e8e
at pyodide.asm.wasm:0x2a0ca0
at pyodide.asm.wasm:0x2a71fe
at pyodide.asm.wasm:0x1c4fce
at pyodide.asm.wasm:0x1c4c37
at pyodide.asm.wasm:0x177aff
at callPyObjectKwargs (pyodide.asm.js:10:62781)
at Module.callPyObjectMaybePromising (pyodide.asm.js:10:63963)
at wrapper (pyodide.asm.js:10:27341)
at Zn.e.port1.onmessage (pyodide.asm.js:10:101745)

new_error @ pyodide.asm.js:10
$wrap_exception @ pyodide.asm.wasm:0x16e356
$FutureDoneCallback_call @ pyodide.asm.wasm:0x17849f
$func4583 @ pyodide.asm.wasm:0x328567
$_PyObject_MakeTpCall @ pyodide.asm.wasm:0x1c441a
$func3619 @ pyodide.asm.wasm:0x2ca2cc
$func2181 @ pyodide.asm.wasm:0x20c217
$func1156 @ pyodide.asm.wasm:0x1c4b01
$_PyObject_Call @ pyodide.asm.wasm:0x1c4e10
$PyObject_Call @ pyodide.asm.wasm:0x1c4e8e
$_PyEval_EvalFrameDefault @ pyodide.asm.wasm:0x2a0ca0
$func3426 @ pyodide.asm.wasm:0x2a71fe
$_PyFunction_Vectorcall @ pyodide.asm.wasm:0x1c4fce
$PyObject_Vectorcall @ pyodide.asm.wasm:0x1c4c37
$_pyproxy_apply @ pyodide.asm.wasm:0x177aff
callPyObjectKwargs @ pyodide.asm.js:10
Module.callPyObjectMaybePromising @ pyodide.asm.js:10
wrapper @ pyodide.asm.js:10
Zn.e.port1.onmessage @ pyodide.asm.js:10
7python-worker.js:45 Uncaught (in promise) TypeError: flet_js.send is not a function
at self.onmessage (python-worker.js:45:17)
"""

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions