Message165166
With the following package directory structure--
foo/
__init__.py
__main__.py
from foo import bar
bar.py
print('***')
raise ImportError('test...')
Running--
$ ./python.exe -m foo
Yields--
***
Traceback (most recent call last):
File ".../python/cpython/cpython/Lib/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File ".../python/cpython/cpython/Lib/runpy.py", line 75, in _run_code
exec(code, run_globals)
File "./foo/__main__.py", line 1, in <module>
from foo import bar
ImportError: cannot import name bar
$
The exception text gets swallowed.
Changing the relative import "from foo import bar" to "import foo.bar" does show the exception text. |
|
Date |
User |
Action |
Args |
2012-07-10 05:39:18 | chris.jerdonek | set | recipients:
+ chris.jerdonek |
2012-07-10 05:39:18 | chris.jerdonek | set | messageid: <1341898758.4.0.623810416258.issue15316@psf.upfronthosting.co.za> |
2012-07-10 05:39:17 | chris.jerdonek | link | issue15316 messages |
2012-07-10 05:39:17 | chris.jerdonek | create | |
|