Hi there,
I'm new to PhreeqPy and trying to run the COM interface from a python script, inspired by
http://water.usgs.gov/nrp/proj.bib/Publications/2011/muller_parkhurst_etal_2011.pdfMy script is at the end of this post and it fails at the last line with the error message below, which complains about the database. I double checked the database path name is readable and I installed the PhreeqPy tools without incident. What could be the problem here?
Any insights would be greatly appreciated,
Cheers,
Joost
===============================================
Error:
Traceback (most recent call last):
File "IPhreeqc_stripped.py", line 38, in <module>
phreeqc.run_string(initial_conditions)
File "/usr/local/lib/python2.7/dist-packages/phreeqpy-0.2.0-py2.7.egg/phreeqpy/iphreeqc/phreeqc_dll.py", line 287, in run_string
self.raise_string_error(errors)
File "/usr/local/lib/python2.7/dist-packages/phreeqpy-0.2.0-py2.7.egg/phreeqpy/iphreeqc/phreeqc_dll.py", line 117, in raise_string_error
raise Exception(msg + self.get_error_string())
Exception: An error occured.
ERROR: RunString: No database is loaded================================================
code:
def make_initial_conditions ():
#"""
#Specify initial conditions data blocks.
#Uniform initial conditions are assumed.
#"""
initial_conditions = """
TITLE Example 11.--Transport and ion exchange.
SOLUTION 0 CaCl2
units mmol/kgw
temp 25.0
pH 7.0 charge
pe 12.5 O2(g) -0.68
Ca 0.6
Cl 1.2
SOLUTION 1 Initial solution for column
units mmol/kgw
temp 25.0
pH 7.0 charge
pe 12.5 O2(g) -0.68
Na 1.0
K 0.2
N(5) 1.2
END
EXCHANGE 1
equilibrate 1
X 0.0011
END
"""
return initial_conditions
from ctypes import *
cdll.LoadLibrary("/usr/local/lib/python2.7/dist-packages/phreeqpy-0.2.0-py2.7.egg/phreeqpy/iphreeqc/libiphreeqc.so.0.0.0")
import phreeqpy.iphreeqc.phreeqc_dll as phreeqc_mod
phreeqc = phreeqc_mod.IPhreeqc()
phreeqc.load_database(r"phreeqc.dat")
initial_conditions = make_initial_conditions()
phreeqc.run_string(initial_conditions)