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

ValueError: string too long w.r.t. win32.NOTIFYICONDATAW #460

Open
woctezuma opened this issue May 5, 2024 · 2 comments
Open

ValueError: string too long w.r.t. win32.NOTIFYICONDATAW #460

woctezuma opened this issue May 5, 2024 · 2 comments
Labels
Bug Something isn't working

Comments

@woctezuma
Copy link

woctezuma commented May 5, 2024

I get the following error after minimizing the script to the tray. No idea what changed as the error was not there a few days ago.

Exception in thread Thread-1 (setup_handler):
Traceback (most recent call last):
  File "C:\Users\Wok\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1052, in _bootstrap_inner
    self.run()
  File "C:\Users\Wok\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 989, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Wok\PycharmProjects\TwitchDropsMiner\.venv\Lib\site-packages\pystray\_base.py", line 400, in setup_handler
    self.visible = True
    ^^^^^^^^^^^^
  File "C:\Users\Wok\PycharmProjects\TwitchDropsMiner\.venv\Lib\site-packages\pystray\_base.py", line 184, in visible
    self._show()
  File "C:\Users\Wok\PycharmProjects\TwitchDropsMiner\.venv\Lib\site-packages\pystray\_win32.py", line 59, in _show
    self._message(
  File "C:\Users\Wok\PycharmProjects\TwitchDropsMiner\.venv\Lib\site-packages\pystray\_win32.py", line 337, in _message
    win32.Shell_NotifyIcon(code, win32.NOTIFYICONDATAW(
                                 ^^^^^^^^^^^^^^^^^^^^^^
ValueError: string too long (132, maximum length 128)
Package    Version
---------- -------
aiohttp    3.9.3
aiosignal  1.3.1
attrs      23.2.0
frozenlist 1.4.1
idna       3.6
multidict  6.0.5
pillow     10.2.0
pystray    0.19.5
pywin32    306
six        1.16.0
truststore 0.8.0
yarl       1.9.4
@woctezuma
Copy link
Author

Nevermind, the error stopped happening after I have finished mining Apex drops.

Picture

I have upgraded the required packages, just in case.

Package    Version
---------- -------
aiohttp    3.9.5
aiosignal  1.3.1
attrs      23.2.0
frozenlist 1.4.1
idna       3.7
multidict  6.0.5
pillow     10.3.0
pystray    0.19.5
pywin32    306
six        1.16.0
truststore 0.9.0
yarl       1.9.4

@woctezuma woctezuma closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2024
@DevilXD
Copy link
Owner

DevilXD commented May 6, 2024

Hello.

The error going away doesn't resolve the underlying issue, which in this case appears to be a 128 characters limit on a tray icon title. This can apparently be exceeded, if a drop that's currently being mined has a long name, or belongs to a game that has a long name, or a combination of these two.

The simplest solution would be to just always trim the tray icon title down to <128 characters, but that'd just make it ugly and weirdly cut-off in these cases. A proper solution would be to always leave the main title and progress percentage up, while only trimming the drop's name. If that's isn't enough, then trim the game's name as well. Maybe the application title could be removed as well, solely to allow for more characters to be displayed. I'll try to put out a patch for this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants