[BUGS] BUG #14583: plpythonu : subprocess not working in function

Поиск
Список
Период
Сортировка
От paulo.nuno.leite@gmail.com
Тема [BUGS] BUG #14583: plpythonu : subprocess not working in function
Дата
Msg-id 20170308175119.25054.71616@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: [BUGS] BUG #14583: plpythonu : subprocess not working in function
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      14583
Logged by:          Paulo B
Email address:      paulo.nuno.leite@gmail.com
PostgreSQL version: 9.5.6
Operating system:   Windows
Description:

I have the following function that runs a command:


CREATE OR REPLACE FUNCTION public.classify_test()
  RETURNS void AS
$BODY$
import os
from subprocess import Popen, PIPE
import subprocess
import os
from subprocess import Popen, PIPE

echo=Popen(('echo', '123'), shell=True)

p = subprocess.Popen(['python.exe', '-u','test.py'], stdin = echo.stdout,
universal_newlines = True, shell = True)
    
$BODY$
  LANGUAGE plpythonu VOLATILE
  COST 100;
ALTER FUNCTION public.classify_test()
  OWNER TO postgres;

if I run this fuction as select classify_test() it will not run the python
script. However, if I run it in the command line it will work. It works as
well in SublimeText2 IDE. I have been trying to find what the bug or problem
is, but had no success. I am using python2.7, I have psycopg2 installed. 

Why doesn't  postgresql  execute the python script?





--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] BUG #14231: logical replication wal sender process spins when using error traps in function
Следующее
От: jorsol@gmail.com
Дата:
Сообщение: [BUGS] BUG #14584: Segmentation fault importing large XML file