problem reading database

156 views
Skip to first unread message

Yost

unread,
Oct 31, 2013, 9:25:58 AM10/31/13
to phreeqp...@googlegroups.com
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.pdf

My 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)

Parkhurst, David

unread,
Oct 31, 2013, 11:53:12 AM10/31/13
to phreeqp...@googlegroups.com
Don't know, but you should probably check the return value for the load_database step. It looks as if it must have failed.

--
You received this message because you are subscribed to the Google Groups ""phreeqpy-users" group.
To post to this group, send email to phreeqp...@googlegroups.com.
To unsubscribe from this group, send email to phreeqpy-user...@googlegroups.com.
For more options, visit this group at https://groups.google.com/d/forum/phreeqpy-users?hl=en.
 
More information about PhreeqPy can be found at http://www.phreeqpy.com.
---
You received this message because you are subscribed to the Google Groups "phreeqpy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phreeqpy-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Charlton, Scott

unread,
Oct 31, 2013, 10:04:44 PM10/31/13
to phreeqp...@googlegroups.com
Also, make sure the database (phreeqc.dat) is in the same directory as your python script.

On Thu, Oct 31, 2013 at 7:25 AM, Yost <summer...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups ""phreeqpy-users" group.
To post to this group, send email to phreeqp...@googlegroups.com.
To unsubscribe from this group, send email to phreeqpy-user...@googlegroups.com.
For more options, visit this group at https://groups.google.com/d/forum/phreeqpy-users?hl=en.
 
More information about PhreeqPy can be found at http://www.phreeqpy.com.
---
You received this message because you are subscribed to the Google Groups "phreeqpy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phreeqpy-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Scott Charlton
Reply all
Reply to author
Forward
0 new messages