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

winrt.windows.foundation.collections missing #34

Open
JanPolley opened this issue Nov 28, 2024 · 2 comments
Open

winrt.windows.foundation.collections missing #34

JanPolley opened this issue Nov 28, 2024 · 2 comments

Comments

@JanPolley
Copy link

JanPolley commented Nov 28, 2024

Hello,

i want to test your new functionality "smp over ble". I have a Nordic nrf5340 running SMP and I can do a firmware update via nrf Connect.
I downloaded on github smpmgr-0.9.0-windows-amd64.zip, unpack it and run "smpmgr --ble MyDevice os reset". I also tried other commands like upgrade.
Every time I got the error that winrt.windows.foundation.collections is missing. Is it missing in the mentioned zip-file?
I installed winrt-Windows.Foundation.Collections via pip in my Python312-Path and found out that there is now a file called "_winrt_windows_foundation_collections.cp312-win_amd64.pyd".
I copied that file to _internal\winrt, but I got still the same error.

Here is the cmd output:

> C:\smpmgr-0.9.0>smpmgr --ble MyDevice os reset
[08:57:02] ERROR    Exception in callback                                                           base_events.py:1820
                    BleakScannerWinRT._received_handler(<winrt._winrt...0017075918550>,
                    <winrt._winrt...0017075918490>)
                    handle: <Handle
                    BleakScannerWinRT._received_handler(<winrt._winrt...0017075918550>,
                    <winrt._winrt...0017075918490>)> - base_events:1820
                    ┌───────────────────── Traceback (most recent call last) ─────────────────────┐
                    │ in _run:88                                                                  │
                    │                                                                             │
                    │ in _received_handler:147                                                    │
                    └─────────────────────────────────────────────────────────────────────────────┘
                    ModuleNotFoundError: No module named 'winrt.windows.foundation.collections'
           ERROR    Exception in callback                                                           base_events.py:1820
                    BleakScannerWinRT._received_handler(<winrt._winrt...0017075918570>,
                    <winrt._winrt...0017075918410>)
                    handle: <Handle
                    BleakScannerWinRT._received_handler(<winrt._winrt...0017075918570>,
                    <winrt._winrt...0017075918410>)> - base_events:1820
                    ┌───────────────────── Traceback (most recent call last) ─────────────────────┐
                    │ in _run:88                                                                  │
                    │                                                                             │
                    │ in _received_handler:147                                                    │
                    └─────────────────────────────────────────────────────────────────────────────┘
                    ModuleNotFoundError: No module named 'winrt.windows.foundation.collections'
           ERROR    Exception in callback                                                           base_events.py:1820
                    BleakScannerWinRT._received_handler(<winrt._winrt...0017075919150>,
                    <winrt._winrt...0017075918470>)
                    handle: <Handle
                    BleakScannerWinRT._received_handler(<winrt._winrt...0017075919150>,
                    <winrt._winrt...0017075918470>)> - base_events:1820
                    ┌───────────────────── Traceback (most recent call last) ─────────────────────┐
                    │ in _run:88                                                                  │
                    │                                                                             │
                    │ in _received_handler:147                                                    │
                    └─────────────────────────────────────────────────────────────────────────────┘
                    ModuleNotFoundError: No module named 'winrt.windows.foundation.collections'
           ERROR    Exception in callback                                                           base_events.py:1820
                    BleakScannerWinRT._received_handler(<winrt._winrt...00170759194F0>,
                    <winrt._winrt...0017075919230>)
                    handle: <Handle
                    BleakScannerWinRT._received_handler(<winrt._winrt...00170759194F0>,
                    <winrt._winrt...0017075919230>)> - base_events:1820
                    ┌───────────────────── Traceback (most recent call last) ─────────────────────┐
                    │ in _run:88                                                                  │
                    │                                                                             │
                    │ in _received_handler:147                                                    │
                    └─────────────────────────────────────────────────────────────────────────────┘
                    ModuleNotFoundError: No module named 'winrt.windows.foundation.collections'
[08:57:03] ERROR    Exception in callback                                                           base_events.py:1820
                    BleakScannerWinRT._received_handler(<winrt._winrt...00170759192B0>,
                    <winrt._winrt...0017075918290>)
                    handle: <Handle
                    BleakScannerWinRT._received_handler(<winrt._winrt...00170759192B0>,
                    <winrt._winrt...0017075918290>)> - base_events:1820
                    ┌───────────────────── Traceback (most recent call last) ─────────────────────┐
                    │ in _run:88                                                                  │
                    │                                                                             │
                    │ in _received_handler:147                                                    │
                    └─────────────────────────────────────────────────────────────────────────────┘
                    ModuleNotFoundError: No module named 'winrt.windows.foundation.collections'
           ERROR    Exception in callback                                                           base_events.py:1820
                    BleakScannerWinRT._received_handler(<winrt._winrt...00170759187B0>,
                    <winrt._winrt...0017075918F10>)
                    handle: <Handle
                    BleakScannerWinRT._received_handler(<winrt._winrt...00170759187B0>,
                    <winrt._winrt...0017075918F10>)> - base_events:1820
                    ┌───────────────────── Traceback (most recent call last) ─────────────────────┐
                    │ in _run:88                                                                  │
                    │                                                                             │
                    │ in _received_handler:147                                                    │
                    └─────────────────────────────────────────────────────────────────────────────┘
                    ModuleNotFoundError: No module named 'winrt.windows.foundation.collections'
[08:57:04] ERROR    Transport error: connection timeout - common:87                                        common.py:87
⠴ Connecting to MyDevice... error
@JPHutchins
Copy link
Collaborator

Hi @JanPolley ! I suspect an issue with PyInstaller "hidden imports", considering that our BLE dependency, Bleak, places some imports inside of runtime function calls rather than at module scope, which can prevent PyInstaller from finding them.

It may take some time to track down and test, so I recommend that you proceed by installing smpmgr via pipx instead of using the portable.

LMK how it goes!
JP

@JanPolley
Copy link
Author

Thanks for your fast reply!
After I installed it via pipx I tested it with the command "smpmgr --ble MyDevice os Test" and it worked.

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

No branches or pull requests

2 participants