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

asyncio: _ssl not found #175

Open
roistoFIN opened this issue Aug 28, 2024 · 1 comment
Open

asyncio: _ssl not found #175

roistoFIN opened this issue Aug 28, 2024 · 1 comment
Labels
usage wontfix This will not be worked on

Comments

@roistoFIN
Copy link

I'm writing a simple game using asyncio operations.

I'm trying to open stream:
self.reader, self.writer = await asyncio.open_connection(self.server_IP, self.server_port)

It works fine in my local python environment. When I use it with pygbag, it does not.

The error in log:
--8<--
78: Async I/O error : file not found https://pypi.org/simple/_ssl/
<class 'aio.sentinel'> ∅
Traceback (most recent call last):
File "/data/data/org.python/assets/site-packages/aio/toplevel.py", line 200, in interact_step
self.rv = await self.shell.coro.pop(0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/org.python/assets/site-packages/aio/toplevel.py", line 109, in import_now
vars(import("main"))[want] = import(want)
^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_ssl'

Traceback (most recent call last):
File "/data/data/org.python/assets/site-packages/aio/init.py", line 293, in step
loop._run_once()
File "/usr/lib/python3.12/asyncio/base_events.py", line 1947, in _run_once
event_list = self._selector.select(timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/selectors.py", line 323, in select
r, w, _ = self._select(self._readers, self._writers, [], timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 8] Bad file descriptor
--8<--

Am I doing something wrong or doesn't pygbag support asyncio network operations?

@pmp-p
Copy link
Member

pmp-p commented Aug 29, 2024

pygbag supports only a subset of BSD sockets via the normal stdlib python socket
That means

  • sockets must all be non-blocking.
  • real socket on server has to be "websockified"

poc https://pygame-web.github.io/showroom/pythongit.html?-i#src/test_socket_irc.py code

minimal irc lobby https://github.com/pygame-web/pygbag.net

if you want to build a game upon lobby code (it is free) you should join pygame community discord to get a debug channel id for your game.

@pmp-p pmp-p added usage wontfix This will not be worked on labels Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usage wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants
@pmp-p @roistoFIN and others