Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4594 มุมมอง

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..

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ค. 25
1886
3
ก.พ. 25
15089
1
เม.ย. 25
2163
Export Import แก้ไขแล้ว
1
เม.ย. 25
2121
0
ต.ค. 23
1466