impoved argument and exception handling in scripts/get_market_pairs.py

This commit is contained in:
hroff-1902 2019-04-11 00:15:17 +03:00
parent 93ebf163cb
commit 902ffa6853

View File

@ -1,5 +1,6 @@
import os import os
import sys import sys
import traceback
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python') sys.path.append(root + '/python')
@ -49,6 +50,11 @@ def print_supported_exchanges():
try: try:
if len(sys.argv) < 2:
dump("Usage: python " + sys.argv[0], green('id'))
print_supported_exchanges()
sys.exit(1)
id = sys.argv[1] # get exchange id from command line arguments id = sys.argv[1] # get exchange id from command line arguments
# check if the exchange is supported by ccxt # check if the exchange is supported by ccxt
@ -87,5 +93,7 @@ try:
except Exception as e: except Exception as e:
dump('[' + type(e).__name__ + ']', str(e)) dump('[' + type(e).__name__ + ']', str(e))
dump(traceback.format_exc())
dump("Usage: python " + sys.argv[0], green('id')) dump("Usage: python " + sys.argv[0], green('id'))
print_supported_exchanges() print_supported_exchanges()
sys.exit(1)