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

Pip install pyowm 2.6.0 does not seem to install registry files #173

Closed
ghost opened this issue Jan 30, 2017 · 18 comments
Closed

Pip install pyowm 2.6.0 does not seem to install registry files #173

ghost opened this issue Jan 30, 2017 · 18 comments
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Jan 30, 2017

  • Python 3.5.2+
  • PyOWM 2.6.0
  • Linux 4.8.0-34-generic Ubuntu

pip installed pyowm, really excited to test these new registries (thanks!). But I got this:

File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 1569, in get_resource_stream
    return open(self._fn(self.module_path, resource_name), 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.5/dist-packages/pyowm/webapi25/cityids/103-108.txt'

I got no result from locate 103-108.txt

and for ll /usr/local/lib/python3.5/dist-packages/pyowm/webapi25/cityids I got:

drwxr-sr-x 3 root staff 4096 Jan 30 22:38 ./
drwxr-sr-x 5 root staff 4096 Jan 30 22:38 ../
-rw-r--r-- 1 root staff    1 Jan 30 22:38 __init__.py
drwxr-sr-x 2 root staff 4096 Jan 30 22:38 __pycache__/

So then I tried pip install --upgrade --no-deps --force-reinstall pyowm

Collecting pyowm
Installing collected packages: pyowm
  Found existing installation: pyowm 2.6.0
    Uninstalling pyowm-2.6.0:
      Successfully uninstalled pyowm-2.6.0
Successfully installed pyowm-2.6.0

But still no luck. In the scripts dir I see https://github.com/csparpa/pyowm/blob/master/scripts/generate_city_id_files.py but this doesn't appear to be in the pip install, so I downloaded and ran it but got

  File "generate_city_id_files.py", line 25
    print 'Downloading file '+city_list_url+' ...'
                            ^
SyntaxError: Missing parentheses in call to 'print'

Meaning it's not python 3.5 compatible - I don't really want to install python 2 if I don't need to, but is this the only way?

My apologies if I am being stupid here and missing something and I do appreciate all your work on this.

@csparpa csparpa self-assigned this Jan 31, 2017
@csparpa csparpa added the bug label Jan 31, 2017
@csparpa csparpa added this to the Release 2.6.1 milestone Jan 31, 2017
@csparpa
Copy link
Owner

csparpa commented Jan 31, 2017

This might help: http://stackoverflow.com/a/11848281

@ghost
Copy link
Author

ghost commented Jan 31, 2017

Hi @csparpa - thanks. Is this something that I can do to trigger a download, or was this meant as a reference for yourself but not something I can do? Thanks!

@csparpa
Copy link
Owner

csparpa commented Jan 31, 2017

@lardconcepts meant to be a reference for myself, but you could always take the opportunity to try out yourself and contribute ;-)
thanks... I will probably fix and release 2.6.1 tonight

@ghost
Copy link
Author

ghost commented Jan 31, 2017

I would if I knew where to begin! Pip and python is largely a mystery to me and I'm so glad people like you know what you're doing 👍 Thanks for the fast response 🥇

csparpa added a commit that referenced this issue Jan 31, 2017
@csparpa
Copy link
Owner

csparpa commented Jan 31, 2017

Shoud be fixed with d15303d

@csparpa csparpa closed this as completed Jan 31, 2017
csparpa added a commit that referenced this issue Jan 31, 2017
* Set a test API key (the one in the API call examples from OWM API website)

* Try to fix Travis Virtualenv support for Py32

* Fix again

* Bump to version 2.3.1

* Don't commit coverage file

* Dockerfile (#106)

* First attempt

* Guide

* Fix Dockerfile and docs

* Update docs

* Change URL of documentation to comply with new readthedocs domain

* Backporting from master branch

* Refactor integration tests to use the API key specified in api_key.py

* Fix ValueError then sunrise_time & sunset time is less than zero when there is a polar day

* Fix ValueError then sunrise_time & sunset time is less than zero when there is a polar day

* Fix ValueError then sunrise_time & sunset time is less than zero when there is a polar day

* Fix ValueError then sunrise_time & sunset time is less than zero when there is a polar day

* Fix ValueError then sunrise_time & sunset time is less than zero when there is a polar day

* Messed up with Git... sunrise/sunset fix from #109 is OK now

* Sometimes Wind data is None

Hello !
I'm useing Homeassistant, and sometimes I got the following error:
```
Traceback (most recent call last):
  File "/home/titilambert/gits/domo/homeassitant/env/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 98, in _setup_platform
    discovery_info)
  File "/home/titilambert/gits/domo/homeassitant/env/lib/python3.4/site-packages/homeassistant/components/sensor/openweathermap.py", line 70, in setup_platform
    dev.append(OpenWeatherMapSensor(data, variable, unit))
  File "/home/titilambert/gits/domo/homeassitant/env/lib/python3.4/site-packages/homeassistant/components/sensor/openweathermap.py", line 94, in __init__
    self.update()
  File "/home/titilambert/gits/domo/homeassitant/env/lib/python3.4/site-packages/homeassistant/components/sensor/openweathermap.py", line 114, in update
    self.owa_client.update()
  File "/home/titilambert/gits/domo/homeassitant/env/lib/python3.4/site-packages/homeassistant/util/__init__.py", line 289, in wrapper
    result = method(*args, **kwargs)
  File "/home/titilambert/gits/domo/homeassitant/env/lib/python3.4/site-packages/homeassistant/components/sensor/openweathermap.py", line 179, in update
    self.longitude)
  File "/home/titilambert/gits/domo/homeassitant/config/deps/pyowm/webapi25/owm25.py", line 432, in three_hours_forecast_at_coords
    forecast = self._parsers['forecast'].parse_JSON(json_data)
  File "/home/titilambert/gits/domo/homeassitant/config/deps/pyowm/webapi25/forecastparser.py", line 66, in parse_JSON
    for item in d['list']]
  File "/home/titilambert/gits/domo/homeassitant/config/deps/pyowm/webapi25/forecastparser.py", line 66, in <listcomp>
    for item in d['list']]
  File "/home/titilambert/gits/domo/homeassitant/config/deps/pyowm/webapi25/weather.py", line 462, in weather_from_dictionary
    wind = d['wind'].copy()
AttributeError: 'NoneType' object has no attribute 'copy'
```

This patch fixes this error

* Regression test for #110

* update with new contributor

* Fixes for #110 and  #114

* Forgot...

* Were missing

* Bump to version 2.3.2

* How to install multiple python versions

* Feature/#100 python34 support (#118)

* Fix failing test on py32

* update

* fix wrong command

* Ran all tests against Python3.4 and Python3.5 using tox

* Forgot to align Travis as well

* added weather_history_at_coords (#89)

* Add txemi and sorted alphabetically

* Unit tests for method: weather_history_at_coords

* A bit too much stuff passed in as params :-p

* Feature/#121 datetime switch (#122)

* A bit too much stuff passed in as params :-p

* Now you can get reference/reception times as Python datetime.datetime objects as well

* Update

* hoorayyy!

* Added support for unicode place names (#86)

* Update

* Better checks for visibility distance - credits to @dstmar

* Feature/#112 weather by ids (#123)

* improve test that sometimes fails (on very busy machines)

* Added OWM25 method "weather_at_ids"

* Vast refactoring

* Update city ID files and prepare for release 2.4.0

* Back ported from master branch

* Slack team

* Possible fix for Unicode names (#127)

* Update link to OWM API docs

* Add timezone info (#128)

* tests and doc for string/unicode-handling functions in OWM25

* Feature/#93 uv index api (#131)

* New entity: UVIndex, along with unit tests and XMLNS

* New exception for 401 erorrs

* JSON parser for UVIndex instances

* More utils: last_month, last_year, next_month, next_year

* Add "interval" attribute to UVIndex

* Wired new HTTP client for UV API subset; a bit of refactoring

* tests for uvindex_around_coords

* Add missing location to print

* Better exception handling

* Intergation test

* Ooops

* Feature/#129 air pollution api (#134)

* COIndex entity and tests

* Change XML schema and fix tests

* Fix CO sample key: had to be "value" instead of "vmr"

* COIndexParser and test

* Typo

* HTTP Air Pollution data client and tests

* cut 'n' paste leftovers

* Refactoring: we're getting too verbose, man!

* More refactoring

* OWM method for polling CO and test

* Fix docs

* Fix mess about reception_time: now UVIndex entities have both a reference_time and a reception_time

* Same fix: reference_time and reception_time are now available (with proper semantic) on COIndex

* Add is_forecast method to COIndex

* fix test

* cleaner

* Ozone entity and OzoneParser

* Integation tests updated with air pollution airpoints check

* Add ozone_around_coords method to OWM25 and patched tests along

* Fix bug: it was failing due to missing location sting

* Better exception raising

* Improved some integration tests

* better indentation

* Slight change

* Update version, prepare for dumping version

* Remove dead code

* Docstring fixes

* Fix docstrings more

* Fix erorr

* Improve dockerfile

* Backport from master branch

* #130 done (#139)

* Feature/#140 add zip code method (#142)

* Create method for getting weather based on zip code and country code

* Create unit test for new  method

* Add integration test for weather_at_zipcode

* Added my name into CONTRIBUTORS.md

* Remove uneeded 'pass' at end of function

* Bugfix

* #138 django models (#144)

* Using now tox also for integration tests running

* New ignored

* First model: Location

* More models

* Rename and replace with full Django project

* Station model

* StationHistory model

* UVIndex model

* Forgot some methods

* Fix typo

* Global import

* how to run tests

* Missing models and tests (still broken)

* Wrong classes

* Missing __repr__ methods

* Tests now working and fixed a few bugs

* Fix fields nullability

* save_all()

* Move all Django models stuff to a separate Github repository

* Remove ghost packages

* Don't package tests anymore

* also, no more test suites in setup.py

* Reverted

* Shorten README, linking to new Wiki pages

* Port back from master branch

* More contributors, more fun!

* Fix #149

* better name indeed

* Fix bug #152

* Deprecation decorator (#155)

* Deprecation decorator

* addendum

* #153 registry multiple matches (#157)

* Failing unit tests and implementation stub

* Rebase and add deprecations

* Nice, indeed

* Improve interface of ids_for and one more (failing) test

* Patch some city names as they were containing more than 1 comma

* Implementation and working tests for: ids_for()

* One more test

* Refactoring

* Implemented and tested: locations_for()

* Restore string versions and add deprecations (#161)

* Add tox coverage for Python3.6

* #162 better docs (#165)

* Better README.md

* Move technical docs here from wiki

* Move contents to GitHub wiki

* Moved docs and included into setup.py as module

* Fix broken links and add usage examples for CityID Registry

* Prepare dump for 2.6.0

* not required

* we need these

* Helper for PyPi artifact submission

* Utility scripts

* #163 integration testing (#169)

* Add Python3.6

* Update

* Tell Travis-CI to use Python3.6 also and update integration dependencies versions

* Rename folder

* Broken build on Travis: reverting

* Fix unit tests that were broken with Python3.6

* Update deps but not tox

* Kidding :-S

* Fixed

* New BadGatewayError class and wired it into HTTP clients

* Improve

* Testing the code snippets in README.md

* Now API Key is passed in as an environment variable

* Use DEFAULT_API_KEY in case env variable is empty

* A couple of new tests

* Fixes #167

* Fix #168

* Added deprecations in Sphinx docs

* Update README.md

* Update to Ubuntu 16:04 and add Python3.6

* Fix for #173

* Dump version 2.6.1
@ghost
Copy link
Author

ghost commented Jan 31, 2017

Thank you thank you! Do you know how long things take to get picked up by Pip?

I just tried a forced re-install did a pip search pyowm

django-pyowm (0.1.0)  - A Django ORM interface to operate with PyOWM domain entities
pyowm (2.6.0)         - A Python wrapper around the OpenWeatherMap web API
  INSTALLED: 2.6.0 (latest)

Is this something I should just have patience with? It's night here now so I'll try again in the morning. Again, thank you!

@csparpa
Copy link
Owner

csparpa commented Jan 31, 2017

I'm just into the packaging phase... 2.6.1 will be out super soon - then would you mind testing it out?
Thanks

@ghost
Copy link
Author

ghost commented Feb 1, 2017

Hi there @csparpa - sorry, I only just saw this, thank you. I have installed and tested 2.6.1 but for your example code of

registry = owm.city_id_registry()
print(registry.ids_for('London', country='UK'))           # [ (123, 'London, UK') ]
london = registry.ids_for('London', country='UK')            # [ (123, 'London, UK') ]
print(london)
london_loc = registry.locations_for('London', country='UK')  # [ <Location obj> ]
print(london_loc)

I am getting

[]
[]
[]

@csparpa
Copy link
Owner

csparpa commented Feb 1, 2017

Ok, that is something different... as regards the current issue, it should be fixed as the files actually are where they should be - Can you confirm?

I've tested out 2.6.1 with a lookup on "Milan" and it gives me back a few results... Need to debug it better, in the meanwhile please open an ad-hoc issue for that. Thanks @lardconcepts !

@ghost
Copy link
Author

ghost commented Feb 1, 2017

Thanks @csparpa - yes, files are there, but I looked in them and I see that for the registry search, it should be GB not UK, so it is just a small documentation change.
print(registry.ids_for('London', country='GB'))
I would do a pull request, but I cannot now find where I got those examples from!

But, now I change UK to GB, it is working, thank you!

@csparpa
Copy link
Owner

csparpa commented Feb 1, 2017

Haaaaaa :) yep, the ISO-3166 name for UK is in fact GB - I always make the same mistake myself, don't worry

Thanks man!

@ghost
Copy link
Author

ghost commented Feb 1, 2017

One final thing, I can confirm that it reports towns in the UK with the same name exactly as expected, so thank you again!

[(2641594, 'Newport', 'GB'), (2641595, 'Newport', 'GB'), (2641596, 'Newport', 'GB'), (2641598, 'Newport', 'GB'), (2641599, 'Newport', 'GB')]
[(2639325, 'Ripley', 'GB'), (2639326, 'Ripley', 'GB')]
[(2648657, 'Gillingham', 'GB'), (2648658, 'Gillingham', 'GB')]

@csparpa
Copy link
Owner

csparpa commented Feb 1, 2017

Good!
I've also updated the usage examples in the doc - they are available in the "dev" branch for the moment.

Enjoy!

@ghost
Copy link
Author

ghost commented Mar 1, 2017

Thanks - I actually got caught out again, as the "live" version still shows UK and not GB.

Just lettin' you know!

@csparpa
Copy link
Owner

csparpa commented Mar 1, 2017

Man... this sounds really weird!
Are you sure?

Can you tell me the exact OS type and version and the output of the following shell commands:

pip  -V

and

pip show pyowm

please?

@ghost
Copy link
Author

ghost commented Mar 1, 2017

Sorry for the confusion! I mean the usage docs!

Master is incorrect and shows UK
https://github.com/csparpa/pyowm/blob/master/pyowm/docs/usage-examples.md

develop is correct and shows GB
https://github.com/csparpa/pyowm/blob/develop/pyowm/docs/usage-examples.md

But of course, most people will see "Master"

@csparpa
Copy link
Owner

csparpa commented Mar 1, 2017

Haa ok, you're right!
I will put the dev branch changes to the master branch

Thanks for notifying!

@csparpa
Copy link
Owner

csparpa commented Mar 1, 2017

@lardconcepts fixed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant