Open vortex1024 opened 2 years ago
Which line triggers the error?
UserNotificationListener.get_current()
This should be UserNotificationListener.current
. It is a property.
ah, sorry. the next line:
listener.add_notification_changed(handler)
triggers the erorr
does the error still happen if you fix the current
property?
This should be
UserNotificationListener.current
. It is a property.
Actually, I guess this is wrong because of pywinrt/pywinrt#13. Static properties currently are not implemented like instance properties.
well, yes. AttributeError: type object '_winsdk_Windows_UI_Notifications_Management.UserNo' has no attribute 'current' still, I guess all that would do is call get_current under the hood, right? would it help if I gave you the whole code to test? although it is not much, just imports.
I'm not sure that anything in the Windows.UI namespace is really usable outside of a Windows Store app at this point.
ok. it seems partially usable, at least, since I can get the notification list and get_access_request_async returns allowed, only the event doesn't work. That's why I thought it should be functional.
I was using Python 3.10.9, installed with the official 64-bit installer, and the program operated as expected because I was using the python3
command, which was pointing to the Windows Store Python3 installation.
I sent the script to a coworker who installed 3.11.1, and he received the error. I installed 3.11.1 and replicated the same error as the OP.
Steps to resolve the bug:
python3
. This should launch the Windows Store Python 3.10 page.python3 --version
. You should see Python 3.10.9
as the output.python3 -m pip install winsdk
. These steps resolved the error on two separate machines, and the program successfully listened for new notifications.
The issue is resolved when installing Python from the Windows store rather than python.org.
I was using Python 3.10.9, installed with the official 64-bit installer, and the program operated as expected because I was using the
python3
command, which was pointing to the Windows Store Python3 installation.I sent the script to a coworker who installed 3.11.1, and he received the error. I installed 3.11.1 and replicated the same error as the OP.
Steps to resolve the bug:
- Uninstall all Python-related apps and programs from Apps & Features ( this isn't entirely necessary, but a good sanity check)
- Open a new PowerShell and type
python3
. This should launch the Windows Store Python 3.10 page.- Click the Get button to install Python 3.10.
- After the installation, restart your PowerShell and verify the installation with
python3 --version
. You should seePython 3.10.9
as the output.- Install pywinsdk with
python3 -m pip install winsdk
.These steps resolved the error on two separate machines, and the program successfully listened for new notifications.
I can confirm that the error isn't present on the Microsoft Store edition of Python. I've looked EVERYWHERE for a solution, thank you @gradnerj
if I do
where handler is another defined function I get
I know I have access to notifications because
works
any fix? thanks