Show More
@@ -364,15 +364,19 b' class Client(HasTraits):' | |||||
364 | if self._cd is not None: |
|
364 | if self._cd is not None: | |
365 | if url_or_file is None: |
|
365 | if url_or_file is None: | |
366 | url_or_file = pjoin(self._cd.security_dir, 'ipcontroller-client.json') |
|
366 | url_or_file = pjoin(self._cd.security_dir, 'ipcontroller-client.json') | |
367 | assert url_or_file is not None, "I can't find enough information to connect to a hub!"\ |
|
367 | if url_or_file is None: | |
368 | " Please specify at least one of url_or_file or profile." |
|
368 | raise ValueError( | |
|
369 | "I can't find enough information to connect to a hub!" | |||
|
370 | " Please specify at least one of url_or_file or profile." | |||
|
371 | ) | |||
369 |
|
372 | |||
370 | if not util.is_url(url_or_file): |
|
373 | if not util.is_url(url_or_file): | |
371 | # it's not a url, try for a file |
|
374 | # it's not a url, try for a file | |
372 | if not os.path.exists(url_or_file): |
|
375 | if not os.path.exists(url_or_file): | |
373 | if self._cd: |
|
376 | if self._cd: | |
374 | url_or_file = os.path.join(self._cd.security_dir, url_or_file) |
|
377 | url_or_file = os.path.join(self._cd.security_dir, url_or_file) | |
375 | assert os.path.exists(url_or_file), "Not a valid connection file or url: %r"%url_or_file |
|
378 | if not os.path.exists(url_or_file): | |
|
379 | raise IOError("Connection file not found: %r" % url_or_file) | |||
376 | with open(url_or_file) as f: |
|
380 | with open(url_or_file) as f: | |
377 | cfg = json.loads(f.read()) |
|
381 | cfg = json.loads(f.read()) | |
378 | else: |
|
382 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now