source: orange/Orange/__init__.py @ 10470:aff7d39afe18

Revision 10470:aff7d39afe18, 3.7 KB checked in by Ales Erjavec <ales.erjavec@…>, 2 years ago (diff)

Catch only ImportError, other errors should propagate.

Line 
1from __future__ import absolute_import
2
3__version__ = "2.5a4"
4
5try:
6    __ORANGE_SETUP__
7except NameError:
8    __ORANGE_SETUP__ = False
9
10
11if __ORANGE_SETUP__:
12    import sys as _sys
13    _sys.stderr.write('Running from orange source directory.\n')
14    del _sys
15else:
16    from . import orange
17
18    # Definitely ugly, but I see no other workaround.
19    # When, e.g. data.io executes "from orange import ExampleTable"
20    # orange gets imported again since it is not in sys.modules
21    # before this entire file is executed
22    import sys
23    sys.modules["orange"] = orange
24
25    import warnings
26
27    alreadyWarned = False
28    disabledMsg = "Some features will be disabled due to failing modules\n"
29    def _import(name):
30        global alreadyWarned
31        try:
32            __import__(name, globals(), locals(), [], -1)
33        except ImportError, err:
34            warnings.warn("%sImporting '%s' failed: %s" %
35                (disabledMsg if not alreadyWarned else "", name, err),
36                UserWarning, 2)
37            alreadyWarned = True
38
39    _import("misc")
40    _import("data")
41    _import("data.io")
42    _import("data.sample")
43    _import("data.outliers")
44    _import("data.utils")
45    _import("data.discretization")
46    _import("data.continuization")
47    _import("data.filter")
48    _import("data.imputation")
49
50    _import("feature")
51    _import("feature.construction")
52    _import("feature.construction.functionDecomposition")
53    _import("feature.construction.univariate")
54    _import("feature.discretization")
55    _import("feature.imputation")
56    _import("feature.scoring")
57    _import("feature.selection")
58
59    _import("network")
60
61    _import("stat")
62
63    _import("statistics")
64    _import("statistics.estimate")
65    _import("statistics.contingency")
66    _import("statistics.distribution")
67    _import("statistics.basic")
68    _import("statistics.evd")
69
70    _import("classification")
71    _import("classification.tree")
72
73    _import("classification.rules")
74
75    _import("classification.lookup")
76    _import("classification.bayes")
77    _import("classification.svm")
78    _import("classification.logreg")
79    _import("classification.knn")
80    _import("classification.majority")
81
82    _import("optimization")
83
84    _import("projection")
85    _import("projection.linear")
86    _import("projection.mds")
87    _import("projection.som")
88    _import("projection.pca")
89
90    _import("ensemble")
91    _import("ensemble.bagging")
92    _import("ensemble.boosting")
93    _import("ensemble.forest")
94
95    _import("regression")
96    _import("regression.base")
97    _import("regression.earth")
98    _import("regression.lasso")
99    _import("regression.linear")
100    _import("regression.mean")
101    _import("regression.pls")
102    _import("regression.tree")
103
104    _import("multitarget")
105    _import("multitarget.tree")
106
107    _import("multilabel")
108    _import("multilabel.multibase")
109    _import("multilabel.br")
110    _import("multilabel.lp")
111    _import("multilabel.mlknn")
112    _import("multilabel.brknn")
113    _import("multilabel.mulan")
114
115    _import("associate")
116
117    _import("preprocess")
118    _import("preprocess.scaling")
119
120    _import("distance")
121
122    _import("wrappers")
123
124    _import("featureConstruction")
125    _import("featureConstruction.univariate")
126    _import("featureConstruction.functionDecomposition")
127
128    _import("evaluation")
129    _import("evaluation.scoring")
130    _import("evaluation.testing")
131    _import("evaluation.reliability")
132
133    _import("clustering")
134    _import("clustering.kmeans")
135    _import("clustering.hierarchical")
136    _import("clustering.consensus")
137
138    _import("misc")
139    _import("misc.environ")
140    _import("misc.counters")
141    _import("misc.addons")
142    _import("misc.render")
143    _import("misc.selection")
144    _import("misc.serverfiles")
145    #_import("misc.r")
146
Note: See TracBrowser for help on using the repository browser.