跳至內容
選單
此問題已被標幟
1 回覆
4597 瀏覽次數

Hi All, 

I have a custom module which exports xlsx accounting reports.  When I export the report, it is saved in /var/lib/odoo directory instead in Downloads folder. Temporarily I set the path to home:

home = os.getenv("HOME")

When I print the home, the result is /var/lib/odoo. How do I get the home directory?


Thanks!

頭像
捨棄
最佳答案

try 

from os.path import expanduser
home = expanduser("~")

or if you are in python 3.5 + try

from pathlib import Path
home = str(Path.home())


頭像
捨棄
作者

Hi Hilar,

I've tried both but the output path is still /var/lib/odoo..

相關帖文 回覆 瀏覽次數 活動
1
7月 25
1895
3
2月 25
15099
1
4月 25
2168
Export Import 已解決
1
4月 25
2126
0
10月 23
1474