Getting this error when I trigger the script using a timer

I’m getting this error when I trigger a script using a timer in the event gateway but when I run the script from the script playground it runs ok.

ERROR 11:54:00 AM TimerScriptTask Error executing global timer script: CSVImport @1,000ms . Repeat errors of this type will be logged as ‘debug’ messages.

Traceback (most recent call last):
File “<TimerScript:Wexford/CSVImport @1,000ms >”, line 41, in
File “module:app.CSVImport”, line 174, in ImportPMAC
OSError: (2, ‘No such file or directory’, ‘P:\Export’)

at org.python.core.Py.OSError(
at org.python.modules.posix.PythonPOSIXHandler.error(
at org.python.posix.BaseNativePOSIX.stat(
at org.python.posix.LazyPOSIX.stat(
at org.python.modules.posix.PosixModule.listdir(
at sun.reflect.GeneratedMethodAccessor283.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(
at org.python.core.PyReflectedFunction.__call__(
at org.python.core.PyObject.__call__(
at org.python.core.PyObject.__call__(
at org.python.pycode._pyx1058.ImportPMAC$6(<module:app.CSVImport>:251)
at org.python.pycode._pyx1058.call_function(<module:app.CSVImport>)
at org.python.core.PyFunction.__call__(
at org.python.pycode._pyx1051.f$0(<TimerScript:Wexford/CSVImport @1,000ms >:44)
at org.python.pycode._pyx1051.call_function(<TimerScript:Wexford/CSVImport @1,000ms >)
at org.python.core.Py.runCode(
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(
at java.util.TimerThread.mainLoop(Unknown Source)
at Source)


Looking at this:

OSError: (2, 'No such file or directory', 'P:\\Export')

My first guess would be your client has this network drive mapping and your gatway does not.

both scripts were ran from gateway machine

Mapped drives are per user. By default the Ignition services uses the Local System account.
You can try changing the path to \ipaddress\Export or changing the service account logon to a domain user.