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

Not quite Python 3 compatible #4

Open
v-python opened this issue Jul 19, 2014 · 6 comments
Open

Not quite Python 3 compatible #4

v-python opened this issue Jul 19, 2014 · 6 comments

Comments

@v-python
Copy link

Would be nice if it were. It actually gets as far as displaying the icon in the systray, but dies when you hover... by "dies" I mean something goes wrong, the icon disappears, but not the thread or the python. Must kill it in task manager.

From glancing over the source, it seems likely that it has something to do with Unicode strings, although many seem to get converted to ASCII (and I don't have non-ASCII strings in the menu).

@wiggin15
Copy link
Contributor

I ran a basic test and it works for me with Python 3.4.
As you suggested, the main difference between Python 2.x and Python 3.x is that strings in Python 3.x are unicode by default, but I convert all of them to ASCII because of that.
I saw problems similar to what you are describing when the NOTIFYICONDATA struct is not padded correctly, but I don't see how this can happen...

A few questions to try to debug this:

  • Which version of Python 3 are you using?
  • Are you running under x86 or x64? (both for Windows and Python)
  • Can you run your script through the command line and see if any traceback appears?
  • Can you please try to run the script I added in the development branch, tests\test.py?
  • Can you please test the code under the branch "unicode" - I switched to using the unicode Windows API and converting everything to unicode instead of the other way around...

@v-python
Copy link
Author

Thanks for the quick response.
• I was using Python 3.3
• x64 Windows and Python.
• Did run the script from the command line. No traceback seen.
• Tried copying your code into my test program with same results... icon vanishes on hover.
Running your test program exactly, I get the following. I'm not sure why this is complex with two levels of modules, etc. rather than a single .py file to import, but hey, that just gives more to debug?

d:\my\py>test.py
Traceback (most recent call last):
File "D:\my\py\test.py", line 2, in
from infi.systray import SysTrayIcon
File "D:\my\py\infi\systray__init__.py", line 2, in
from traybar import SysTrayIcon
ImportError: No module named 'traybar'

d:\my\py>dir /s infi
Volume in drive D is my
Volume Serial Number is 8221-5356

Directory of d:\my\py\infi

07/19/2014 01:19 PM

.
07/19/2014 01:19 PM ..
07/19/2014 01:19 PM systray
05/07/2014 01:15 PM 56 init.py
07/19/2014 01:19 PM pycache
1 File(s) 56 bytes

Directory of d:\my\py\infi\systray

07/19/2014 01:19 PM

.
07/19/2014 01:19 PM ..
05/07/2014 01:15 PM 10,355 traybar.py
05/07/2014 01:15 PM 6,498 win32_adapter.py
05/07/2014 01:15 PM 88 init.py
07/19/2014 01:19 PM pycache
3 File(s) 16,941 bytes

Directory of d:\my\py\infi\systray__pycache__

07/19/2014 01:19 PM

.
07/19/2014 01:19 PM ..
07/19/2014 01:12 PM 324 init.cpython-33.pyc
1 File(s) 324 bytes

Directory of d:\my\py\infi__pycache__

07/19/2014 01:19 PM

.
07/19/2014 01:19 PM ..
07/19/2014 01:12 PM 244 init.cpython-33.pyc
1 File(s) 244 bytes

 Total Files Listed:
           6 File(s)         17,565 bytes
          11 Dir(s)  308,207,185,920 bytes free

• will try -- sounds like a better idea, overall, to use the Unicode interfaces, would allow non-ASCII characters (unless you still prohibit those, haven't looked at that code yet.

@v-python
Copy link
Author

Finally got time to test the Unicode version. No error with the test program, but hovering made the systray icon disappear.

@wiggin15
Copy link
Contributor

I saw the ImportError yesterday, already fixed.
I'm not sure how to fix this, because it works here. I will try to use Python 3.3, maybe that's the difference.
You're saying it works with Python 2.x? And what version of Windows are you running?

@wiggin15
Copy link
Contributor

Alright I was able to reproduce with Python 3.3.5. Will look into it (in the meantime you can try Python 3.4 if you want)

@wiggin15
Copy link
Contributor

Looks like it's a thrading problem. Moving _register_class to the message loop thread (or not using threading for the message loop) fixes the issue. But I don't know why... I'm giving up for now, maybe I will look into it later.

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