##// 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 $> ipython <app> --existing
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 try:
532 try:
522 connection_file = get_connection_file()
533 connection_file = get_connection_file()
523 info = get_connection_info(unpack=False)
534 info = get_connection_info(unpack=False)
524 except Exception as e:
535 except Exception as e:
525 error("Could not get connection info: %r" % e)
536 error("Could not get connection info: %r" % e)
526 return
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 print (info + '\n')
547 print (info + '\n')
529 print ("Paste the above JSON into a file, and connect with:\n"
548 print ("Paste the above JSON into a file, and connect with:\n"
530 " $> ipython <app> --existing <file>\n"
549 " $> ipython <app> --existing <file>\n"
531 "or, if you are local, you can connect with just:\n"
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 "or even just:\n"
552 "or even just:\n"
534 " $> ipython <app> --existing\n"
553 " $> ipython <app> --existing {1}\n"
535 "if this is the most recent IPython session you have started."
554 "if this is the most recent IPython session you have started.".format(
536 % os.path.basename(connection_file)
555 connection_file, profile_flag
556 )
537 )
557 )
538
558
539 def magic_qtconsole(self, arg_s):
559 def magic_qtconsole(self, arg_s):
General Comments 0
You need to be logged in to leave comments. Login now