From NWChem
You are viewing a single post from the thread title above
|
Clicked A Few Times
Threads 10
Posts 24
|
|
7:40:00 PM PDT - Mon, May 18th 2015 |
|
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
|
|
|
AWC's:
2.5.10 MediaWiki - Stand Alone Forum Extension
Forum theme style by: AWC