Fix #3788. Fix crash when opening drawing SVGs using webbrowser module which is not recommended and the file is on a Dropbox synced external drive. Now replaced with generic os.startfile / xdg-open / open commands.

This commit is contained in:
Dion Moult
2023-09-27 11:50:43 +10:00
parent f1a5805b1c
commit e93a697179
5 changed files with 7 additions and 6 deletions
@@ -22,7 +22,6 @@ import json
import ifccsv import ifccsv
import logging import logging
import tempfile import tempfile
import webbrowser
import ifcopenshell import ifcopenshell
import blenderbim.tool as tool import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore from blenderbim.bim.ifc import IfcStore
@@ -26,7 +26,6 @@ import shutil
import hashlib import hashlib
import shapely import shapely
import subprocess import subprocess
import webbrowser
import numpy as np import numpy as np
import multiprocessing import multiprocessing
import ifcopenshell import ifcopenshell
@@ -21,7 +21,6 @@ import bpy
import json import json
import logging import logging
import tempfile import tempfile
import webbrowser
import ifcopenshell import ifcopenshell
import blenderbim.tool as tool import blenderbim.tool as tool
@@ -23,7 +23,6 @@ import time
import calendar import calendar
import isodate import isodate
import pystache import pystache
import webbrowser
import blenderbim.core.sequence as core import blenderbim.core.sequence as core
import blenderbim.tool as tool import blenderbim.tool as tool
import blenderbim.bim.module.sequence.helper as helper import blenderbim.bim.module.sequence.helper as helper
+7 -2
View File
@@ -26,9 +26,9 @@ import bmesh
import shutil import shutil
import logging import logging
import shapely import shapely
import platform
from shapely.ops import unary_union from shapely.ops import unary_union
import mathutils import mathutils
import webbrowser
import subprocess import subprocess
import numpy as np import numpy as np
import blenderbim.core.tool import blenderbim.core.tool
@@ -834,7 +834,12 @@ class Drawing(blenderbim.core.tool.Drawing):
command[0] = shutil.which(command[0]) or command[0] command[0] = shutil.which(command[0]) or command[0]
subprocess.Popen([replacements.get(c, c) for c in command]) subprocess.Popen([replacements.get(c, c) for c in command])
else: else:
webbrowser.open("file://" + path) if platform.system() == "Darwin":
subprocess.call(("open", path))
elif platform.system() == "Windows":
os.startfile(path)
else:
subprocess.call(("xdg-open", path))
@classmethod @classmethod
def open_spreadsheet(cls, uri): def open_spreadsheet(cls, uri):