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

utf support #9

Closed
KrzysztofKowalski opened this issue Mar 4, 2018 · 3 comments
Closed

utf support #9

KrzysztofKowalski opened this issue Mar 4, 2018 · 3 comments

Comments

@KrzysztofKowalski
Copy link

KrzysztofKowalski commented Mar 4, 2018

hi

i have this result when running:


~/workspace/MyAppNap> /usr/bin/python myAppNap.py Zdjęcia
Invalid app name, will not suspend/resume anything
        Will monitor apps in focus, switch to your desired app to see valid name
Currently focused on Terminal
myAppNap.py:53: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if last_active_app == desiredApp:

Currently focused on Zdjęcia # its photos app in polish

Currently focused on Terminal


^C
Exiting script
~/workspace/MyAppNap> /usr/bin/python myAppNap.py Trello 
Monitoring Trello, with PIDs: ['2018', '2019', '2028', '2030'] # multiple PIDs, not working then
Currently focused on Terminal
Stopping Trello
Traceback (most recent call last):
  File "myAppNap.py", line 64, in <module>
    os.kill(pid, signal.SIGSTOP)
TypeError: an integer is required
@PurpleMyst
Copy link

PurpleMyst commented Mar 4, 2018

Hi. Could you please show the output of myAppNap.py when you focus on the photo app and Trello? As in, does it print the name in your language or in English?

The second issue is already fixed in PRs #4 and/or #7, just a simple case of converting the output of pgrep to ints.

It would also help if you placed the output of your terminal in code blocks 😃. Like this:

~/workspace/MyAppNap> /usr/bin/python myAppNap.py Zdjęcia
Invalid app name, will not suspend/resume anything
Will monitor apps in focus, switch to your desired app to see valid name
Currently focused on Terminal
myAppNap.py:53: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
if last_active_app == desiredApp:

Currently focused on Zdjęcia # its photos app in polish

Currently focused on Terminal

^C
Exiting script
~/workspace/MyAppNap> /usr/bin/python myAppNap.py Trello
Monitoring Trello, with PIDs: ['2018', '2019', '2028', '2030'] # multiple PIDs, not working then
Currently focused on Terminal
Stopping Trello
Traceback (most recent call last):
File "myAppNap.py", line 64, in 
os.kill(pid, signal.SIGSTOP)
TypeError: an integer is required

@KrzysztofKowalski
Copy link
Author

KrzysztofKowalski commented Mar 4, 2018

its:


~/workspace/MyAppNap> /usr/bin/python myAppNap.py       
Invalid app name, will not suspend/resume anything
        Will monitor apps in focus, switch to your desired app to see valid name
Currently focused on Terminal
Currently focused on Zdjęcia
Currently focused on Trello
Currently focused on Terminal
^C
Exiting script

@PurpleMyst
Copy link

Ah, I've diagnosed the issue. We need to convert from bytes to UTF-8 strings.

I've tried fixing it in commit ac6a396 on my fork. Could you try what you've tried on this version on my fork?

@omikun omikun closed this as completed in 516729a Mar 4, 2018
JMY1000 pushed a commit to JMY1000/ForceNap that referenced this issue Apr 8, 2018
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