question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New version of click (8.x.x) may have been causing an issue with cog_translate

See original GitHub issue

To re-create, run test:

$ pytest -k test_cog_translate_valid
rio_cogeo/cogeo.py:289: in cog_translate
    with click.progressbar(wind, file=fout, show_percent=True) as windows:  # type: ignore
.direnv/python-3.7.3/lib/python3.7/site-packages/click/_termui_impl.py:98: in __enter__
    self.render_progress()
.direnv/python-3.7.3/lib/python3.7/site-packages/click/_termui_impl.py:220: in render_progress
    echo(self.label, file=self.file, color=self.color)
.
.
.
>       file.write(out)  # type: ignore
E       AttributeError: 'str' object has no attribute 'write'

.direnv/python-3.7.3/lib/python3.7/site-packages/click/utils.py:298: AttributeError

Locking down to click==7.1.2 seems to work around the issue:

$ pip install click==7.1.2
$ pytest -k test_cog_translate_valid
=============================================================================== test session starts ===============================================================================
platform darwin -- Python 3.7.3, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /Users/gcihj/Projects/_tools/rio-cogeo
plugins: cov-2.12.1
collected 74 items / 67 deselected / 7 selected

tests/test_cogeo.py .......                                                                                                                                                 [100%]

================================================================================ warnings summary =================================================================================
../../../.pyenv/versions/3.7.3/lib/python3.7/importlib/_bootstrap.py:219
  /Users/gcihj/.pyenv/versions/3.7.3/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject
    return f(*args, **kwds)

rio_cogeo/profiles.py:184
  /Users/gcihj/Projects/_tools/rio-cogeo/rio_cogeo/profiles.py:184: UserWarning: Non-standard compression schema: webp. The output COG might not be fully supported by software not build against latest libtiff.
    " supported by software not build against latest libtiff.".format(key)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
================================================================== 7 passed, 67 deselected, 2 warnings in 1.66s =====

Maybe a simple fix for now is to modify requirements.txt: https://github.com/cogeotiff/rio-cogeo/blob/b1c3692b5adaa456dbc565860e9fa26453c5ad10/requirements.txt#L1-L5

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ghelobytescommented, Jun 17, 2021

@vincentsarago

>>> import rio_cogeo, click, rasterio
>>> print(rio_cogeo.__version__)
2.2.2
>>> print(click.__version__)
8.0.1
>>> print(rasterio.__version__)
1.2.4
>>>
0reactions
vincentsaragocommented, Jun 17, 2021

yep, I was going to push this fix! I’ll cc you in the PR and wait for your 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changes — Click Documentation (8.1.x)
Version 2.6¶. Released 2014-08-11. Fixed an issue where the wrapped streams on Python 3 would be reporting incorrect values for seekable.
Read more >
DTrack2 User Manual V2.12.0 ART DTrack 2.12
are ok). ... no one can stumble over the cords, ... the cords cannot be damaged, ... the cords cannot damage the cameras...
Read more >
2020年02月29日到期删除的国际域名
... account-information-update.org account-information.net ... bdzuv.com be-brave.tv be-connect-jp.com be-inapp.com be-supportive.com ...
Read more >
Dropped 02-29-2020-COM - Domain Data - NameDog
... 8-5-6.com 8-bitsoft.com 8-four.com 8-landing-page-templates.com ... ay-hm-be.com ayahuasca-trip.com ayaladesigns.com ayaplumbing.com ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found