Repository: freqtrade/freqtrade

Issue:
scripts broken?
I assume, this is after #1961 merged, hopefully not in the master branch...

```
(.env) $ git fetch upstream 
(.env) $ git merge upstream/develop 
Already up to date.
(.env) $ git status
On branch develop
Your branch is up to date with 'origin/develop'.

Untracked files:
...

(.env) $ ./scripts/plot_dataframe.py 
2019-06-27 23:34:17,956 - freqtrade.configuration - INFO - Verbosity set to 0
Traceback (most recent call last):
  File "./scripts/plot_dataframe.py", line 150, in <module>
    main(sys.argv[1:])
  File "./scripts/plot_dataframe.py", line 144, in main
    plot_parse_args(sysargv)
  File "./scripts/plot_dataframe.py", line 133, in plot_parse_args
    config = setup_configuration(parsed_args, RunMode.BACKTEST)
  File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/optimize/__init__.py", line 21, in setup_configuration
    config = setup_utils_configuration(args, method)
  File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/utils.py", line 20, in setup_utils_configuration
    config = configuration.load_config()
  File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/configuration.py", line 101, in load_config
    config = self._load_common_config(config)
  File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/configuration.py", line 173, in _load_common_config
    if self.args.sd_notify:
AttributeError: 'Namespace' object has no attribute 'sd_notify'

(.env) $ ./scripts/plot_profit.py 
2019-06-27 23:34:26,389 - freqtrade.configuration - INFO - Verbosity set to 0
Traceback (most recent call last):
  File "./scripts/plot_profit.py", line 226, in <module>
    main(sys.argv[1:])
  File "./scripts/plot_profit.py", line 221, in main
    plot_parse_args(sysargv)
  File "./scripts/plot_profit.py", line 86, in plot_profit
    config = Configuration(args, RunMode.OTHER).get_config()
  File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/configuration.py", line 418, in get_config
    self.config = self.load_config()
  File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/configuration.py", line 101, in load_config
    config = self._load_common_config(config)
  File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/configuration.py", line 173, in _load_common_config
    if self.args.sd_notify:
AttributeError: 'Namespace' object has no attribute 'sd_notify'

```

scripts broken?
I assume, this is after #1961 merged, hopefully not in the master branch...

```
(.env) $ git fetch upstream 
(.env) $ git merge upstream/develop 
Already up to date.
(.env) $ git status
On branch develop
Your branch is up to date with 'origin/develop'.

Untracked files:
...

(.env) $ ./scripts/plot_dataframe.py 
2019-06-27 23:34:17,956 - freqtrade.configuration - INFO - Verbosity set to 0
Traceback (most recent call last):
  File "./scripts/plot_dataframe.py", line 150, in <module>
    main(sys.argv[1:])
  File "./scripts/plot_dataframe.py", line 144, in main
    plot_parse_args(sysargv)
  File "./scripts/plot_dataframe.py", line 133, in plot_parse_args
    config = setup_configuration(parsed_args, RunMode.BACKTEST)
  File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/optimize/__init__.py", line 21, in setup_configuration
    config = setup_utils_configuration(args, method)
  File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/utils.py", line 20, in setup_utils_configuration
    config = configuration.load_config()
  File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/configuration.py", line 101, in load_config
    config = self._load_common_config(config)
  File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/configuration.py", line 173, in _load_common_config
    if self.args.sd_notify:
AttributeError: 'Namespace' object has no attribute 'sd_notify'

(.env) $ ./scripts/plot_profit.py 
2019-06-27 23:34:26,389 - freqtrade.configuration - INFO - Verbosity set to 0
Traceback (most recent call last):
  File "./scripts/plot_profit.py", line 226, in <module>
    main(sys.argv[1:])
  File "./scripts/plot_profit.py", line 221, in main
    plot_parse_args(sysargv)
  File "./scripts/plot_profit.py", line 86, in plot_profit
    config = Configuration(args, RunMode.OTHER).get_config()
  File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/configuration.py", line 418, in get_config
    self.config = self.load_config()
  File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/configuration.py", line 101, in load_config
    config = self._load_common_config(config)
  File "/home/user/freqtrade-wrk/github-hroff-1902/freqtrade/freqtrade/configuration.py", line 173, in _load_common_config
    if self.args.sd_notify:
AttributeError: 'Namespace' object has no attribute 'sd_notify'

```



Discussion:
btw, why is RunMode.BACKTEST used for scripts/plot_dataframe.py?

btw, why is RunMode.BACKTEST used for scripts/plot_dataframe.py?


Resolving patch:
diff --git a/freqtrade/configuration.py b/freqtrade/configuration.py
--- a/freqtrade/configuration.py
+++ b/freqtrade/configuration.py
@@ -170,7 +170,7 @@ def _load_common_config(self, config: Dict[str, Any]) -> Dict[str, Any]:
         self._load_logging_config(config)
 
         # Support for sd_notify
-        if self.args.sd_notify:
+        if 'sd_notify' in self.args and self.args.sd_notify:
             config['internals'].update({'sd_notify': True})
 
         # Add dynamic_whitelist if found
@@ -186,7 +186,8 @@ def _load_common_config(self, config: Dict[str, Any]) -> Dict[str, Any]:
                 '(not applicable with Backtesting and Hyperopt)'
             )
 
-        if self.args.db_url and self.args.db_url != constants.DEFAULT_DB_PROD_URL:
+        if ('db_url' in self.args and self.args.db_url and
+                self.args.db_url != constants.DEFAULT_DB_PROD_URL):
             config.update({'db_url': self.args.db_url})
             logger.info('Parameter --db-url detected ...')
 


Test patch: