This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: import org.python.core imports local org.py
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, lebigot
Priority: normal Keywords:

Created on 2006-10-08 14:01 by lebigot, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg30181 - (view) Author: Eric O. LEBIGOT (lebigot) Date: 2006-10-08 14:01
It seems to me that the fact that "import
org.python.core" imports a local "org.py" file is not
the intended behavior.  Here are the details:

----------------------------------------
% python -m org.python.core
Traceback (most recent call last):
  File "/sw/lib/python2.5/runpy.py", line 85, in run_module
    loader = get_loader(mod_name)
  File "/sw/lib/python2.5/pkgutil.py", line 456, in
get_loader
    return find_loader(fullname)
  File "/sw/lib/python2.5/pkgutil.py", line 466, in
find_loader
    for importer in iter_importers(fullname):
  File "/sw/lib/python2.5/pkgutil.py", line 422, in
iter_importers
    __import__(pkg)
  File "org.py", line 1, in <module>
    test
NameError: name 'test' is not defined

% cat org.py
test
----------------------------------------

Best wishes,

EOL
msg30182 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-10-08 15:52
Logged In: YES 
user_id=849994

Why shouldn't "import org.python.core" first import org.py,
the org/python.py, then org/python/core.py, in CPython?
The current directory is on sys.path for -m arguments, so
the "local" org.py is imported.

The name "org.python.core" somehow reminds me of Jython. If
this is a Jython issue, it doesn't belong in this tracker.
msg30183 - (view) Author: Eric O. LEBIGOT (lebigot) Date: 2006-10-08 17:16
Logged In: YES 
user_id=1440667

From the doc:
 
http://docs.python.org/tut/node8.html#SECTION008400000000000000000

I had understood that the search performed during the import
process involved looking in "subdirectories": I thought that
"import org.python.core" would first search for an "org/"
directory and not for an "org.py" file.

But I'm no expert in imports with "dotted" packages...

EOL
History
Date User Action Args
2022-04-11 14:56:20adminsetgithub: 44099
2006-10-08 14:01:04lebigotcreate