MELTS Software Users

MELTS for Excel, rhyolite-MELTS (GUI) and alphaMELTS => Operating system specific => Windows => Topic started by: liushanke on October 06, 2024, 06:32:23 AM

Title: Ways to Resolve Locale Warnings Running run_alphamelts.command in Perl
Post by: liushanke on October 06, 2024, 06:32:23 AM
I've recently started learning how to use alphaMelts, and I found it quite complex, especially for beginners. I experimented with different ways to run the script and encountered issues when using Perl, particularly with the "en_US.UTF-8" locale settings. Below, I provide a guide to help others who might face the same problem.

If a similar method has already been shared, I kindly ask the forum administrators to remove this post. Thank you!

If you try to run `run_alphamelts.command` using Perl when the locale is not set to "en_US.UTF-8" (e.g., it defaults to "Chinese (Simplified)_China.936," which is unsupported by the Perl interpreter), you will encounter warnings related to locale settings. This happens because Perl expects to use the "en_US.UTF-8" locale. To resolve this issue, there are two common solutions:

Option 1: Create a Batch Script

You can create a batch script that sets the locale and then runs your Perl command. Follow these steps:

1. Open **Notepad** or any text editor and paste the following code:

    @echo off
    set LANG=C
    set LC_ALL=C
    perl C:\your\local\file\folder\run_alphamelts.command (Replace `C:\your\local\file\folder\` with the path to the folder where the `run_alphamelts.command` script is located.)

2. Save this file with a `.bat` extension, for example, `run_alphamelts.bat`.

3. Double-click the `.bat` file to run the script. This batch script sets the locale variables to "C" and then executes your Perl script.

Option 2: Set Environment Variables Permanently

You can also set the `LANG` and `LC_ALL` environment variables permanently in the system settings:

1. Press `Windows + R`, type `sysdm.cpl`, and press Enter to open "System Properties".
2. Go to the "Advanced tab" and click on "Environment Variables".
3. In the "System variables" section, click "New" to create a new environment variable:
    - Variable name: `LANG`
    - Variable value: `C`
4. Click "New" again to create another environment variable:
    - Variable name: `LC_ALL`
    - Variable value: `C`
5. Click "OK" to close all windows and apply the changes.
6. Restart your computer for the changes to take effect.
Title: Re: Ways to Resolve Locale Warnings Running run_alphamelts.command in Perl
Post by: Paula on October 07, 2024, 09:54:40 AM
Thank you so much! The install.command script does something similar, but the .bat files it writes do not have the LANG and LC_ALL lines. I'll add your fix to install.command in alphaMELTS 1.9 and also implement something similar in alphaMELTS 2. See https://github.com/magmasource/alphaMELTS

The new alphaMELTS command line interface, currently v2.3.1, is much easier to use than 1.9. It has tab completion and a more flexible menu. That means we really do not need to support double-clicking on Mac anymore, which in turn means the installation can be simplified for all platforms. I was planning to do that sometime soon, but will now incorporate your locale workaround at the same time.

Thanks again,
Paula