On Wed, 11 Sep 2013 16:53:25 +0900 YAMAMOTO Takashi <[email protected]> wrote:
> Signed-off-by: YAMAMOTO Takashi <[email protected]> > --- > ryu/utils.py | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/ryu/utils.py b/ryu/utils.py > index e8fc7a2..1e1aa49 100644 > --- a/ryu/utils.py > +++ b/ryu/utils.py > @@ -47,8 +47,12 @@ def chop_py_suffix(p): > > > def _likely_same(a, b): > - if os.path.samefile(a, b): > - return True > + try: > + if os.path.samefile(a, b): > + return True > + except OSError: > + # m.__file__ is not always accessible. eg. egg > + return False > if chop_py_suffix(a) == chop_py_suffix(b): > return True > return False > @@ -57,6 +61,8 @@ def _likely_same(a, b): > def _find_loaded_module(modpath): > # copy() to avoid RuntimeError: dictionary changed size during iteration > for k, m in sys.modules.copy().iteritems(): > + if k == '__main__': > + continue > if not hasattr(m, '__file__'): > continue > if _likely_same(m.__file__, modpath): I can say that the code is complicated enough now. I prefer simply catching the oslo.config exception. As I said before, what we need to solve is oslo.config double import. Except for that, double import is not a problem. We should not worry about it. ------------------------------------------------------------------------------ LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13. http://pubads.g.doubleclick.net/gampad/clk?id=64545871&iu=/4140/ostg.clktrk _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
