absolute imports (python-2.5)

Discussion in 'Python' started by jUrner@arcor.de, Aug 29, 2006.

  1. Guest

    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
     
    , Aug 29, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Richard Cooper

    Absolute Imports and PYTHONPATH

    Richard Cooper, May 5, 2004, in forum: Python
    Replies:
    1
    Views:
    448
    John Roth
    May 6, 2004
  2. Albert
    Replies:
    4
    Views:
    10,894
    Albert
    Jul 10, 2008
  3. Steven D'Aprano

    Absolute imports in Python 2.4

    Steven D'Aprano, Jun 2, 2009, in forum: Python
    Replies:
    2
    Views:
    929
    Steven D'Aprano
    Jun 4, 2009
  4. zildjohn01
    Replies:
    0
    Views:
    654
    zildjohn01
    Feb 22, 2011
  5. Victor Hooi
    Replies:
    1
    Views:
    109
    Devin Jeanpierre
    Nov 25, 2013
Loading...

Share This Page