Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4023098
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:33:26+00:00 2026-05-20T10:33:26+00:00

EDIT: is from __future__ import absolute_import available in IronPython? I just realized, though everything

  • 0

EDIT: is from __future__ import absolute_import available in IronPython? I just realized, though everything I’m using is only python, the project as a whole is in IronPython.

I’m trying to use relative imports (instead of appending to sys.path). Here is my directory structure:

-src
  |
  -runners
    |
    -__init__.py
    -clippyRunner.py
  |
  -__init__.py
  -clippy.py
  -irondb.py
  -ironxl.py

now, in clippyRunner.py, I want to import clippy, which as you can see is in the parent directory src. so what I’ve done is this:

from __future__ import absolute_import
from ...src import clippy

but this is giving me this error:

ValueError: Attempted relative import in non-package

i’ve also tried

from ..src import clippy

witht he same results.

what am I doing wrong here?

EDIT: I’ve also tried import ..clippy
which just gives me: SyntaxError: unexpected token '.'

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:33:26+00:00Added an answer on May 20, 2026 at 10:33 am

    The error message you’re getting says that IronPython is accepting the syntax, but believes you aren’t currently running code inside a package.

    Since you’re getting '__main__' instead of 'src.runners.clippyRunner' when you print out __name__, this tells me that you’re running /src/runners/clippyRunner.py directly from the command line. As you’ve seen, this breaks relative imports, since Python doesn’t know where the module lives in the package heirarchy.

    In CPython, you can handle this situation by using the command line python -m src.runners.clippyRunner from the directory containing the src package to ensure the interpreter knows the proper location of the affected module.

    I don’t know if the current version of IronPython has an equivalent mechanism (CPython only fixed it when PEP 366 was included in version 2.6)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit: How to return/serve a file from a python controller (back end) over a
Edit: From another question I provided an answer that has links to a lot
I want to create a number of masked edit extenders from codebehind. Something like:
We're looking at moving from a check-out/edit/check-in style of version control system to Subversion,
i want to know how to edit a single row (which i select) from
How to get function's name from function's pointer in C? Edit: The real case
Is there a way to convert from System.Windows.Forms.HtmlElement to mshtml.IHTMLElemenet3? --edit after answer accepted
I'm teaching myself Python. I saw a java permutation generator from a string, and
Edit: This question was written in 2008, which was like 3 internet ages ago.
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.