Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
4588 Näkymät

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
Hylkää
Paras vastaus

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
Hylkää
Tekijä

Hi Hilar,

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

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
heinäk. 25
1881
3
helmik. 25
15089
1
huhtik. 25
2162
Export Import Ratkaistu
1
huhtik. 25
2119
0
lokak. 23
1463