Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4779 Widoki

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!

Awatar
Odrzuć
Najlepsza odpowiedź

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


Awatar
Odrzuć
Autor

Hi Hilar,

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

Powiązane posty Odpowiedzi Widoki Czynność
1
lip 25
2205
3
lut 25
15497
1
kwi 25
2448
Export Import Rozwiązane
1
kwi 25
2458
0
paź 23
1722