what gives with "'import *' not allowed with 'from .'"?

Discussion in 'Python' started by Darren Dale, Jan 23, 2009.

  1. Darren Dale

    Darren Dale Guest

    I know the use of "from foo import *" is discouraged, but I'm writing
    a package that I hope others may want to integrate as a subpackage of
    their own projects, I know what I'm doing, and I want to use the
    "from .bar import *" syntax internally. It works fine with python-2.6,
    but with python-2.5 I get a SyntaxError: "'import *' not allowed with
    'from .'" Judging from http://bugs.python.org/issue2400 , this issue
    was fixed back in May 2008, but it is still present with python-2.5.4,
    which was released in December. Why wont python-2.5 allow this kind of
    import?
    Darren Dale, Jan 23, 2009
    #1
    1. Advertising

  2. Re: what gives with

    Darren Dale <dsdale24 <at> gmail.com> writes:
    > Judging from http://bugs.python.org/issue2400 , this issue
    > was fixed back in May 2008, but it is still present with python-2.5.4,
    > which was released in December. Why wont python-2.5 allow this kind of
    > import?


    Allowing that would be a new feature which is disallowed in bug fix releases
    like 2.5.4.
    Benjamin Peterson, Jan 23, 2009
    #2
    1. Advertising

  3. Darren Dale

    Darren Dale Guest

    Re: what gives with

    On Jan 22, 10:07 pm, Benjamin Peterson <> wrote:
    > Darren Dale <dsdale24 <at> gmail.com> writes:
    >
    > > Judging fromhttp://bugs.python.org/issue2400, this issue
    > > was fixed back in May 2008, but it is still present with python-2.5.4,
    > > which was released in December. Why wont python-2.5 allow this kind of
    > > import?

    >
    > Allowing that would be a new feature which is disallowed in bug fix releases
    > like 2.5.4.


    I was talking about the behavior after doing "from __future__ import
    absolute_import". I've been developing on python-2.6 using
    absolute_import for weeks, knowing that I could do "from __future__
    import absolute import" on python-2.5. Now when I try to use
    python-2.5 I cant import my package. What is the point of providing
    absolute_import in __future__ if the api is completely different than
    the implementation in future python versions? Its bizarre.
    Darren Dale, Jan 23, 2009
    #3
  4. Darren Dale

    Steve Holden Guest

    Re: what gives with

    Darren Dale wrote:
    > On Jan 22, 10:07 pm, Benjamin Peterson <> wrote:
    >> Darren Dale <dsdale24 <at> gmail.com> writes:
    >>
    >>> Judging fromhttp://bugs.python.org/issue2400, this issue
    >>> was fixed back in May 2008, but it is still present with python-2.5.4,
    >>> which was released in December. Why wont python-2.5 allow this kind of
    >>> import?

    >> Allowing that would be a new feature which is disallowed in bug fix releases
    >> like 2.5.4.

    >
    > I was talking about the behavior after doing "from __future__ import
    > absolute_import". I've been developing on python-2.6 using
    > absolute_import for weeks, knowing that I could do "from __future__
    > import absolute import" on python-2.5. Now when I try to use
    > python-2.5 I cant import my package. What is the point of providing
    > absolute_import in __future__ if the api is completely different than
    > the implementation in future python versions? Its bizarre.


    I guess it must specify some alternate future ...

    regards
    Steve
    --
    Steve Holden +1 571 484 6266 +1 800 494 3119
    Holden Web LLC http://www.holdenweb.com/
    Steve Holden, Jan 23, 2009
    #4
  5. Re: what gives with

    Darren Dale <dsdale24 <at> gmail.com> writes:
    > I was talking about the behavior after doing "from __future__ import
    > absolute_import". I've been developing on python-2.6 using
    > absolute_import for weeks, knowing that I could do "from __future__
    > import absolute import" on python-2.5. Now when I try to use
    > python-2.5 I cant import my package. What is the point of providing
    > absolute_import in __future__ if the api is completely different than
    > the implementation in future python versions? Its bizarre.


    The API is not completely different. The 2.5 version of the feature just lacks
    the ability to import with "*". It is still same in 2.6, but with the ability to
    use "*".
    Benjamin Peterson, Jan 23, 2009
    #5
    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. B.Sathish Kumar

    aspx files gives header output in IE.

    B.Sathish Kumar, Feb 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    337
    B.Sathish Kumar
    Feb 18, 2004
  2. gh0st54
    Replies:
    6
    Views:
    8,012
    Natty Gur
    Aug 19, 2003
  3. Andrew
    Replies:
    3
    Views:
    443
    Ken Cox [Microsoft MVP]
    Sep 3, 2003
  4. wtsnet
    Replies:
    4
    Views:
    668
    wtsnet
    Nov 25, 2003
  5. George Sakkis
    Replies:
    4
    Views:
    599
    Steven Bethard
    Jan 15, 2008
Loading...

Share This Page