##// END OF EJS Templates
update %connect_info magic to cover non-default cases...
MinRK -
Show More
@@ -518,22 +518,42 b' class ZMQInteractiveShell(InteractiveShell):'
518 518 $> ipython <app> --existing
519 519
520 520 """
521
522 from IPython.core.application import BaseIPythonApplication as BaseIPApp
523
524 if BaseIPApp.initialized():
525 app = BaseIPApp.instance()
526 security_dir = app.profile_dir.security_dir
527 profile = app.profile
528 else:
529 profile = 'default'
530 security_dir = ''
531
521 532 try:
522 533 connection_file = get_connection_file()
523 534 info = get_connection_info(unpack=False)
524 535 except Exception as e:
525 536 error("Could not get connection info: %r" % e)
526 537 return
527
538
539 # add profile flag for non-default profile
540 profile_flag = "--profile %s" % profile if profile != 'default' else ""
541
542 # if it's in the security dir, truncate to basename
543 if security_dir == os.path.dirname(connection_file):
544 connection_file = os.path.basename(connection_file)
545
546
528 547 print (info + '\n')
529 548 print ("Paste the above JSON into a file, and connect with:\n"
530 549 " $> ipython <app> --existing <file>\n"
531 550 "or, if you are local, you can connect with just:\n"
532 " $> ipython <app> --existing %s\n"
551 " $> ipython <app> --existing {0} {1}\n"
533 552 "or even just:\n"
534 " $> ipython <app> --existing\n"
535 "if this is the most recent IPython session you have started."
536 % os.path.basename(connection_file)
553 " $> ipython <app> --existing {1}\n"
554 "if this is the most recent IPython session you have started.".format(
555 connection_file, profile_flag
556 )
537 557 )
538 558
539 559 def magic_qtconsole(self, arg_s):
General Comments 0
You need to be logged in to leave comments. Login now