export xlsx

This commit is contained in:
Christophe SEUX
2023-04-22 15:42:38 +02:00
parent 02785f9ec0
commit d0230672f4
7 changed files with 184 additions and 46 deletions
+22 -1
View File
@@ -1,10 +1,12 @@
import importlib
import re
import subprocess
import platform
import sys
import unicodedata
from pathlib import Path
def install_module(module_name, package_name=None):
'''Install a python module with pip or return it if already installed'''
try:
@@ -110,4 +112,23 @@ def read_file(path):
else:
data = txt
return data
return data
def open_file(filepath, env=None, select=False):
if platform.system() == 'Darwin': # macOS
cmd = ['open']
if select:
cmd += ['-R']
elif platform.system() == 'Windows': # Windows
cmd = ['explorer']
if select:
cmd += ['/select,']
else: # linux variants
cmd = ['xdg-open']
if select:
cmd = ['nemo']
cmd += [str(filepath)]
subprocess.Popen(cmd, env=env)