Skip to content

Commit

Permalink
try except maplocal so it won't fail if it isn't installed
Browse files Browse the repository at this point in the history
  • Loading branch information
jgunstone committed Apr 14, 2023
1 parent a86a01e commit 93365ff
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions src/ipyautoui/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,42 @@
import inspect
import immutables
import getpass
import maplocal


frozenmap = immutables.Map
try:
import maplocal

if maplocal.maplocal_openlocal_exists():
from maplocal import openlocal as open_path
from maplocal import maplocal as make_new_path
else:

def make_new_path(path, *args, **kwargs):
return path

def open_path(path):
import subprocess
import sys

if sys.platform == "linux":
subprocess.call(["xdg-open", path])
else:
subprocess.call(["explorer.exe", path])

if maplocal.maplocal_openlocal_exists():
from maplocal import openlocal as open_path
from maplocal import maplocal as make_new_path
else:
except:

def make_new_path(path, *args, **kwargs):
return path

def open_path(path):
import subprocess
def open_path(path):
import subprocess
import sys

subprocess.call(["open", path])
if sys.platform == "linux":
subprocess.call(["xdg-open", path])
else:
subprocess.call(["explorer.exe", path])


def getuser():
Expand Down

0 comments on commit 93365ff

Please sign in to comment.