Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
4772 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Auteur

Hi Hilar,

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

Gerelateerde posts Antwoorden Weergaven Activiteit
1
jul. 25
2199
3
feb. 25
15486
1
apr. 25
2415
1
apr. 25
2422
0
okt. 23
1717