Forum Stats

  • 3,826,348 Users
  • 2,260,631 Discussions
  • 7,896,912 Comments

Discussions

Cant Store a User Defined Python Function in OML Script Repository

User_QFLVG
User_QFLVG Member Posts: 2 Green Ribbon

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