Closed lucasfcnunes closed 3 years ago
maybe adding a "mode=" parameter in .write would be better... idk
Thanks for the PR. I appreciate you taking the time to look at this issue. Would you be able separate this into two PRs (one for the file write issue, and the second for comments)? It just keeps it cleaner being able to comment and work on.
I've had a look at the write issue and the +r generates a write exception on Linux, and MacOS. I also tried on Windows 10 (64-bit) and use of +r also results in an error. I suspect the issue relates to this SO post and is related to 32-bit Windows only. Please could you confirm the OS (inc. architecture) and version of python you are testing this on?
*r+ opens for reading and writing (can't truncate the file)
I'm currently using this project in Linux Ubuntu (20.04, cpython 3.8) and a Alpine Docker (python:3-alpine, cpython 3.9) container as root. it was throwing the unable to write exception and this fixed for my use case.
probably the safe route is to create a new parameter "mode" in .write... i'll do that!
about the inline comments PR, i thought i hadn't pulled that: it was a mistake, sorry :(
Merging #35 (40b4332) into devel (f9210dd) will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## devel #35 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 4
Lines 321 321
=========================================
Hits 321 321
Impacted Files | Coverage Δ | |
---|---|---|
python_hosts/hosts.py | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update f9210dd...40b4332. Read the comment docs.
even when sudo/root editing (file = 644) it was raising this exception. simple change in edit mode w -> r+ can solve this for privileged users.
Fixes #21