GCS의 파일을 검사하기 위해 python 스크립트를 코딩합니다. wxpython을 사용하여 GUI를 생성합니다. 그냥 파이썬 평 때Errno 185090050 _ssl.c : 343 : 오류 : 0B084002 : x509 인증서 루틴 : X509_load_cert_crl_file : Pyinstaller에 의해 exe로 패키징 된 시스템 라이브러리
flow = flow_from_clientsecrets(CLIENT_SECRETS_FILE,
# the secrets file I put in same folder
scope=scope,
message=MISSING_CLIENT_SECRETS_MESSAGE)
credential_storage = CredentialStorage(CREDENTIALS_FILE) # the file to store
# authentication credentials
credentials = credential_storage.get()
if credentials is None or credentials.invalid:
credentials = run_oauth2(flow, credential_storage)
self.printLog('Constructing Google Cloud Storage service...')
http = credentials.authorize(httplib2.Http())
return discovery_build('storage', 'v1beta1', http=http)
위의 코드는 아주 잘 작동 내 파이썬 스크립트에 포함되어 있습니다 : - 나는 (>http://code.google.com/p/google-cloud-platform-samples/source/browse/file-transfer-json/chunked_transfer.py?repo=storage 구글 샘플 코드의 방법으로 다음과 같은) 이런 식으로 해냈어 인증하려면 파일, 나중에 내가 명령 아래 사용 7 64 비트 (나는 또한 .exe 파일과 같은 폴더에 비밀 파일을 넣어) 승리 .exe를로 변환 pyInstaller 중에 사용
C:\gcs_file_check>python pyinstaller-2.0\pyinstaller.py -w gcs_file_check.py
EXE 파일을 클릭하면 Google의 허가 요청 페이지이 올바르게 실행되었습니다 (예 : exe가 아닌 Python 스크립트를 실행하는 것처럼). 동의 함을 클릭 한 후, 위의 코드는 예외가 발생합니다 :
[Errno 185090050] _ssl.c:343: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
을 그리고 파이썬 스크립트가 올바르게 파일을 만들 수 있습니다 동안 나는, 파일 credentials.json가 .EXE에 의해 만들어지지 않습니다 볼 수 있습니다.
어떻게 이런 일이 일어나고 수정하는 방법을 알 수 있습니까? 모든 대답을 감사하십시오!
가 04/16에 업데이트 =================== :
내가 코드를 디버깅 추가 예외가 정확히 아래에서 오는 것을 발견 코드 :
if credentials is None or credentials.invalid:
credentials = run_oauth2(flow, credential_storage)
=================== 업데이트
:
하면 자세한 내용을 추가, previ ously 내가
from oauth2client.tools import run as run_oauth2
가 지금은 소스 코드로() run_flow로 변경 oauth2client.tools.run()를 사용되었다 제안 ->https://google-api-python-client.googlecode.com/hg/docs/epy/oauth2client.tools-pysrc.html#run
from oauth2client.tools import run_flow as run_oauth2
이제 코드의이 부분은 다음과 같습니다
parser=argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter,
parents=[tools.argparser])
flags = tools.argparser.parse_args(sys.argv[1:])
if credentials is None or credentials.invalid:
credentials = run_oauth2(flow, credential_storage, flags)
하지만 여전히는, 파이썬 코드가 잘 작동과 같은 예외를 던져 [errno를 1 85090050] PyInstaller에 의해 .exe로 패키징 한 후. Httplib2와 pyInstaller 중에를 사용하는 경우
근본적인 원인인지는 모르겠지만 EXE 패키지 관리자의 내부에서 실행되는 스크립트는 패키지 외부에서 실행되는 동일한 스크립트와 다른 "현재 디렉터리"를 갖고있는 경우가 많습니다. 해당 코드 바로 앞에 os.getcwd()를 인쇄하는 것이 좋습니다. –
힌트를 보내 주셔서 감사합니다! os.getcwd() 코드를 추가했지만 이상한 것을 보지 못했습니다.나중에 디버깅 코드를 추가하고 코드에서 예외가 발생한다는 것을 알았습니다. 자격 증명이 None이거나 credentials.invalid 인 경우 : credentials = run_oauth2 (flow, credential_storage), 내 질문에 업데이트되었습니다. –