My imported module functions can't reach the nwchem pythonic functions such as rtdb_get(), rtdb_put().
A direct call to rtdb_get() succeeds.
Python resolves the call to the module function seemingly correctly.
Once there, a call to rtdb_get() fails and returns an error message:
File "/home/drhaney/horriblyArcanePath/simple.py", line 3, in get_tag
return rtdb_get(str)
NameError: global name 'rtdb_get' is not defined
A minimal example for this behavior follows.
A simple module, e.g., simple.py contains:
### simple.py python module ###
def get_tag(str):
return rtdb_get(str)
### end module ###
.
The input file, simple.nw , starts normally:
start SimPyModImp
title "Simple Python Module Import"
#
geometry ; He 0.0 0.0 0.0 ; end
basis ; He library 6-31G* ; end
The python section contains:
python noprint
# add local directory to python path
import os, sys
sys.path.append(os.getcwd())
import simple
#
# top level rtdb_get() works
print ("Title is [%s]" % (rtdb_get("title")))
#
# ...but the module func can't find rtdb_get().
print ("Title is [%s]" % (simple.get_tag("title")))
#
end
#
task scf energy
task python
All help is appreciated, especially since I feel like I just grabbed a bear by the tail.
-drh
|