I found it is a bug http://bugs.python.org/issue13187
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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"
>
&
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
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
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
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
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
"[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
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
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
12 matches
Mail list logo