rec / safer

🧷 A safer writer 🧷
https://rec.github.io/safer/
MIT License
174 stars 10 forks source link

ValueError when using mode that includes "t" #6

Closed jdidion closed 4 years ago

jdidion commented 4 years ago

If the intention is for safer to be a drop-in replacement for the open() builtin, then it should support all the valid arguments for mode, including t (even though it's redundant).

>>> import safer
>>> safer.open("foo", "wt")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jdidion/.pyenv/versions/xphyle/lib/python3.6/site-packages/safer.py", line 128, in open
    return _open(name, mode, buffering, make_parents, delete_failures, arg)
  File "/Users/jdidion/.pyenv/versions/xphyle/lib/python3.6/site-packages/safer.py", line 207, in _open
    fp = m(temp_file, mode, opener=opener)
ValueError: invalid mode: wt
rec commented 4 years ago

Oh, I even knew about 't' and I falsely believed that this would all flow through without a test.

Moment pls.

rec commented 4 years ago

Done!

I'll release a new version in the next day or two.

jdidion commented 4 years ago

Thanks! With this fixed I should be able to use safer for file opening in https://github.com/jdidion/xphyle

rec commented 4 years ago

Well, then, I just pushed version 2.0.3 which has this change in it. You should see it on Pypi by and by.

jdidion commented 4 years ago

Awesome, thanks!