2016년 12월 22일 목요일

[Python] 기본 encoding 변경

기본 encoding을 utf-8로 변경하기 위해서 site.py 수정
def setencoding():
    encoding = "utf-8"
    .... 

[Python] Windows에 cx_Oracle 설치


  1. OS : Windows 10 64bit
  2. Python : 2.7.12, 64bit
  3. Oracle Instant Client downalod
    • http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
    • 다운로드 -> 압축해제 -> 환경변수 -> 시스템변수 -> Path 추가
  4. cx_Oracle download
    • https://pypi.python.org/pypi/cx_Oracle/5.2.1

[Python] cx_Oracle 에서 RAC connect

tnsnames.ora 파일에 정의된 string으로 cx_Oracle.connect() 을 호출한다.

import cx_Oracle
#dsn = cx_Oracle.mskedsn(HOST, PORT, service_name=SID)
dsn = open('tnsnames.ora','r').read()
con = cx_Oracle.connect(USER, PASSWORD, dsn)
cur = con.cursor() 

[python] subprocess

proc.py import asyncio from argparse import ArgumentParser from asyncio import sleep async def process_function(user, file_path):     if use...