From acdf1a9fe7b42200d1f1295486359492b0c00412 Mon Sep 17 00:00:00 2001 From: Eugene Kozlov <68875428+kozlove-aws@users.noreply.github.com> Date: Mon, 22 Mar 2021 04:15:43 -0500 Subject: [PATCH] fix: TypeError when trying to use bin-scripts in Python (#2720) ### Problem Bin script on Python is failing with error `The "path" argument must be of type string. Received undefined` ### Solution - Changed parameter name `pkgname` on `assembly` in `InvokeScriptRequest` - Returned response from `invokeBinScript` (used for printing output) ### Testing Running bin script with these change and make sure that bin scripts are running. --- packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py | 7 ++++--- packages/@jsii/python-runtime/src/jsii/_kernel/types.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py b/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py index 69c00ac1d7..5db5eea3f7 100644 --- a/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py +++ b/packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py @@ -35,6 +35,7 @@ InvokeRequest, InvokeResponse, InvokeScriptRequest, + InvokeScriptResponse, KernelResponse, LoadRequest, ObjRef, @@ -254,13 +255,13 @@ def load(self, name: str, version: str, tarball: str) -> None: def invokeBinScript( self, pkgname: str, script: str, args: Optional[List[Any]] = None - ) -> None: + ) -> InvokeScriptResponse: if args is None: args = [] - self.provider.invokeBinScript( + return self.provider.invokeBinScript( InvokeScriptRequest( - pkgname=pkgname, + assembly=pkgname, script=script, args=_make_reference_for_native(self, args), ) diff --git a/packages/@jsii/python-runtime/src/jsii/_kernel/types.py b/packages/@jsii/python-runtime/src/jsii/_kernel/types.py index cdafb396a7..8f28657ddf 100644 --- a/packages/@jsii/python-runtime/src/jsii/_kernel/types.py +++ b/packages/@jsii/python-runtime/src/jsii/_kernel/types.py @@ -44,7 +44,7 @@ class LoadResponse: @attr.s(auto_attribs=True, frozen=True, slots=True) class InvokeScriptRequest: - pkgname: str + assembly: str script: str args: List[Any] = attr.Factory(list) @@ -55,7 +55,7 @@ class InvokeScriptResponse: status: int stdout: str stderr: str - output: List[str] + signal: str @attr.s(auto_attribs=True, frozen=True, slots=True)