Note that there are some explanatory texts on larger screens.

plurals
  1. POPython not calling an external program part 3
    primarykey
    data
    text
    <p>I have been having problems trying to run an external program from a python program that was generated from a trigger in a postgres 9.2 database. The trigger works. It writes to a file. I had tried just running the external program but the permissions would not allow it to run. I was able to create a folder (using os.system(“mkdir”) ). The owner of the folder is NETWORK SERVICE. </p> <p>I need to run a program called sdktest. When I try to run it no response happens so I think that means that the python program does not have enough permissions (with an owner of NETWORK SERVICE) to run it.</p> <p>I have been having my program copy files that it needs into that directory so they would have the correct permissions and that has worked to some degree but the program that I need to run is the last one and it is not running because it does not have enough permissions.</p> <p>My python program runs a C++ program called PG_QB_Connector which calls sdktest. </p> <p>Is there any way I can change the owner of the process to be a “normal” owner? Is there a better way to do this? Basically I just need to have this C++ program have eniough perms to run correctly.</p> <p>BTW, when I run the C++ program by hand, the line that runs the sdktest program runs correctly, however, when I run it from the postgres/python it does not do anything...</p> <p>I have Windows 7, python 3.2. The other 2 questions that I asked about this are located <a href="https://stackoverflow.com/questions/14278109/python-not-calling-external-program">here</a> and <a href="https://stackoverflow.com/questions/14364928/python-not-calling-an-external-program-part-2">here</a></p> <p>The python program:</p> <pre><code>CREATE or replace FUNCTION scalesmyone (thename text) RETURNS int AS $$ a=5 f = open('C:\\JUNK\\frompython.txt','w') f.write(thename) f.close() import os os.system('"mkdir C:\\TEMPWITHOWNER"') os.system('"mkdir C:\\TEMPWITHOWNER\\addcustomer"') os.system('"copy C:\\JUNK\\junk.txt C:\\TEMPWITHOWNER\\addcustomer"') os.system('"copy C:\\BATfiles\\junk6.txt C:\\TEMPWITHOWNER\\addcustomer"') os.system('"copy C:\\BATfiles\\run_addcust.bat C:\\TEMPWITHOWNER\\addcustomer"') os.system('"copy C:\\Workfiles\\PG_QB_Connector.exe C:\\TEMPWITHOWNER\\addcustomer"') os.system('"copy C:\\Workfiles\\sdktest.exe C:\\TEMPWITHOWNER\\addcustomer"') import subprocess return_code = subprocess.call(["C:\\TEMPWITHOWNER\\addcustomer\\PG_QB_Connector.exe", '"hello"']) $$ LANGUAGE plpython3u; </code></pre> <p>The C++ program that is called from the python program and calls sdktest.exe is below</p> <pre><code>command = "copy C:\\Workfiles\\AddCustomerFROMWEB.xml C:\\TEMPWITHOWNER\\addcustomer\\AddCustomerFROMWEB.xml"; system(command.c_str()); //everything except for the qb file is in my local folder command = "C:\\TEMPWITHOWNER\\addcustomer\\sdktest.exe \"C:\\Users\\Public\\Documents\\Intuit\\QuickBooks\\Company Files\\Shain Software.qbw\" C:\\TEMPWITHOWNER\\addcustomer\\AddCustomerFROMWEB.xml C:\\TEMPWITHOWNER\\addcustomer\\outputfromsdktestofaddcust.xml"; system(command.c_str()); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload