subprocess gives an error. “The system cannot find the file specified”

后端 未结 1 1086
悲哀的现实
悲哀的现实 2021-01-20 11:52

This is my code:

import urllib
import requests

from bs4 import *
from subprocess import Popen,PIPE
import os

connectString = \'SYSTEM/mediadot123\'

def ru         


        
1条回答
  •  时光说笑
    2021-01-20 12:13

    Consider using an absolute path for your command-execution.
    Some binaries are not located in PATH depending on your user, system and software installation.

    To find out where sqlplus resides, run the following in cmd.exe: where sqlplus and that should give you the absolute path.

    Then simply do:

    Popen(['C:/path/sqlplus.exe', '-S', ...])
    

    Also to find out what's actually in your PATH environment variable, you could do the following:

    print(os.environ['PATH'])
    

    0 讨论(0)
提交回复
热议问题