crossbario / txaio-etcd

A Twisted client for etcd3
MIT License
14 stars 6 forks source link

csv export broken #15

Closed oberstet closed 7 years ago

oberstet commented 7 years ago

Export in JSON format works as expected, but export in csv format runs into an error:

ubuntu@ip-10-0-0-27:~$ /opt/txaioetcd/bin/etcd-export --help
usage: etcd-export [-h] [-a ADDRESS] [-k {utf8,binary}]
                   [-v {json,binary,utf8}] [-f {json,csv}] [-o OUTPUT_FILE]

Utility to dump etcd database to a file.

optional arguments:
  -h, --help            show this help message and exit
  -a ADDRESS, --address ADDRESS
                        Address(with port number) of the etcd daemon (default:
                        http://localhost:2379)
  -k {utf8,binary}, --key-type {utf8,binary}
                        The key type in the etcd database (default: utf8).
  -v {json,binary,utf8}, --value-type {json,binary,utf8}
                        The value type in the etcd database (default: json).
  -f {json,csv}, --output-format {json,csv}
                        The output format for the database dump (default:
                        json).
  -o OUTPUT_FILE, --output-file OUTPUT_FILE
                        Path for the output file. When unset, output goes to
                        stdout.
ubuntu@ip-10-0-0-27:~$ /opt/txaioetcd/bin/etcd-export -f csv
main function encountered error
Traceback (most recent call last):
  File "/opt/txaioetcd/lib/python3.5/site-packages/twisted/internet/defer.py", line 459, in callback
    self._startRunCallbacks(result)
  File "/opt/txaioetcd/lib/python3.5/site-packages/twisted/internet/defer.py", line 567, in _startRunCallbacks
    self._runCallbacks()
  File "/opt/txaioetcd/lib/python3.5/site-packages/twisted/internet/defer.py", line 653, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/opt/txaioetcd/lib/python3.5/site-packages/twisted/internet/defer.py", line 1442, in gotResult
    _inlineCallbacks(r, g, deferred)
--- <exception caught here> ---
  File "/opt/txaioetcd/lib/python3.5/site-packages/twisted/internet/defer.py", line 1386, in _inlineCallbacks
    result = g.send(result)
  File "/opt/txaioetcd/lib/python3.5/site-packages/txaioetcd/cli/exporter.py", line 92, in export_as_csv
    with open(output_path, 'w') as file:
builtins.TypeError: invalid file: None

ubuntu@ip-10-0-0-27:~$ /opt/txaioetcd/bin/etcd-export --output-format csv
main function encountered error
Traceback (most recent call last):
  File "/opt/txaioetcd/lib/python3.5/site-packages/twisted/internet/defer.py", line 459, in callback
    self._startRunCallbacks(result)
  File "/opt/txaioetcd/lib/python3.5/site-packages/twisted/internet/defer.py", line 567, in _startRunCallbacks
    self._runCallbacks()
  File "/opt/txaioetcd/lib/python3.5/site-packages/twisted/internet/defer.py", line 653, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/opt/txaioetcd/lib/python3.5/site-packages/twisted/internet/defer.py", line 1442, in gotResult
    _inlineCallbacks(r, g, deferred)
--- <exception caught here> ---
  File "/opt/txaioetcd/lib/python3.5/site-packages/twisted/internet/defer.py", line 1386, in _inlineCallbacks
    result = g.send(result)
  File "/opt/txaioetcd/lib/python3.5/site-packages/txaioetcd/cli/exporter.py", line 92, in export_as_csv
    with open(output_path, 'w') as file:
builtins.TypeError: invalid file: None
om26er commented 7 years ago

fix landed