Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
4595 Vizualizări

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!

Imagine profil
Abandonează
Cel mai bun răspuns

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


Imagine profil
Abandonează
Autor

Hi Hilar,

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

Related Posts Răspunsuri Vizualizări Activitate
1
iul. 25
1890
3
feb. 25
15095
1
apr. 25
2165
1
apr. 25
2124
0
oct. 23
1469