Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
4606 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Autore

Hi Hilar,

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

Post correlati Risposte Visualizzazioni Attività
1
lug 25
1971
3
feb 25
15165
1
apr 25
2208
1
apr 25
2178
0
ott 23
1499