This block of code should print out the correct file path in the nightly build as of 01-13-20.
dir = os.path.dirname(__file__)
For some strange reason certain directories break this functionality and I cant seem to figure out why. Here is an example of testing the above two lines of code in two different directories, lets just call this script Path.py. Any directory starting with a numerical value will also break the functionality that I am looking for which isn’t to much of a concern for me.
File Location: C:\Test\Test1\Test2\Test3\Path.py
- Output: C:\Test\Test1\Test2\Test3
- Result: This works
File Location: C:\Test\Test1\run\Test3\Path.py
- Output: C:\Test\Test1
- Result: This Breaks
Here is the output in the Python shell.
I don’t believe that it is an issue with the unicode escape sequence because I’m not physically specifying the file path. I could be wrong and misinterpreting your answer. Regardless thank you for your response.