Changed output arg to just be as string
parent
f036b3b7ba
commit
d89b33f8cb
|
@ -1,5 +1,6 @@
|
||||||
"""Parsing arguments and starting program from command line"""
|
"""Parsing arguments and starting program from command line"""
|
||||||
|
|
||||||
|
from .common import log_message
|
||||||
from .decode import SSTVDecoder
|
from .decode import SSTVDecoder
|
||||||
from sys import exit
|
from sys import exit
|
||||||
import argparse
|
import argparse
|
||||||
|
@ -45,7 +46,7 @@ examples:
|
||||||
parser.add_argument("-d", "--decode", type=argparse.FileType('rb'),
|
parser.add_argument("-d", "--decode", type=argparse.FileType('rb'),
|
||||||
help="SSTV audio file to decode",
|
help="SSTV audio file to decode",
|
||||||
dest="audio_file")
|
dest="audio_file")
|
||||||
parser.add_argument("-o", "--output", type=argparse.FileType('wb'),
|
parser.add_argument("-o", "--output", type=str,
|
||||||
help="desination of output file",
|
help="desination of output file",
|
||||||
default="result.png",
|
default="result.png",
|
||||||
dest="output_file")
|
dest="output_file")
|
||||||
|
@ -93,13 +94,13 @@ examples:
|
||||||
img = sstv.decode()
|
img = sstv.decode()
|
||||||
try:
|
try:
|
||||||
img.save(self._output_file)
|
img.save(self._output_file)
|
||||||
except KeyError:
|
except (KeyError, ValueError):
|
||||||
|
log_message("Error saving file, saved to result.png instead",
|
||||||
|
err=True)
|
||||||
img.save("result.png")
|
img.save("result.png")
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
""" Closes any input/output files if they exist """
|
""" Closes any input/output files if they exist """
|
||||||
if self._output_file is not None and not self._output_file.closed:
|
|
||||||
self._output_file.close()
|
|
||||||
if self._audio_file is not None and not self._audio_file.closed:
|
if self._audio_file is not None and not self._audio_file.closed:
|
||||||
self._audio_file.close()
|
self._audio_file.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue