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

Blocks i3bar #6

Closed
Drachenkaetzchen opened this issue Mar 16, 2015 · 14 comments
Closed

Blocks i3bar #6

Drachenkaetzchen opened this issue Mar 16, 2015 · 14 comments

Comments

@Drachenkaetzchen
Copy link

Hi,

I probably have found a bug. I have added i3weather to my i3bar as per documentation:

bar {
status_command i3status | ~/bin/weather.py --wrap-i3-status 673711 --unit c

However, this gives the following results:

  1. It delays displaying the initial bar for about 20 seconds
  2. subsequent updates take also 20 seconds or so

It seems that weather.py blocks updating the i3bar somehow. When I remove it, my i3bar updates again every second.

@kalgynirae
Copy link
Collaborator

I think this is probably caused by the same underlying issue as #5. Which version of Python are you using?

@Drachenkaetzchen
Copy link
Author

I'm using Python 2.7.9. However, when I call weather.py manually, it immediately returns the correct answer, so I guess it's not related.

@calzoneman
Copy link
Owner

Are you on WiFi or otherwise unstable internet? If so, I can be almost certain #5 is the issue here. I've never had any problems with i3-weather in my i3bar for my desktop computer connected via Ethernet, however I ended up disabling it on my laptop since the WiFi networks I connect to often drop and cause #5.

@Drachenkaetzchen
Copy link
Author

No, my connection is stable (wired ethernet + good uplink provider). I have to note that those hangs occur always when running with --wrap-i3-status and never when running standalone. Do I have any chance to trace what's going on there?

@Drachenkaetzchen
Copy link
Author

Here are the last few lines of an strace ran on the console:

fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f763bcd2000
read(0, 

@kalgynirae
Copy link
Collaborator

I will investigate this later today. It's possibly a Python 2 issue, as I think @calzoneman and I both run it with Python 3. Have you tried running i3status | weather.py --wrap-i3-status in a terminal to see if anything interesting appears?

On March 16, 2015 1:38:35 PM EDT, "Timo A. Hummel" [email protected] wrote:

No, my connection is stable (wired ethernet + good uplink provider). I
have to note that those hangs occur always when running with
--wrap-i3-status and never when running standalone. Do I have any
chance to trace what's going on there?


Reply to this email directly or view it on GitHub:
#6 (comment)

@Drachenkaetzchen
Copy link
Author

No not yet, however, running ~/bin/weather.py --wrap-i3-status 673711 --unit c on the CLI also hangs.

@calzoneman
Copy link
Owner

With --wrap-i3-status, the program waits for the input being piped from i3, so it makes sense that it would hang if you don't give it any input. As kalgynirae said, you'll need to try running i3status | ~/bin/weather.py --wrap-i3-status ....

@calzoneman
Copy link
Owner

Question: when you say

However, this gives the following results:

  1. It delays displaying the initial bar for about 20 seconds
  2. subsequent updates take also 20 seconds or so

Does the bar display the weather information after those 20 seconds?

@calzoneman
Copy link
Owner

@kalgynirae I suspect it is a Python 2.x issue, specifically with regard to --wrap-i3-status. I just ran i3status | python2 --wrap-i3-status 673711 --unit c and it's hanging on my machine, while swapping python2 for python works.

@Drachenkaetzchen
Copy link
Author

@calzoneman yes, it does display, but delays updating the i3bar. When I run it from the CLI with i3status, I get no output, then many outputs at once. I can confirm that it works with python3 on my machine as well.

@calzoneman
Copy link
Owner

The problem appears to be that sys.stdin is buffered in Python 2.7. next(sys.stdin) doesn't return anything until EOF (^D) is reached.

@Drachenkaetzchen
Copy link
Author

Thanks for the great support and the fix. Should I test the fix or can I stick with python3?

@calzoneman
Copy link
Owner

It should work with either one. I use Python 3 since that is the default on Arch Linux, but it seems to work with Python 2.7 now.

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

3 participants