+2

__file__ is incorrect (a relative path) in plugin python modules

glyph 6 years ago • updated 6 years ago 0
The __file__ variable in Python should allow a module to know what directory it's in so that (among other things) it can open resources which are its siblings.  It's OK for them to be relative paths, but then the interpreter's directory shouldn't change (and sublime definitely changes its current directory).  Ideally this would be set to an absolute path.

I should note that this is easy to work around though, since any script that wants to can work around it with "__file__ = os.path.abspath(__file__)".