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

Can't use modules #183

Open
ManPython opened this issue Nov 15, 2024 · 2 comments
Open

Can't use modules #183

ManPython opened this issue Nov 15, 2024 · 2 comments
Labels

Comments

@ManPython
Copy link

As I read should be done:

dependencies = [
#  "six",
#  "bs4",
#  "markdown-it-py",
#  "pygments",
#  "rich",
#  "mdurl",
#  "textual",
pygame,
pytmx, 
]

But pygbag not compiling this but downloading. Event no dependencies or in.

1187: repo['-CDN-']='http://localhost:8000/archives/repo/' does not provide want='View'
1187: repo['-CDN-']='http://localhost:8000/archives/repo/' does not provide want='Control'
635: maybe_wanted=[] known failed aio.pep0723.hint_failed=['View', 'Control']
715: starting shell
1039: 73 lines queued for async eval
going interactive
746: TODO detect input/print to select repl debug
189 : FIXME sync->async->sync import bytecode retry in non interactive
await aio.pep0723.pip_install("pytmx");import pytmx
282: searching pytmx
76: fopen: fetching "https://pypi.org/simple/pytmx/"
76: fopen: fetching "https://files.pythonhosted.org/packages/35/e0/fd0a2d2b93599dec876158fe7fccb8c3e8096844a5a4110dd5bc67377128/PyTMX-3.32-py3-none-any.whl#sha256=4da4c01133dfcb2746cb4e7f46ea1aef21d56119ab044f8f77b9906dea5fbccb"
142: /tmp/PyTMX-3.32-py3-none-any.whl installed
@pmp-p
Copy link
Member

pmp-p commented Nov 16, 2024

the pep block in an example, in your case it is likely to be

# /// script
# dependencies = [
#  "pygame-ce",
#  "pytmx",
# ]
# ///

do not remove the # follow https://peps.python.org/pep-0723/ guide

@pmp-p pmp-p added the usage label Nov 16, 2024
@ManPython
Copy link
Author

Thx for support. It's clear but here is case:
Chrome:

======  REDIRECT TO DEV HOST http://localhost:8000/archives/repo/  ========
abitag='cp312'
apitag='wasm32_bi_emscripten'


{}
----------------------------------------

656: aio.pep0723.pip_install deps=[]

1214: list_imports len(code)=5013 file=None hint='/data/data/org.python/assets/__main__.py'")
aio.pep0723.Config.pkg_repolist[0]['-CDN-']='http://localhost:8000/archives/repo/'


1153: scan_imports hint='/data/data/org.python/assets/__main__.py' filename='<stdin>' len(code)=5013 ['pygame.base']
635: maybe_wanted=['pygame.base'] known failed aio.pep0723.hint_failed=[]
282: searching pygame.base
76: fopen: fetching "http://localhost:8000/archives/repo/cp312/pygame_static-1.0-cp312-cp312-wasm32_bi_emscripten.whl#"
142: /tmp/pygame_static-1.0-cp312-cp312-wasm32_bi_emscripten.whl installed
254: patching pygame.base
Traceback (most recent call last):
  File "/data/data/org.python/assets/site-packages/aio/pep0723.py", line 268, in do_patches
    platform.patches.pop(dep)()
  File "/data/data/org.python/assets/site-packages/platform_wasm/todo.py", line 318, in patch_pygame
    import pygame.base
  File "/data/data/org.python/assets/site-packages/pygame/__init__.py", line 93, in <module>
    import pygame_static
ImportError: Could not load dynamic lib: /data/data/org.python/assets/build/env/pygame_static.cpython-312-wasm32-emscripten.so
RangeError: WebAssembly.Compile is disallowed on the main thread, if the buffer size is larger than 4KB. Use WebAssembly.compile, or compile on a worker thread.
715: starting shell
1039: 213 lines queued for async eval
Loading xpygame from xpygame.apk
    Pygbag Version : 0.9.2
    Template Version : 0.9.0
    Python  : 3.12
    CDN URL : http://localhost:8000//archives/0.9/
    Screen  : 1280x720
    Title   : xpygame
    Folder  : xpygame
    Authors : pgw
    SPDX-License-Identifier: cookiecutter.spdx


1764: __file__='/data/data/org.python/assets/__main__.py' done : now trying user sources
1830: local=None source='' is_py=False hint='main.py'
1867: local=None source='' is_py=False hint='main.py'
404: embed= or sys.argv=['debug']
651: starting EventTarget in a few seconds

Python 3.12.2 (main, Mar  5 2024, 11:18:41) [Clang 19.0.0git (https:/github.com/llvm/llvm-project aec6a04b8e99b42eca431fc0b5 on emscripten
Type "help", "copyright", "credits" or "license" for more information.
>>> Task exception was never retrieved
future: <Task finished name='custom_site' coro=<custom_site() done, defined at <console>:52> exception=ImportError('dynamic module does not define module export function (PyInit_pygame_static)')>
Traceback (most recent call last):
  File "<console>", line 67, in custom_site
  File "/data/data/org.python/assets/site-packages/pygame/__init__.py", line 93, in <module>
    import pygame_static
ImportError: dynamic module does not define module export function (PyInit_pygame_static)

KeyboardInterrupt
>>> 

On FireFox is going more far but hanged. There is top belt about slow browser by this site.. + stop button.
I'm trying with this as basic for this type projects:

# /// script
# dependencies = [
#  "pygame-ce",
#  "pytmx",
#  "cv2",
#  "numpy",
#  "pil",
#  "pillow",
# ]
# ///

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants