Fix string instead of bytes-like object error. #67
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Running x12norm with python3 I received the following error:
Traceback (most recent call last):
File "/usr/local/bin/x12norm", line 11, in
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/pyx12/scripts/x12norm.py", line 71, in main
fd_out.write(seg_data.format() + eol)
TypeError: a bytes-like object is required, not 'str'
fd_out is a "tempfile.TemporaryFile()".
The tempfile docs state:
The mode parameter defaults to 'w+b' so that the file created can be read and
written without being closed. Binary mode is used so that it behaves
consistently on all platforms without regard for the data that is stored.
In other parts of the x12norm code mode 'w' is set explicitly so I think
it is okay to do so for the tempfile as well. This commit does that.