-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17989 from JamesDeFabia/HPCC-30721Python3examples
HPCC-30721 Fix Python examples to use Python3 Reviewed-By: Richard Taylor <richard.taylor@lexisnexis.com> Reviewed-by: Jake Smith <jake.smith@lexisnexisrisk.com> Merged-by: Gavin Halliday <ghalliday@hpccsystems.com>
- Loading branch information
Showing
5 changed files
with
72 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
IMPORT Python; | ||
IMPORT Python3 AS Python; | ||
|
||
/* | ||
This example illustrates and tests the use of embedded Python | ||
*/ | ||
|
||
// Mapping of exceptions from Python to ECL | ||
|
||
integer testThrow(integer val) := EMBED(Python) | ||
raise Exception('Error from Python') | ||
INTEGER testThrow(integer val) := EMBED(Python) | ||
raise Exception('Error from Python') | ||
ENDEMBED; | ||
|
||
// Can't catch an expression(only a dataset) | ||
d := dataset([{ 1, '' }], { integer a, string m} ) : stored('nofold'); | ||
d := DATASET([{ 1, '' }], { INTEGER a, STRING m} ) : STORED('nofold'); | ||
|
||
d t := transform | ||
d t := TRANSFORM | ||
self.a := FAILCODE; | ||
self.m := FAILMESSAGE; | ||
self := []; | ||
end; | ||
|
||
catch(d(testThrow(a) = a), onfail(t)); | ||
CATCH(d(testThrow(a) = a), onfail(t)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters