Skip to main content

Hi all

We have an environment with several users running concurrently. This works fine, but I'm having trouble when several users try to run Python code concurrently.

This is my UP

NOMBRE.SCRIPT='excel_utils'
NOMBRE.FUNCION='leer_excel'

PATH.REPOSITORIO='/u2/quiter/CONTA5/REPO.FILE/'
FICHERO.EXCEL='Fichero Extracontables a integrar BR LEAPMOTOR.xlsx'
RUTA.EXCEL=PATH.REPOSITORIO:FICHERO.EXCEL
RUTA.CSV='/u2/quiter/CONTA5/REPO.FILE/'
CONVERTIR.CSV=''
USAR.CABECERA='1'

RESPUESTA=PyCallFunction(NOMBRE.SCRIPT,NOMBRE.FUNCION,RUTA.EXCEL,RUTA.CSV,CONVERTIR.CSV,USAR.CABECERA)

IF @PYEXCEPTIONMSG#'' THEN
   CRT 'ERROR: ':@PYEXCEPTIONMSG
END

CRT 'RESPUESTA: ':RESPUESTA
RETURN

If I call RUN UP from two terminals it works fine, once.

When I try to run it again...

>RUN UP TESTEXCEL
RESPUESTA: OK|...
>RUN UP TESTEXCEL
Abnormal termination of UniVerse.
Fault type is 11.  Layer type is BASIC run machine.
Fault occurred in BASIC program TESTEXCEL at address 32.
Connection to narobial.intraquiter closed.                                                    

What's happening?

I tried using the Filelock library, to no avail. This is not only in this instace of Python code, it also happens with other examples.



------------------------------
Héctor Cortiguera
Quiter Servicios Informaticos SL
------------------------------

Hi all

We have an environment with several users running concurrently. This works fine, but I'm having trouble when several users try to run Python code concurrently.

This is my UP

NOMBRE.SCRIPT='excel_utils'
NOMBRE.FUNCION='leer_excel'

PATH.REPOSITORIO='/u2/quiter/CONTA5/REPO.FILE/'
FICHERO.EXCEL='Fichero Extracontables a integrar BR LEAPMOTOR.xlsx'
RUTA.EXCEL=PATH.REPOSITORIO:FICHERO.EXCEL
RUTA.CSV='/u2/quiter/CONTA5/REPO.FILE/'
CONVERTIR.CSV=''
USAR.CABECERA='1'

RESPUESTA=PyCallFunction(NOMBRE.SCRIPT,NOMBRE.FUNCION,RUTA.EXCEL,RUTA.CSV,CONVERTIR.CSV,USAR.CABECERA)

IF @PYEXCEPTIONMSG#'' THEN
   CRT 'ERROR: ':@PYEXCEPTIONMSG
END

CRT 'RESPUESTA: ':RESPUESTA
RETURN

If I call RUN UP from two terminals it works fine, once.

When I try to run it again...

>RUN UP TESTEXCEL
RESPUESTA: OK|...
>RUN UP TESTEXCEL
Abnormal termination of UniVerse.
Fault type is 11.  Layer type is BASIC run machine.
Fault occurred in BASIC program TESTEXCEL at address 32.
Connection to narobial.intraquiter closed.                                                    

What's happening?

I tried using the Filelock library, to no avail. This is not only in this instace of Python code, it also happens with other examples.



------------------------------
Héctor Cortiguera
Quiter Servicios Informaticos SL
------------------------------

Hector,

Not all Python code is re-entrant, please look at REINIT.PYTHON which often (but not always)  resolves the issue. In a  few cases in the past with some Python libraries I have either had to find an alternative library or had to launch the Python wrapper program as a PHANTOM and monitor its completion as once invoked the Python code will not work again from the same shell.

[ UniVerse differs from a Python shell here in that a UniVerse shell as a Python wrapper is persistent, whereas a standalone Python shells destroys itself after each invocation ].
Regards

JJ



------------------------------
John Jenkins
Thame, Oxfordshire
------------------------------


Hector,

Not all Python code is re-entrant, please look at REINIT.PYTHON which often (but not always)  resolves the issue. In a  few cases in the past with some Python libraries I have either had to find an alternative library or had to launch the Python wrapper program as a PHANTOM and monitor its completion as once invoked the Python code will not work again from the same shell.

[ UniVerse differs from a Python shell here in that a UniVerse shell as a Python wrapper is persistent, whereas a standalone Python shells destroys itself after each invocation ].
Regards

JJ



------------------------------
John Jenkins
Thame, Oxfordshire
------------------------------

Hi John

We had trouble with this (I remember specifically the requests library failing to load after the first import) so we switched REINIT.PYTHON to OFF.



------------------------------
Héctor Cortiguera
Quiter Servicios Informaticos SL
------------------------------