From: | paulo(dot)nuno(dot)leite(at)gmail(dot)com |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #14583: plpythonu : subprocess not working in function |
Date: | 2017-03-08 17:51:19 |
Message-ID: | 20170308175119.25054.71616@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 14583
Logged by: Paulo B
Email address: paulo(dot)nuno(dot)leite(at)gmail(dot)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?
From | Date | Subject | |
---|---|---|---|
Next Message | jorsol | 2017-03-08 19:02:09 | BUG #14584: Segmentation fault importing large XML file |
Previous Message | Tom Lane | 2017-03-08 17:29:16 | Re: BUG #14231: logical replication wal sender process spins when using error traps in function |