diff --git a/AppExamples/script_resources/ResourceAccess/doc/Documentation.md b/AppExamples/script_resources/ResourceAccess/doc/Documentation.md index 658ac00..b618cfb 100644 --- a/AppExamples/script_resources/ResourceAccess/doc/Documentation.md +++ b/AppExamples/script_resources/ResourceAccess/doc/Documentation.md @@ -9,7 +9,8 @@ Demonstration for accessing App based resources via scripts. Resources are addressed with a relative or absolute file system path. In this example, the path relative to the Python script file is used: ```python -data = gom.app.resource["assets/zeiss_logo.png"] +with gom.Resource("assets/zeiss_logo.png").open() as fh: + data = fh.read() ``` The equivalent absolute path is `:Resources/assets/zeiss_logo.png`. diff --git a/AppExamples/script_resources/ResourceAccess/scripts/Resources/resource.py b/AppExamples/script_resources/ResourceAccess/scripts/Resources/resource.py index 91197e8..cf887e3 100644 --- a/AppExamples/script_resources/ResourceAccess/scripts/Resources/resource.py +++ b/AppExamples/script_resources/ResourceAccess/scripts/Resources/resource.py @@ -13,9 +13,10 @@ import gom # -# Resources are addressed with a relative or absolute file system path +# Resources are addressed with a relative or absolute file system path. # -data = gom.app.resource["assets/zeiss_logo.png"] +with gom.Resource("assets/zeiss_logo.png").open() as fh: + data = fh.read() print ('Type:', type (data)) print ('Size:', len (data))