Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
env: do not use the builtin FileType factory for -r (#77)
When using the -r (record) parameter to semonitor we currently get a nice traceback: Traceback (most recent call last): File "./semonitor.py", line 227, in <module> recFile = se.files.openOutFile(args.record, "a" if args.append else "w") File "/home/oliver/solaredge/se/files.py", line 72, in openOutFile return open(fileName, writeMode) TypeError: coercing to Unicode: need string or buffer, file found This is caused by the fact that we now use the builtin factory FileType of argparse which now passes a file descriptor rather then the previous string to openOutFile. Since we want to either append or write the output/record files and since we cannot change the file mode once it has been opened, we thus cannot use the built in factory anymore and revert to the old behavior of manually calling 'open' to open an output file. Fixes #76 Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
- Loading branch information