containers / containers/podman-compose
Issue with add_signal_handler on Windows: asyncio.run(async_main()): NotImplementedError
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
NotImplementedError only on Windows.
NOT a bug in Podman.
**To Reproduce**
Steps to reproduce the behavior:
1. podman machine init
2. podman machine start
3. podman-compose up
**Expected behavior**
Container(s) should start successfully.
**Actual behavior**
Failure to start.
NotImplementedError:
```
LocalCache\local-packages\Python313\site-packages\podman_compose.py
loop.add_signal_handler(signal.SIGINT, lambda: [t.cancel("User exit") for t in tasks])
```
**Output**
```
$ podman-compose version
podman-compose version 1.3.0
podman version 5.3.2
**Environment:**
- OS: Windows 11 Pro 24H2 26100.2894
- podman version: 5.3.2 remote
- podman compose version: [(git hex)](pip: podman_compose-1.3.0.dist)
**Additional context**
Solution/Workaround:
```
# LocalCache\local-packages\Python313\site-packages\podman_compose.py
# loop.add_signal_handler(signal.SIGINT, lambda: [t.cancel("User exit") for t in tasks])
# -->
# signal.signal(signal.SIGINT, lambda signum, frame: [t.cancel("User exit") for t in tasks])
```
Credits for inspiration: [hellopeach](https://stackoverflow.com/users/3042695/hellopeach).
[Answer](https://stackoverflow.com/a/54886771)
Additional notes in below-linked issue-comment.
Duplicate of: [My own workaround: Issue #1005](https://github.com/containers/podman-compose/issues/1005#issuecomment-2272640816).
Resubmitting because a Solution/Workaround was already suggested but was not incorporated into v1.3.0.
The workaround was originally suggested by me. When a GitHub account is deleted, the username is shown as 'ghost'.
I have been using my own workaround since the previous version without any known issues. No known issues with v1.3.0. At your own risk, you're free to incorporate this workaround into podman_compose.py.
As an aside, some cleanup is possible with the existing podman_compose.py code. I.e. List += can be replaced with 'append' or 'extend' as required, etc.
Contributor guide
Assessment
This issue has not been assessed yet.