For Linux this would give me /
, for Windows on the C drive that would give me C:\\
. Note that python is not necessarily installed on the C drive on windows.
Try this:
import os
def root_path():
return os.path.abspath(os.sep)
On Linux this returns /
On Windows this returns C:\\
or whatever the current drive is