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

pgeocode.py - ValueError: too many values to unpack (expected 3) #2

Closed
michael-johnson-lucas opened this issue Sep 27, 2018 · 5 comments

Comments

@michael-johnson-lucas
Copy link

Description

At the first run, whenever trying to download a new country, you get this error.
A solution has been provided.

Pipfile

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
pgeocode = '>=0.1.0'

[dev-packages]

[requires]
python_version = "3.7"

Error

Traceback (most recent call last):
  File ".../geocode.py", line 3, in <module>
    nomi = pgeocode.Nominatim('FR')
  File ".../lib/python3.7/site-packages/pgeocode.py", line 55, in __init__
    self._data_path, self._data = self._get_data(country)
  File ".../lib/python3.7/site-packages/pgeocode.py", line 71, in _get_data
    reader, encoding, compression = get_filepath_or_buffer(url)
ValueError: too many values to unpack (expected 3)

Change

File: pgeocode.py

-            reader, encoding, compression = get_filepath_or_buffer(url)
+            reader, encoding, compression, *rest = get_filepath_or_buffer(url)
@rth
Copy link
Member

rth commented Sep 27, 2018

Thanks for the report!

Yes, there was a breaking change in pandas between versions 0.22 and 0.23 for pandas.io.common.get_filepath_or_buffer (pandas-dev/pandas#19645 (comment)).

The proposed fix is Python 3 only, something like the following should work with both 2 and 3 though,

reader, encoding, compression = get_filepath_or_buffer(url)[:3]

A pull request to fix it would be very much appreciated!

@michael-johnson-lucas
Copy link
Author

Thank you very much.

This is very helpful and I really appreciate your work. FYI your library rocks 💯

@rth
Copy link
Member

rth commented Sep 28, 2018

Thanks @michael-johnson-lucas ! Great to know that you find this library useful :)

@zaro
Copy link
Contributor

zaro commented Nov 8, 2018

Another workaround until new version is released is to fix pandas version to 0.22.0 .

@rth rth closed this as completed in #3 Nov 8, 2018
rth added a commit that referenced this issue Nov 8, 2018
Closes #2 

Makes sure we are compatible with pandas 0.23
@rth
Copy link
Member

rth commented Nov 8, 2018

Thanks for the reminder.

Compatibility with pandas 0.23 should be fixed in the 0.1.1 release, please upgrade with,

pip install --upgrade --no-deps pgeocode

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