cpmodel / FTT_StandAlone

Future Technology Transformation models
GNU General Public License v3.0
10 stars 1 forks source link

Unable to run model on MAC #40

Closed jk694exe closed 5 months ago

jk694exe commented 1 year ago

Attached the error file when running the FTT model on Mac error_macJK (1).docx

jp-camecon commented 1 year ago

Initial investigation in person suggest a few suggested routes to explore:

  1. Most likely cause may be an issue with difference in file paths between windows and MAC. This might require rewriting the file path declaration in the backend to be platform agnostic. (This can be done using os.path.join)
  2. Making sure the FTT standalone code is stored locally and not in iCloud
ldxib2 commented 1 year ago

Further in person investigation:

Femkemilene commented 7 months ago

The script that may be causing this is the manager batch file in the root folder, which uses the Windows-specific term start (open is the Mac term). ChatGPT advises us to use a Python Script to do this instead. However, I'm not sure which file calls the manager batch file, and how to integrate this:

import os
import subprocess
import sys

def run_command_windows():
    try:
        # Starting the Python backend
        subprocess.Popen(["cmd", "/k", "python", "Backend_ftt.py", "--DEBUG"], shell=True)
        # Starting the npm server
        subprocess.Popen(["cmd", "/k", "npm", "run", "serve", "--prefix", "Manager_new"], shell=True)
    except Exception as e:
        print(f"Failed to execute Windows commands: {e}", file=sys.stderr)

def run_command_mac():
    try:
        # Using os.system to run commands on Mac
        os.system("python Backend_ftt.py --DEBUG &")
        os.system("npm run serve --prefix Manager_new &")
    except Exception as e:
        print(f"Failed to execute Mac commands: {e}", file=sys.stderr)

if os.name == 'nt':  # Windows
    run_command_windows()
else:  # macOS and other Unix-like OSes
    run_command_mac()