Closed RaenonX closed 6 years ago
Additional Information:
I forgot to mention that my Python is running on Windows :rofl:
And I did some "research" on the source code and extracted the CityIDRegistry class. After I replace:
with gzip.open(res_name, "rt") as fh:
(Line 198)
with
with gzip.open(res_name, "r") as fh:
IT WORKS 😄
Code:
# -*- coding: utf-8 -*-
import tool
if __name__ == "__main__":
reg = tool.weather.cityids.CityIDRegistry('%03d-%03d.txt.gz')
print reg.ids_for('taichung')
Output (Console):
[(1668399, u'Taichung', u'TW')]
Hi @RaenonX I've run your very same code
and got no errors, everything was smooth
That said, we have tests covering CityIDRegistry
class: they would fail if there was a bug, but they don't
Anyway, the read mode rt
seems to be redundant (the default read mode is always t
in Python), I will fix it
Thanks for reporting
Probably it's because the platform In using? I got that when I ran the code on Windows
On Dec 1, 2017 4:14 AM, "Claudio Sparpaglione" notifications@github.com wrote:
Hi @RaenonX https://github.com/raenonx I've run your very same code
- on a container from the official Docker Python 2.7.14 image
- on my Linux box, which also has Python 2.7.14 installed
and got no errors, everything was smooth
That said, we have tests https://github.com/csparpa/pyowm/blob/develop/tests/integration/webapi25/test_cityidregistry_reads_fs.py covering CityIDRegistry class: they would fail if there was a bug, but they don't
Anyway, the read mode rt seems to be redundant (the default read mode is always t in Python), I will fix it
Thanks for reporting
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/csparpa/pyowm/issues/219#issuecomment-348307745, or mute the thread https://github.com/notifications/unsubscribe-auth/ARlt3xJm43xdl7eg2lR7mCTV3CsO67gkks5s7wyUgaJpZM4Qu9T8 .
Hi @RaenonX I've finally found time to test the potential bug on Windows and you are right: the issue happens on Python 2.7.x
I've also tested your fix and it works nice :)
So thanks again for reporting!
I ran the code below:
And got the these things:
Does anyone has the same problem as mine?
And I found this forum that says this is not the bug, should use the code like:
to fix it.
I hope that copying whole package and just edit one line will not be necessary :rofl: