daily pastebin goal
61%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import urllib
  2. import requests
  3.  
  4. from bs4 import *
  5. from subprocess import Popen,PIPE
  6. import os
  7.  
  8. connectString = 'SYSTEM/mediadot123'
  9.  
  10. def runSqlQuery(sqlCommand, connectString):
  11.    session = Popen(['sqlplus', '-S', connectString], stdin=PIPE, stdout=PIPE, stderr=PIPE)
  12.    session.stdin.write(sqlCommand)
  13.    return session.communicate()
  14.  
  15. session = Popen(['sqlplus','-S','hr/hr'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
  16. stdout, stderr = session.communicate()
  17.  
  18. sqlCommand = "insert into food(title, recipe, image) values ('bla','bla','bla');"
  19. queryResult, errorMessage = runSqlQuery(sqlCommand, connectString)
  20. print queryResult
  21.    
  22. C:Python27python.exe C:/Users/Umer/PycharmProjects/DATACRAWLER/main.py
  23.  
  24. Traceback (most recent call last):
  25.  
  26.   File "C:/Users/Umer/PycharmProjects/DATACRAWLER/main.py", line 38, in <module>
  27.  
  28. session = subprocess.Popen(['sqlplus','-S','hr/hr'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  29.  
  30.   File "C:Python27libsubprocess.py", line 710, in __init__
  31.     errread, errwrite)
  32.  
  33.   File "C:Python27libsubprocess.py", line 958, in _execute_child
  34.     startupinfo)
  35.  
  36. WindowsError: [Error 2] The system cannot find the file specified
  37.    
  38. Popen(['C:/path/sqlplus.exe', '-S', ...])
  39.    
  40. print(os.environ['PATH'])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top