PhreeqcUsers Discussion Forum
Click here to donate to keep PhreeqcUsers open

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 

  • Forum Home
  • Login
  • Register

  • PhreeqcUsers Discussion Forum »
  • Conceptual Models »
  • Incorporation PHREEQC in programming languages »
  • Batch PHREEQC via Python script
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Batch PHREEQC via Python script  (Read 196 times)

freiburgermsu

  • Frequent Contributor
  • Posts: 24
Batch PHREEQC via Python script
« on: January 24, 2022, 03:53:58 AM »
Hello!

I am developing a command-line UI for ROSSpy (https://pypi.org/project/ROSSpy/) via the PHREEQC.bat file. I continually receive the attached error message that "The system cannot find the path specified". This cannot be true, since the paths are verified to exist in the system in the Python lines (https://github.com/freiburgermsu/ROSSpy/blob/main/irosspy/iROSSpy.py#L590-L595) just preceeding the execution of the batch file (https://github.com/freiburgermsu/ROSSpy/blob/main/irosspy/iROSSpy.py#L597-L601).

What is the source of this error, and how can it be resolved?
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2508
Re: Batch PHREEQC via Python script
« Reply #1 on: February 16, 2022, 09:18:23 PM »
I don't know. Perhaps the line is too long?

The phreeqc.bat file usually says "input file not found" or "database file not found", so I am not sure where the message "the system cannot find" comes from. It is not in the code for phreeqc.

Try putting all the files in one directory (.bat, input, database), cd to that directory, and run the bat file (phreeqc.bat input output database).
Logged

freiburgermsu

  • Frequent Contributor
  • Posts: 24
Re: Batch PHREEQC via Python script
« Reply #2 on: May 21, 2022, 04:56:39 PM »
Hello David,

We elected to circumvent this bug from calling the batch PHREEQC software by simply using PHREEQpy. This disadvantageously does neither generates a full PQO report nor displays updates as the PQI file is executed, but it is sufficient for the simple results. I may revisit this concept is future versions of ROSSpy.

Thank you :)
   Andrew
Logged

smidera

  • Contributor
  • Posts: 3
Re: Batch PHREEQC via Python script
« Reply #3 on: June 13, 2022, 06:41:55 PM »
Hope it's not too late to comment on that. I've been using phreeqpy to automate some calculations and I use the function set_output_file_on to get the results just like the PQO report. By default it saves the file at the running directory with an extension .out (ex. phreeqc.0.out). You can change the file name using standard python module os.rename().

Code: [Select]
import phreeqpy.iphreeqc.phreeqc_dll as phreeqc_mod
phreeqc = phreeqc_mod.IPhreeqc()
phreeqc.load_database(r"phreeqc.dat")
phreeqc.set_output_file_on()
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Conceptual Models »
  • Incorporation PHREEQC in programming languages »
  • Batch PHREEQC via Python script
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines | Terms and Policies
  • XHTML
  • RSS
  • WAP2