public
Created

Standalone IPython notebook crashes on EDP's Canopy

  • Download Gist
gistfile1.pytb
Python traceback
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579
***************************************************************************
IPython post-mortem report
{'commit_hash': '177894e',
'commit_source': 'installation',
'default_encoding': 'UTF-8',
'ipython_path': '/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython',
'ipython_version': '0.13.1',
'os_name': 'posix',
'platform': 'Linux-2.6.37.6-24-desktop-x86_64-with-SuSE-11.4-x86_64',
'sys_executable': '/home/xuserx/.Canopy/EPDenvironment/bin/python',
'sys_platform': 'linux2',
'sys_version': '2.7.3 | 64-bit | (default, Aug 8 2013, 05:43:23) \n[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)]'}
***************************************************************************
***************************************************************************
Crash traceback:
---------------------------------------------------------------------------
gaierror Python 2.7.3: /home/xuserx/.Canopy/EPDenvironment/bin/python
Mon Oct 7 21:32:20 2013
A problem occured executing Python code. Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.
/home/xuserx/.Canopy/EPDenvironment/bin/ipython in <module>()
1 #!/home/xuserx/.Canopy/EPDenvironment/bin/python
2 # This script was created by egginst when installing:
3 #
4 # ipython-0.13.1-2.egg
5 #
6 if __name__ == '__main__':
7 import sys
8 from IPython.frontend.terminal.ipapp import launch_new_instance
9
---> 10 sys.exit(launch_new_instance())
global sys.exit = <built-in function exit>
global launch_new_instance = <function launch_new_instance at 0xf85410>
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.pyc in launch_new_instance()
386 if ipython_dir is None:
387 ipython_dir = get_ipython_dir()
388 profile_dir = os.path.join(ipython_dir, 'profile_default')
389 cl = PyFileConfigLoader(default_config_file_name, profile_dir)
390 try:
391 config = cl.load_config()
392 except ConfigFileNotFound:
393 # no config found
394 config = Config()
395 return config
396
397
398 def launch_new_instance():
399 """Create and run a full blown IPython instance"""
400 app = TerminalIPythonApp.instance()
--> 401 app.initialize()
app.initialize = <bound method TerminalIPythonApp.initialize of <IPython.frontend.terminal.ipapp.TerminalIPythonApp object at 0x6d0250>>
402 app.start()
403
404
405 if __name__ == '__main__':
406 launch_new_instance()
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.pyc in initialize(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, argv=None)
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/config/application.pyc in catch_config_error(method=<function initialize>, app=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, *args=(None,), **kwargs={})
69
70 #-----------------------------------------------------------------------------
71 # Application class
72 #-----------------------------------------------------------------------------
73
74 @decorator
75 def catch_config_error(method, app, *args, **kwargs):
76 """Method decorator for catching invalid config (Trait/ArgumentErrors) during init.
77
78 On a TraitError (generally caused by bad config), this will print the trait's
79 message, and exit the app.
80
81 For use on init methods, to prevent invoking excepthook on invalid input.
82 """
83 try:
---> 84 return method(app, *args, **kwargs)
method = <function initialize at 0xf85140>
app = <IPython.frontend.terminal.ipapp.TerminalIPythonApp object at 0x6d0250>
args = (None,)
kwargs = {}
85 except (TraitError, ArgumentError) as e:
86 app.print_description()
87 app.print_help()
88 app.print_examples()
89 app.log.fatal("Bad config encountered during initialization:")
90 app.log.fatal(str(e))
91 app.log.debug("Config at the time: %s", app.config)
92 app.exit(1)
93
94
95 class ApplicationError(Exception):
96 pass
97
98
99 class Application(SingletonConfigurable):
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.pyc in initialize(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, argv=None)
298 " Use `--pylab` instead, or `--pylab=foo` to specify a backend.")
299 sub = '--pylab'
300 if len(argv) > idx+1:
301 # check for gui arg, as in '-pylab qt'
302 gui = argv[idx+1]
303 if gui in ('wx', 'qt', 'qt4', 'gtk', 'auto'):
304 sub = '--pylab='+gui
305 argv.pop(idx+1)
306 argv[idx] = sub
307
308 return super(TerminalIPythonApp, self).parse_command_line(argv)
309
310 @catch_config_error
311 def initialize(self, argv=None):
312 """Do actions after construct, but before starting the app."""
--> 313 super(TerminalIPythonApp, self).initialize(argv)
global super = undefined
global TerminalIPythonApp = <class 'IPython.frontend.terminal.ipapp.TerminalIPythonApp'>
self.initialize = <bound method TerminalIPythonApp.initialize of <IPython.frontend.terminal.ipapp.TerminalIPythonApp object at 0x6d0250>>
argv = None
314 if self.subapp is not None:
315 # don't bother initializing further, starting subapp
316 return
317 if not self.ignore_old_config:
318 check_for_old_config(self.ipython_dir)
319 # print self.extra_args
320 if self.extra_args and not self.something_to_run:
321 self.file_to_run = self.extra_args[0]
322 self.init_path()
323 # create the shell
324 self.init_shell()
325 # and draw the banner
326 self.init_banner()
327 # Now a variety of things that happen after the banner is printed.
328 self.init_gui_pylab()
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/core/application.pyc in initialize(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, argv=None)
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/config/application.pyc in catch_config_error(method=<function initialize>, app=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, *args=(None,), **kwargs={})
69
70 #-----------------------------------------------------------------------------
71 # Application class
72 #-----------------------------------------------------------------------------
73
74 @decorator
75 def catch_config_error(method, app, *args, **kwargs):
76 """Method decorator for catching invalid config (Trait/ArgumentErrors) during init.
77
78 On a TraitError (generally caused by bad config), this will print the trait's
79 message, and exit the app.
80
81 For use on init methods, to prevent invoking excepthook on invalid input.
82 """
83 try:
---> 84 return method(app, *args, **kwargs)
method = <function initialize at 0xb501b8>
app = <IPython.frontend.terminal.ipapp.TerminalIPythonApp object at 0x6d0250>
args = (None,)
kwargs = {}
85 except (TraitError, ArgumentError) as e:
86 app.print_description()
87 app.print_help()
88 app.print_examples()
89 app.log.fatal("Bad config encountered during initialization:")
90 app.log.fatal(str(e))
91 app.log.debug("Config at the time: %s", app.config)
92 app.exit(1)
93
94
95 class ApplicationError(Exception):
96 pass
97
98
99 class Application(SingletonConfigurable):
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/core/application.pyc in initialize(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, argv=None)
310 )
311
312
313 def stage_default_config_file(self):
314 """auto generate default config file, and stage it into the profile."""
315 s = self.generate_config_file()
316 fname = os.path.join(self.profile_dir.location, self.config_file_name)
317 if self.overwrite or not os.path.exists(fname):
318 self.log.warn("Generating default config file: %r"%(fname))
319 with open(fname, 'w') as f:
320 f.write(s)
321
322 @catch_config_error
323 def initialize(self, argv=None):
324 # don't hook up crash handler before parsing command-line
--> 325 self.parse_command_line(argv)
self.parse_command_line = <bound method TerminalIPythonApp.parse_command_line of <IPython.frontend.terminal.ipapp.TerminalIPythonApp object at 0x6d0250>>
argv = None
326 self.init_crash_handler()
327 if self.subapp is not None:
328 # stop here if subapp is taking over
329 return
330 cl_config = self.config
331 self.init_profile_dir()
332 self.init_config_files()
333 self.load_config_file()
334 # enforce cl-opts override configfile opts:
335 self.update_config(cl_config)
336
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/frontend/terminal/ipapp.pyc in parse_command_line(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, argv=['notebook'])
293 # deprecated `-pylab` given,
294 # warn and transform into current syntax
295 argv = argv[:] # copy, don't clobber
296 idx = argv.index('-pylab')
297 warn.warn("`-pylab` flag has been deprecated.\n"
298 " Use `--pylab` instead, or `--pylab=foo` to specify a backend.")
299 sub = '--pylab'
300 if len(argv) > idx+1:
301 # check for gui arg, as in '-pylab qt'
302 gui = argv[idx+1]
303 if gui in ('wx', 'qt', 'qt4', 'gtk', 'auto'):
304 sub = '--pylab='+gui
305 argv.pop(idx+1)
306 argv[idx] = sub
307
--> 308 return super(TerminalIPythonApp, self).parse_command_line(argv)
global super = undefined
global TerminalIPythonApp = <class 'IPython.frontend.terminal.ipapp.TerminalIPythonApp'>
self.parse_command_line = <bound method TerminalIPythonApp.parse_command_line of <IPython.frontend.terminal.ipapp.TerminalIPythonApp object at 0x6d0250>>
argv = ['notebook']
309
310 @catch_config_error
311 def initialize(self, argv=None):
312 """Do actions after construct, but before starting the app."""
313 super(TerminalIPythonApp, self).initialize(argv)
314 if self.subapp is not None:
315 # don't bother initializing further, starting subapp
316 return
317 if not self.ignore_old_config:
318 check_for_old_config(self.ipython_dir)
319 # print self.extra_args
320 if self.extra_args and not self.something_to_run:
321 self.file_to_run = self.extra_args[0]
322 self.init_path()
323 # create the shell
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/config/application.pyc in parse_command_line(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, argv=['notebook'])
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/config/application.pyc in catch_config_error(method=<function parse_command_line>, app=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, *args=(['notebook'],), **kwargs={})
69
70 #-----------------------------------------------------------------------------
71 # Application class
72 #-----------------------------------------------------------------------------
73
74 @decorator
75 def catch_config_error(method, app, *args, **kwargs):
76 """Method decorator for catching invalid config (Trait/ArgumentErrors) during init.
77
78 On a TraitError (generally caused by bad config), this will print the trait's
79 message, and exit the app.
80
81 For use on init methods, to prevent invoking excepthook on invalid input.
82 """
83 try:
---> 84 return method(app, *args, **kwargs)
method = <function parse_command_line at 0xa07758>
app = <IPython.frontend.terminal.ipapp.TerminalIPythonApp object at 0x6d0250>
args = (['notebook'],)
kwargs = {}
85 except (TraitError, ArgumentError) as e:
86 app.print_description()
87 app.print_help()
88 app.print_examples()
89 app.log.fatal("Bad config encountered during initialization:")
90 app.log.fatal(str(e))
91 app.log.debug("Config at the time: %s", app.config)
92 app.exit(1)
93
94
95 class ApplicationError(Exception):
96 pass
97
98
99 class Application(SingletonConfigurable):
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/config/application.pyc in parse_command_line(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, argv=['notebook'])
405
406 @catch_config_error
407 def parse_command_line(self, argv=None):
408 """Parse the command line arguments."""
409 argv = sys.argv[1:] if argv is None else argv
410
411 if argv and argv[0] == 'help':
412 # turn `ipython help notebook` into `ipython notebook -h`
413 argv = argv[1:] + ['-h']
414
415 if self.subcommands and len(argv) > 0:
416 # we have subcommands, and one may have been specified
417 subc, subargv = argv[0], argv[1:]
418 if re.match(r'^\w(\-?\w)*$', subc) and subc in self.subcommands:
419 # it's a subcommand, and *not* a flag or class parameter
--> 420 return self.initialize_subcommand(subc, subargv)
self.initialize_subcommand = <bound method TerminalIPythonApp.initialize_subcommand of <IPython.frontend.terminal.ipapp.TerminalIPythonApp object at 0x6d0250>>
subc = 'notebook'
subargv = []
421
422 if '-h' in argv or '--help' in argv or '--help-all' in argv:
423 self.print_description()
424 self.print_help('--help-all' in argv)
425 self.print_examples()
426 self.exit(0)
427
428 if '--version' in argv or '-V' in argv:
429 self.print_version()
430 self.exit(0)
431
432 # flatten flags&aliases, so cl-args get appropriate priority:
433 flags,aliases = self.flatten_flags()
434
435 loader = KVArgParseConfigLoader(argv=argv, aliases=aliases,
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/config/application.pyc in initialize_subcommand(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, subc='notebook', argv=[])
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/config/application.pyc in catch_config_error(method=<function initialize_subcommand>, app=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, *args=('notebook', []), **kwargs={})
69
70 #-----------------------------------------------------------------------------
71 # Application class
72 #-----------------------------------------------------------------------------
73
74 @decorator
75 def catch_config_error(method, app, *args, **kwargs):
76 """Method decorator for catching invalid config (Trait/ArgumentErrors) during init.
77
78 On a TraitError (generally caused by bad config), this will print the trait's
79 message, and exit the app.
80
81 For use on init methods, to prevent invoking excepthook on invalid input.
82 """
83 try:
---> 84 return method(app, *args, **kwargs)
method = <function initialize_subcommand at 0xa075f0>
app = <IPython.frontend.terminal.ipapp.TerminalIPythonApp object at 0x6d0250>
args = ('notebook', [])
kwargs = {}
85 except (TraitError, ArgumentError) as e:
86 app.print_description()
87 app.print_help()
88 app.print_examples()
89 app.log.fatal("Bad config encountered during initialization:")
90 app.log.fatal(str(e))
91 app.log.debug("Config at the time: %s", app.config)
92 app.exit(1)
93
94
95 class ApplicationError(Exception):
96 pass
97
98
99 class Application(SingletonConfigurable):
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/config/application.pyc in initialize_subcommand(self=<IPython.frontend.terminal.ipapp.TerminalIPythonApp object>, subc='notebook', argv=[])
344 self.config = newconfig
345
346 @catch_config_error
347 def initialize_subcommand(self, subc, argv=None):
348 """Initialize a subcommand with argv."""
349 subapp,help = self.subcommands.get(subc)
350
351 if isinstance(subapp, basestring):
352 subapp = import_item(subapp)
353
354 # clear existing instances
355 self.__class__.clear_instance()
356 # instantiate
357 self.subapp = subapp.instance()
358 # and initialize subapp
--> 359 self.subapp.initialize(argv)
self.subapp.initialize = <bound method NotebookApp.initialize of <IPython.frontend.html.notebook.notebookapp.NotebookApp object at 0x1099bd0>>
argv = []
360
361 def flatten_flags(self):
362 """flatten flags and aliases, so cl-args override as expected.
363
364 This prevents issues such as an alias pointing to InteractiveShell,
365 but a config file setting the same trait in TerminalInteraciveShell
366 getting inappropriate priority over the command-line arg.
367
368 Only aliases with exactly one descendent in the class list
369 will be promoted.
370
371 """
372 # build a tree of classes in our list that inherit from a particular
373 # it will be a dict by parent classname of classes in our list
374 # that are descendents
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.pyc in initialize(self=<IPython.frontend.html.notebook.notebookapp.NotebookApp object>, argv=[])
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/config/application.pyc in catch_config_error(method=<function initialize>, app=<IPython.frontend.html.notebook.notebookapp.NotebookApp object>, *args=([],), **kwargs={})
69
70 #-----------------------------------------------------------------------------
71 # Application class
72 #-----------------------------------------------------------------------------
73
74 @decorator
75 def catch_config_error(method, app, *args, **kwargs):
76 """Method decorator for catching invalid config (Trait/ArgumentErrors) during init.
77
78 On a TraitError (generally caused by bad config), this will print the trait's
79 message, and exit the app.
80
81 For use on init methods, to prevent invoking excepthook on invalid input.
82 """
83 try:
---> 84 return method(app, *args, **kwargs)
method = <function initialize at 0x2689aa0>
app = <IPython.frontend.html.notebook.notebookapp.NotebookApp object at 0x1099bd0>
args = ([],)
kwargs = {}
85 except (TraitError, ArgumentError) as e:
86 app.print_description()
87 app.print_help()
88 app.print_examples()
89 app.log.fatal("Bad config encountered during initialization:")
90 app.log.fatal(str(e))
91 app.log.debug("Config at the time: %s", app.config)
92 app.exit(1)
93
94
95 class ApplicationError(Exception):
96 pass
97
98
99 class Application(SingletonConfigurable):
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.pyc in initialize(self=<IPython.frontend.html.notebook.notebookapp.NotebookApp object>, argv=[])
517 # no answer, or answer is no:
518 # set it back to original SIGINT handler
519 # use IOLoop.add_callback because signal.signal must be called
520 # from main thread
521 ioloop.IOLoop.instance().add_callback(self._restore_sigint_handler)
522
523 def _signal_stop(self, sig, frame):
524 self.log.critical("received signal %s, stopping", sig)
525 ioloop.IOLoop.instance().stop()
526
527 @catch_config_error
528 def initialize(self, argv=None):
529 self.init_logging()
530 super(NotebookApp, self).initialize(argv)
531 self.init_configurables()
--> 532 self.init_webapp()
self.init_webapp = <bound method NotebookApp.init_webapp of <IPython.frontend.html.notebook.notebookapp.NotebookApp object at 0x1099bd0>>
533 self.init_signal()
534
535 def cleanup_kernels(self):
536 """shutdown all kernels
537
538 The kernels will shutdown themselves when this process no longer exists,
539 but explicit shutdown allows the KernelManagers to cleanup the connection files.
540 """
541 self.log.info('Shutting down kernels')
542 km = self.kernel_manager
543 # copy list, since shutdown_kernel deletes keys
544 for kid in list(km.kernel_ids):
545 km.shutdown_kernel(kid)
546
547 def start(self):
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/IPython/frontend/html/notebook/notebookapp.pyc in init_webapp(self=<IPython.frontend.html.notebook.notebookapp.NotebookApp object>)
435 ssl_options = dict(certfile=self.certfile)
436 if self.keyfile:
437 ssl_options['keyfile'] = self.keyfile
438 else:
439 ssl_options = None
440 self.web_app.password = self.password
441 self.http_server = httpserver.HTTPServer(self.web_app, ssl_options=ssl_options)
442 if ssl_options is None and not self.ip and not (self.read_only and not self.password):
443 self.log.critical('WARNING: the notebook server is listening on all IP addresses '
444 'but not using any encryption or authentication. This is highly '
445 'insecure and not recommended.')
446
447 success = None
448 for port in random_ports(self.port, self.port_retries+1):
449 try:
--> 450 self.http_server.listen(port, self.ip)
self.http_server.listen = <bound method HTTPServer.listen of <tornado.httpserver.HTTPServer object at 0x268a850>>
port = 8888
self.ip = u'127.0.0.1'
451 except socket.error, e:
452 if e.errno != errno.EADDRINUSE:
453 raise
454 self.log.info('The port %i is already in use, trying another random port.' % port)
455 else:
456 self.port = port
457 success = True
458 break
459 if not success:
460 self.log.critical('ERROR: the notebook server could not be started because '
461 'no available port could be found.')
462 self.exit(1)
463
464 def init_signal(self):
465 # FIXME: remove this check when pyzmq dependency is >= 2.1.11
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/tornado/netutil.pyc in listen(self=<tornado.httpserver.HTTPServer object>, port=8888, address=u'127.0.0.1')
85 def __init__(self, io_loop=None, ssl_options=None):
86 self.io_loop = io_loop
87 self.ssl_options = ssl_options
88 self._sockets = {} # fd -> socket object
89 self._pending_sockets = []
90 self._started = False
91
92 def listen(self, port, address=""):
93 """Starts accepting connections on the given port.
94
95 This method may be called more than once to listen on multiple ports.
96 `listen` takes effect immediately; it is not necessary to call
97 `TCPServer.start` afterwards. It is, however, necessary to start
98 the `IOLoop`.
99 """
--> 100 sockets = bind_sockets(port, address=address)
sockets = undefined
global bind_sockets = <function bind_sockets at 0x11212a8>
port = 8888
address = u'127.0.0.1'
101 self.add_sockets(sockets)
102
103 def add_sockets(self, sockets):
104 """Makes this server start accepting connections on the given sockets.
105
106 The ``sockets`` parameter is a list of socket objects such as
107 those returned by `bind_sockets`.
108 `add_sockets` is typically used in combination with that
109 method and `tornado.process.fork_processes` to provide greater
110 control over the initialization of a multi-process server.
111 """
112 if self.io_loop is None:
113 self.io_loop = IOLoop.instance()
114
115 for sock in sockets:
/home/xuserx/.Canopy/EPDenvironment/lib/python2.7/site-packages/tornado/netutil.pyc in bind_sockets(port=8888, address=u'127.0.0.1', family=0, backlog=128)
233
234 The ``backlog`` argument has the same meaning as for
235 ``socket.listen()``.
236 """
237 sockets = []
238 if address == "":
239 address = None
240 flags = socket.AI_PASSIVE
241 if hasattr(socket, "AI_ADDRCONFIG"):
242 # AI_ADDRCONFIG ensures that we only try to bind on ipv6
243 # if the system is configured for it, but the flag doesn't
244 # exist on some platforms (specifically WinXP, although
245 # newer versions of windows have it)
246 flags |= socket.AI_ADDRCONFIG
247 for res in set(socket.getaddrinfo(address, port, family, socket.SOCK_STREAM,
--> 248 0, flags)):
flags = 33
249 af, socktype, proto, canonname, sockaddr = res
250 sock = socket.socket(af, socktype, proto)
251 set_close_exec(sock.fileno())
252 sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
253 if af == socket.AF_INET6:
254 # On linux, ipv6 sockets accept ipv4 too by default,
255 # but this makes it impossible to bind to both
256 # 0.0.0.0 in ipv4 and :: in ipv6. On other systems,
257 # separate sockets *must* be used to listen for both ipv4
258 # and ipv6. For consistency, always disable ipv4 on our
259 # ipv6 sockets and use a separate ipv4 socket when needed.
260 #
261 # Python 2.x on windows doesn't have IPPROTO_IPV6.
262 if hasattr(socket, "IPPROTO_IPV6"):
263 sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 1)
gaierror: [Errno -9] Address family for hostname not supported

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.