Skip to Main Content

Data Science & Machine Learning

Cant Store a User Defined Python Function in OML Script Repository

User_QFLVGFeb 6 2022

Trying to Store a User Defined Python Function in Oracle Machine Learning Script Repository.
The below function exists and runs in OML.

%python
import oml
def TestRepo ():
print ("Hello World")
return

When I try to store it in the repository with the below command it fails:

oml.script.create(name = "TEST", func = TestRepo, overwrite = True, is_global = True)

The Error appears below:

Fail to execute line 40: oml.script.create(name = "TEST", func = TestRepo, overwrite = True, is_global = True)
Traceback (most recent call last):
File "/tmp/1643972373269-0/zeppelin_python.py", line 200, in <module>
exec(code, _zcUserQueryNameSpace)
File "<stdin>", line 40, in <module>
File "oml/script/script.py", line 148, in oml.script.script.create
File "oml/script/script.py", line 328, in oml.script.script._deparseFun
File "/usr/local/lib/python3.9/inspect.py", line 1024, in getsource
lines, lnum = getsourcelines(object)
File "/usr/local/lib/python3.9/inspect.py", line 1006, in getsourcelines
lines, lnum = findsource(object)
File "/usr/local/lib/python3.9/inspect.py", line 835, in findsource
raise OSError('could not get source code')
OSError: could not get source code

Comments
Post Details
Added on Feb 6 2022
0 comments
45 views