My EA cannot read a text file from my AI

 
Use the CODE button (Alt-S) when inserting code.

A moderator corrected the formatting this time. Please format code properly in future; posts with improperly formatted code may be removed.

The paths are correct both in the Python file that creates the signal and in the expert advisor, but the error is always the same: file not found error 5002.

I'm attaching the code that reads the signal.

int ReadSignal()

{

   int fh = FileOpen(SignalFilePath, FILE_READ|FILE_TXT|FILE_ANSI);

   if(fh == INVALID_HANDLE)

   {

      Print("File non trovato: ", SignalFilePath, " err=", GetLastError());

      return 0;

   }

   string raw = FileReadString(fh);

   FileClose(fh);

   StringTrimLeft(raw);

   StringTrimRight(raw);

   int s = (int)StringToInteger(raw);

   if(s != 1 && s != -1 && s != 0)

   {

      Print("Valore non valido: '", raw, "'");

      return 0;

   }

   Print("Segnale AI: ", s);

   return s;

}

Thanks for your support

 
Tonybarba:

The paths are correct both in the Python file that creates the signal and in the expert advisor, but the error is always the same: file not found error 5002.

I'm attaching the code that reads the signal.

Thanks for your support

I also tried with copilot gpt and claude but nothing happened
 
Tonybarba:
Use the CODE button (Alt-S) when inserting code.

A moderator corrected the formatting this time. Please format code properly in future; posts with improperly formatted code may be removed.

The paths are correct both in the Python file that creates the signal and in the expert advisor, but the error is always the same: file not found error 5002.

I'm attaching the code that reads the signal.

Thanks for your support

Some details in your code are common for AI-generated, so it can be hardly helped (would need considerable human review/corrections before being usable in a live trading environment).