-
-
Notifications
You must be signed in to change notification settings - Fork 312
Open
Labels
Description
Trying to open a URL with open_bytes() fails with "AttributeError: RepeatFile does not have readable"
This does not seem to happen on open_text().
Steps to reproduce
- Custom loader code that calls open_bytes() on a URI source.
Expected result
- Gives me a file handle in binary mode.
Actual result with screenshot

Configuration
- Does this issue reproduce without any plugins or configuration (using the
-N
CLI flag)?
N/A
- Does this issue reproduce with either the latest release, or with the develop branch?
Yes, happens on 3.2 and top of tree.
Additional context
- What platform and version are you using (Linux, MacOS, Windows)?
MacOS.
- Which version of Python?
3.10.16
- Which terminal are you using (for display and input issues)?
iterm2
Code of offending loader, condensed to minimal test case:
from visidata import (
TableSheet,
VisiData,
)
@VisiData.api
def open_nwsyncmanifest(_vd, p):
return NWSyncManifestSheet(p.name, source=p)
@VisiData.api
def guess_nwsyncmanifest(_vd, p):
if p.open_bytes().read(8).startswith(b"NSYM\x03\x00\x00\x00"):
return {"filetype": "nwsyncmanifest"}
return None
@VisiData.api
def guessurl_nwsyncmanifest(_vd, _p, response):
if response.read(8).startswith(b"NSYM\x03\x00\x00\x00"):
return {"filetype": "nwsyncmanifest"}
return None
class NWSyncManifestSheet(TableSheet):
def iterload(self):
with self.source.open_bytes() as f: # !BANG!
pass
To repro: visidata http://anphillia.pw/nwsync/manifests/b6efd63f3429def9246543ca772581f5555aa721