I have a script, B.py
, that is imported from another script, say A.py
If I import B in A, the __file__
magical constant, has converted some uppercase letters in its path to lowercase.
If I run B file directly, the __file__
constant HAS proper case regarding the path.
In short this is what happens. The following:
telplugins_path = os.path.dirname(os.path.realpath(__file__))
give me a path like this
C:\\Python\\lib\\site_packages\\mypackage
when it should be
C:\\Python\\Lib\\site_packages\\mypackage
Observe the change on 'Lib' -> 'lib'
Anyone have an idea on how to get the path to __file__
with proper case? Running this on Windows.