Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
4605 Tampilan

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!

Avatar
Buang
Jawaban Terbai

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())


Avatar
Buang
Penulis

Hi Hilar,

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

Post Terkait Replies Tampilan Aktivitas
1
Jul 25
1947
3
Feb 25
15133
1
Apr 25
2190
Export Import Diselesaikan
1
Apr 25
2157
0
Okt 23
1493