yup finally it worked. The trick is following:
suppose you have a file "example.jsl" and you want to have the absolute path. You should do following:
cur_dir = Substr( Get Default Directory(), 2 );
cur_dir = Convert File Path( cur_dir, Windows );
Show( cur_dir );
_path_script = cur_dir || "find_home_directory.py";
Show( _path_script );
home_dir = Run Program( executable( "python" ), options( _path_script ), readfunction( "text" ) );
Show( home_dir );
path_to_example_jsl = Substitute( home_dir, "\r", "example.jsl" );
Show( path_to_example_jsl );
The python file you call is simple:
import os
def find_home_dir():
cur_dir = os.path.dirname(os.path.realpath(__file__))
while True:
if "file_which_defines_root" in os.listdir(cur_dir):
break
else:
cur_dir = os.path.dirname(cur_dir)
print(cur_dir.strip())
if __name__ == '__main__':
find_home_dir()