Get current working python file path
1- print(__file__)
2- os.path.abspath(__file__)
Output: D:\odoo\trunk\your_module\models.py
Get current working python file name
os.path.basename(__file__)
Output: models.py
Get current working module path
1- os.path.dirname(os.path.realpath(__file__))
2- os.path.dirname(__file__)
Output: D:\odoo\trunk\your_module
Get current working module name
os.path.basename(os.path.dirname(__file__))
Output: your_module
Don,t forgot to share, keep sharing keep learning
0 Comments