Dan Stromberg wrote at 2021-10-29 16:38 -0700:
>Is there a predefined function somewhere that can accept the 3 things on
>the LHS in the subject line, and give back a resultant relative path -
>relative to the unchanged CWD?
>
>To illustrate, imagine:
>1) You're sitting in /home/foo/coolprog
>2) You look up the AST for /home/foo/coolprog/a/b/c.py
>3) /home/foo/coolprog/a/b/c.py has a relative import of ..blah

Look at the functions provided by `os.path`.

Maybe, you do not need relative path: look at `importlib`
(which also supports import via absolute paths).
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to