Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13861

Struggling to append a relative path to my sys.path [duplicate]

$
0
0

So there are a lot of pretty similar questions but none of the answers seems to satisfy what I'm looking for.

Essentially I am running a python script using an absolute directory in the command line.
Within this file itself, I want to import a module/file,I currently use an absolute path to do this (sys.path.append(/....).
But I would like to use a relative path, relative to the script itself.
All I seem to be able to do is append a path relative to my present working directory.

How do I do this?


Viewing all articles
Browse latest Browse all 13861

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>