웹프로그래밍
파이썬 모듈을 C, C++ 에서 호출하는 과정에서 겪은 시행착오를 기록 하였으며 마지막 부분에서는 실제 동작하는 코드와 컴파일 방법을 제시합니다. 작업환경 파이썬 : 2.6.5 운영체제 : Linux Fedora 12 커널 : 2.6.32 gcc : 4.3.3 파이썬에대한 문법적, 개념적 지식이 없더라도 소스를 보시면 쉽게 이해할 수 있을거라 생각합니다.컴파일 옵션중 라이브러리 관련 부분은 자신의 경로에 맞게 수정해야 합니다.결과부터 보고싶다면 9번섹션만 보아도 무방하며 링크 오류 발생시에는 1번부터 따라가며 자신에 맞는 컴파일 옵셙을 찾아내야 합니다. 다음 코드는 국내 블로거 한분이 파이썬의 내장함수를 C언어에서 사용하는 방법을 제시한 것이며 이 코드로 부터 시작합니다. 출처 : http://mc787..
1. 이클립스에 파이썬 기능 추가하기 http://mcchae.egloos.com/10479233 2. 디버깅하기 http://pydev.org/manual_101_run.html 단축키 요약 F9 : Run F11 : Debugging Ctrl+F10 : Break point F5: Step into F6: Step over F7: Step return F8: Resume execution
다음 이슈들은 발생한 순서에 따라 번호가 증가한다. 이슈1 : 파이썬을 빌드할 때 binascii 모듈의 빌드를 실패했 기 때문에 트위터api를 사용하면 binascii모듈을 import할 수 없다는 에러메시지 발생함. 대처 : 파이썬2.2.1. 버전을 빌드할 때 만들어진 binascii.so를 2.6.5버전 디렉터리에 복사해 넣어봄 결과 : 버전관련 경고가 뜨지만 어쨋든 import는 가능함. 이슈2 : 위의 문제를 해결하고 나니 simplejason모듈이 없다는 에러가 발생 대처 : python-twitter의 simplejason폴더를 Python2.6.5의 lib디렉터리에 복사 결과 : 에러 없어짐 이슈3 : 2.6.5버전의 binascii.c를 공유라이브러리(binsascii.so)로 따로 빌드..