export xlsx
This commit is contained in:
+22
-1
@@ -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)
|
||||
Reference in New Issue
Block a user