Commit fab9e1f6 authored by Pavel KORSHUNOV's avatar Pavel KORSHUNOV
Browse files

Fixing Issue #54

parent 1e417e83
......@@ -155,7 +155,7 @@ def command_line_parser(description=__doc__, exclude_resources_from=[]):
def _take_from_config_or_command_line(args, config, keyword, default, required=True, is_resource=True):
if getattr(args, keyword) != default:
if getattr(args, keyword) is not None and getattr(args, keyword) != default:
  • I am not sure if this is required. I know that a direct comparison between None and None should use is or is not, but comparing any None with any other object is a valid expression. Explicitly testing for None is, hence, not required.

  • Testing for None is required here because if getattr(args, keyword) is None, the setattr that follows will break, since you cannot join None objects like so ' '.join(getattr(args, keyword)).

  • So, just to clarify, if you do not test for None, it breaks when you do not provide --grid parameter, which can be None.

  • I see. However, I still don't understand, why this was not working. If the default is None and the getattr(args, keyword) is None, the test would be None != None, which resolves to False:

    $ python
    >>> None != None
    False

    As far as I know, there is only one None object, so the above should resolve to False in any case. Hence, this should have been covered by the previous test...

    I think, I might have used the wrong keyword in the test. This is an issue, which you have solved with the other commit, i.e., here: 483dfd72

  • What you say makes sense. None != None. I should have recorded the exact command line that got me this error. I cannot seem to reproduce it now. I can remove the test for None and see if I stumble upon the same problem again.

Please register or sign in to reply
if is_resource:
setattr(args, keyword, utils.load_resource(' '.join(getattr(args, keyword)), keyword, imports = args.imports, preferred_package = args.preferred_package))
......@@ -271,7 +271,7 @@ def initialize(parsers, command_line_parameters = None, skips = []):
if skips is not None and args.execute_only is not None:
for skip in skips:
if skip not in args.execute_only:
setattr("args", "skip_%s" % skip.replace("-", "_"), True)
setattr(args, "skip_%s" % skip.replace("-", "_"), True)
  • This has been fixed in !51 (merged) already. I don't know why you still have this issue. Is you local version outdated?

  • Hmm, it seems my local version was outdated a little indeed. Sorry about that.

Please register or sign in to reply
if args.parallel is not None:
args.grid = bob.bio.base.grid.Grid("local", number_of_parallel_processes = args.parallel)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment