Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError when using mode that includes "t" #6

Closed
jdidion opened this issue Apr 23, 2020 · 5 comments
Closed

ValueError when using mode that includes "t" #6

jdidion opened this issue Apr 23, 2020 · 5 comments

Comments

@jdidion
Copy link

jdidion commented Apr 23, 2020

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
Copy link
Owner

rec commented Apr 23, 2020

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

Moment pls.

@rec rec closed this as completed in b406bf4 Apr 23, 2020
@rec
Copy link
Owner

rec commented Apr 23, 2020

Done!

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

@jdidion
Copy link
Author

jdidion commented Apr 23, 2020

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

@rec
Copy link
Owner

rec commented Apr 23, 2020

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
Copy link
Author

jdidion commented Apr 23, 2020

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants