absolute imports (python-2.5)

J

jUrner

Hello all

I just played around a bit with python 2.5 and relative imports.
Bit disappointed so far. Hoped to be able to use this new feature
to develop standalone libraries that can be just dropped into
any project without having to adjust any imports.

pkg/
pkg/__init__.py
pkg/main.py
pkg/string.py


"main.py" does:
from . import string

no problem if you import the whole package from another module:
import pkg

but if you execute "main.py" you get an error
"ValueError: Relative importpath too deep"

This is looks a nightmare come true for developing modules.
I read all available information regarding the "-m" switch and its
limitations when it comes to relative imports. Being impatient
and scarend of having to wait another (year!) for this feature to
become usable I wonder if anyone has any better information on
things ahead.

Juergen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top