Kalmat / PyWinCtl

Cross-Platform module to get info on and control windows on screen
Other
186 stars 20 forks source link

getAllAppsWindowsTitles failed on PWA Edge App(Youtube Music) on Mac #65

Closed vincent911001 closed 1 year ago

vincent911001 commented 1 year ago

Hi,

I have experienced issue with problem on Youtube Music PWA which was installed as app from Edge browser:

>>> pwc.getAllAppsWindowsTitles()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/vincenttansinchia/Library/Python/3.9/lib/python/site-packages/pywinctl/_pywinctl_macos.py", line 359, in getAllAppsWindowsTitles
    res: tuple[list[str], list[list[str]]] = ast.literal_eval(ret)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/ast.py", line 62, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1

Thanks, Vincent

vincent911001 commented 1 year ago

On app_mode_loader

Kalmat commented 1 year ago

Hi! Thank you for raising this issue. I will try to reproduce your problem as soon as I can. I guess you are on macOS 13 (Ventura) using python 3.9, right?

Just to confirm: if you run the same script without YM PWA, it all works ok?

vincent911001 commented 1 year ago

Ya, without YM PWA, it works ok. Ya, I am on Mac OS Ventura and Python 3.9

Kalmat commented 1 year ago

Got it! YouTube Music App is not compatible with AppleScript. It is returning "missing value" to most queries. It's also true that the module should be protected against this kind of behaviors, but I never found a so incompatible application. Are you in a hurry to solve the problem? If so, we have two options: I can prepare a new version for PyPi or I can prepare a separate wheel file you can use whilst I finish the new version (v0.1) in the meantime.

Anyway, thank you so much for your feedback. It's really valuable to me!!!

vincent911001 commented 1 year ago

No worries, I have rebuilt a wheel file by replacing the "missing values" to None.