Skip to content

Commit

Permalink
fix(Python): Do not import wasmtime with emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Mar 3, 2023
1 parent 60d55a5 commit a96ac59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/python/itkwasm/itkwasm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""itkwasm: Python interface to itk-wasm WebAssembly modules."""

__version__ = "1.0b78"
__version__ = "1.0b82"

from .interface_types import InterfaceTypes
from .image import Image, ImageType
Expand Down
6 changes: 4 additions & 2 deletions src/python/itkwasm/itkwasm/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from dataclasses import asdict
from typing import List, Union, Dict, Tuple
import ctypes
import sys

import numpy as np

Expand All @@ -19,7 +20,8 @@
from .int_types import IntTypes
from .float_types import FloatTypes

from wasmtime import Config, Store, Engine, Module, WasiConfig, Linker
if sys.platform != "emscripten":
from wasmtime import Config, Store, Engine, Module, WasiConfig, Linker

def _to_numpy_array(component_type, buf):
if component_type == IntTypes.UInt8:
Expand Down Expand Up @@ -418,4 +420,4 @@ def _get_output_json(self, output_index: int) -> Dict:
json_len = self.output_json_size(self.store, 0, output_index)
json_str = self._wasmtime_lift(json_ptr, json_len).decode()
json_result = json.loads(json_str)
return json_result
return json_result

0 comments on commit a96ac59

Please sign in to comment.