Skip to content

E402 triggered after sys.path.append #15133

Answered by MichaReiser
remchuk asked this question in Q&A
Discussion options

You must be logged in to vote

Oh nice find. I wasn't aware of this behavior. I had a quick look at the implementation and I suspect the problem is that you have two statements. Can you try inlining ROOT_DIR like this

#!/usr/bin/env python3

import os
import sys

sys.path.append(f"{os.path.dirname(os.path.abpath(__file__))}/../")

from A.B.likable import some_function

Replies: 1 comment 14 replies

Comment options

You must be logged in to vote
14 replies
@remchuk
Comment options

@MichaReiser
Comment options

Answer selected by remchuk
@remchuk
Comment options

@remchuk
Comment options

@MichaReiser
Comment options

@remchuk
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants