Closed zdenop closed 4 years ago
OK, so it tuns out that INFORMIXDIR is not set when running script under cron. Quick solution is:
if not os.getenv("INFORMIXDIR"):
os.environ['INFORMIXDIR'] = '/opt/IBM/Informix_Client-SDK'
Anyway better error message would helped, so I keep the issue open.
That's a good point, but the thing is that the errors messages are located inside INFORMIXDIR, so if we can't find INFORMIXDIR because it is not set, there is no way to give you a better message ;)
The clue is in the "Unspecified System Error". The driver (Informix ODBC driver) knows that there was an error (23101) but it is unable to get the text for the error. -23101 correspond to "Unable to load locale categories.".
What about to connect function (or other relevant place) some check:
if not os.getenv("INFORMIXDIR"):
raise InterfaceError("Environment variable INFORMIXDIR not set")
I try to run script using IfxPy with cron. My script works when I run it under user. But it fails when it iss run from cron. I was able to replicate problme with
sudo -H
:Any idea how to fix it?