i have some trouble with some paths

I'm making a map maker and when I save the map, I register all img's path into a file witch is located wherever the user wants to. The paths are relatives paths from where the map's file is and not from the script's location.

When I open the map with an other script witch isn't at the same location as the script of the map maker, I need to get the path of the images (absolute path or rel path it doesn't matter).

1 answer

  • answered 2018-01-11 20:15 Luke McPuke

    import os
    os.path.relpath(end, start)

    Will give you a representation of the relative path.