Re: Why this recursive import fails?

2012-03-07 Thread INADA Naoki
I found it is a bug http://bugs.python.org/issue13187 -- http://mail.python.org/mailman/listinfo/python-list

Why this recursive import fails?

2012-03-06 Thread INADA Naoki
I have 4 py files like below. Two __init__.py is empty file. $ find foo -name "*.py" foo/lib/lib.py foo/lib/__init__.py foo/__init__.py foo/foo.py $ cat foo/lib/lib.py from __future__ import absolute_import print('lib.py', __name__) from .. import foo #import foo.foo $ cat foo/foo.py from __futu

Re: Better error message on recursive import

2008-09-12 Thread Wojtek Walczak
On Thu, 11 Sep 2008 12:43:34 +0200, Thomas Guettler wrote: Hello, > why does Python only raise ImportError if it fails caused by a recursive > import? > > I know what's wrong. But I guess many beginner don't know what's wrong. I don't think that you're righ

Re: Better error message on recursive import

2008-09-12 Thread Marc 'BlackJack' Rintsch
On Fri, 12 Sep 2008 09:47:42 +0200, Thomas Guettler wrote: >> Can you give an example of such a recursive import you want the special >> exception be raised? > > ===> cat one.py > from two import testtwo > def testone(): > print "one" > &

Re: Better error message on recursive import

2008-09-12 Thread Thomas Guettler
Hi, Can you give an example of such a recursive import you want the special exception be raised? ===> cat one.py from two import testtwo def testone(): print "one" ===> cat two.py import one def testtwo(): print "two" ===> python one.py Traceback (m

Re: Better error message on recursive import

2008-09-11 Thread Marc 'BlackJack' Rintsch
On Thu, 11 Sep 2008 12:43:34 +0200, Thomas Guettler wrote: > why does Python only raise ImportError if it fails caused by a recursive > import? > > I know what's wrong. But I guess many beginner don't know what's wrong. > I don't want much, just "Recur

Better error message on recursive import

2008-09-11 Thread Thomas Guettler
Hi, why does Python only raise ImportError if it fails caused by a recursive import? I know what's wrong. But I guess many beginner don't know what's wrong. I don't want much, just "RecursiveImportError" instead of "ImportError". Is this possi

recursive import

2008-07-01 Thread oj
Hi, I'm just toying around with some ideas at the moment. Is there an easy and safe way to recursivly import all modules under a particular namespace? Say, I had modules: foo foo.bar foo.bar.baz foo.baz bar bar.baz I want to import all the modules in the foo namespace, so the first four modules

Re: recursive import list

2005-06-14 Thread Philippe C. Martin
Mike Meyer wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: >>> I have a fairly large project going on and would like to figure out >>> automatically from the source which files are being imported. >> If you use your own import function, like below, you could create a >> list of all import

Re: recursive import list

2005-06-13 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: >> I have a fairly large project going on and would like to figure out >> automatically from the source which files are being imported. > If you use your own import function, like below, you could create a > list of all imported modules. Why not use

Re: recursive import list

2005-06-13 Thread [EMAIL PROTECTED]
If you use your own import function, like below, you could create a list of all imported modules. #!/usr/bin/env python mod_list = [] def my_import(name, globals = None, locals = None, fromlist = None): mod_list.append(name) mod = __import__(name, globals, locals, fromlist) return mo

recursive import list

2005-06-13 Thread Philippe C. Martin
Hi, I have a fairly large project going on and would like to figure out automatically from the source which files are being imported. ex: find_out mymain.py Is there an easy way to achieve that ? Regards, Philippe -- http://mail.python.org/mailman/listinfo/python-list