@@ -1012,10 +1012,14 @@ def main(args=None, locals_=None, banner=None):
1012
1012
]))
1013
1013
1014
1014
if options .help_reactors :
1015
- from twisted .application import reactors
1016
- # Stolen from twisted.application.app (twistd).
1017
- for r in reactors .getReactorTypes ():
1018
- print ' %-4s\t %s' % (r .shortName , r .description )
1015
+ try :
1016
+ from twisted .application import reactors
1017
+ # Stolen from twisted.application.app (twistd).
1018
+ for r in reactors .getReactorTypes ():
1019
+ print ' %-4s\t %s' % (r .shortName , r .description )
1020
+ except ImportError :
1021
+ sys .stderr .write ('No reactors are available. Please install '
1022
+ 'twisted for reactor support.' )
1019
1023
return
1020
1024
1021
1025
palette = [
@@ -1030,7 +1034,12 @@ def main(args=None, locals_=None, banner=None):
1030
1034
options .reactor = 'select'
1031
1035
1032
1036
if options .reactor :
1033
- from twisted .application import reactors
1037
+ try :
1038
+ from twisted .application import reactors
1039
+ except ImportError :
1040
+ sys .stderr .write ('No reactors are available. Please install '
1041
+ 'twisted for reactor support.' )
1042
+ return
1034
1043
try :
1035
1044
# XXX why does this not just return the reactor it installed?
1036
1045
reactor = reactors .installReactor (options .reactor )
@@ -1053,8 +1062,14 @@ def main(args=None, locals_=None, banner=None):
1053
1062
locals_ = main_mod .__dict__
1054
1063
1055
1064
if options .plugin :
1056
- from twisted import plugin
1057
- from twisted .application import service
1065
+ try :
1066
+ from twisted import plugin
1067
+ from twisted .application import service
1068
+ except ImportError :
1069
+ sys .stderr .write ('No twisted plugins are available. Please install '
1070
+ 'twisted for twisted plugin support.' )
1071
+ return
1072
+
1058
1073
for plug in plugin .getPlugins (service .IServiceMaker ):
1059
1074
if plug .tapname == options .plugin :
1060
1075
break
0 commit comments