AttributeError: '_io.BufferedReader' object has no attribute 'temp'
See original GitHub issueHello,
I try to use LocalFileSystem
with Transaction context manager and I get the following error:
AttributeError: '_io.BufferedReader' object has no attribute 'temp'
An example:
from fsspec.implementations.local import LocalFileSystem
def main():
fs = LocalFileSystem()
with fs.transaction:
with fs.open('test.txt', 'w') as fp:
fp.write('hello')
with fs.open('test.txt', 'r') as fp:
s = fp.read()
print(s)
if __name__ == '__main__':
main()
An exception:
Traceback (most recent call last):
File "scratches\scratch_94.py", line 18, in <module>
main()
File "scratches\scratch_94.py", line 14, in main
print(s)
File "lib\site-packages\fsspec\transaction.py", line 24, in __exit__
self.complete(commit=exc_type is None)
File "lib\site-packages\fsspec\transaction.py", line 37, in complete
f.commit()
File "lib\site-packages\fsspec\implementations\local.py", line 246, in commit
os.replace(self.temp, self.path)
File "lib\site-packages\fsspec\implementations\local.py", line 261, in __getattr__
return getattr(self.f, item)
AttributeError: '_io.BufferedReader' object has no attribute 'temp'
If I only use write operations within transaction context it works but read operation leads to the exception.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
AttributeError: '_io.BufferedReader' object has no attribute 'strip'
You are using str methods on an open file object. You can read the file as a list of lines by simply calling...
Read more >'_io.BufferedReader' object has no attribute 'length ... - GitHub
Hi! I retrained two models myself (one for text detection, another one for text recognition). I'm trying to use the load_pretrained_params ...
Read more >Fix '_io.BufferedReader' object has no attribute 'next'
An error occurred while retrieving approval data for this merge request. Fix '_io.BufferedReader' object has no attribute 'next'.
Read more >Reading from Text Files - Springer Link
AttributeError : '_io.BufferedReader' object has no attribute 'encoding'. 1. Opening a file in binary mode is simple but subtle. The only difference from....
Read more >'_io.BufferedReader' object has no...” : Bugs : Duplicity
AttributeError : '_io.BufferedReader' object has no attribute 'uc_name'. Bug #1852876 reported by Michael Terry on 2019-11-16.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m opening a PR with your changes shortly
Aha! That’s it… Thank you for the clarification! I hadn’t payed attention to the location of the read context manager.