2014-07-22 2 views
1

paramiko을 가져 오는 cron에 30 분마다 실행되는 스크립트가 있습니다. 겉보기에 무작위로, 내가 가져 오는 동안이 두 가지 오류 중 하나를 얻을 것이다 :Python 2.6 - paramiko 가져 오기 오류

Traceback (most recent call last): 
    ... 
    File "build/bdist.linux-x86_64/egg/paramiko/__init__.py", line 65, in <module> 
    File "build/bdist.linux-x86_64/egg/paramiko/transport.py", line 42, in <module> 
    File "build/bdist.linux-x86_64/egg/paramiko/packet.py", line 39, in <module> 
    File "build/bdist.linux-x86_64/egg/Crypto/Hash/HMAC.py", line 66, in <module> 
    File "build/bdist.linux-x86_64/egg/Crypto/Util/strxor.py", line 7, in <module> 
    File "build/bdist.linux-x86_64/egg/Crypto/Util/strxor.py", line 6, in __bootstrap__ 
ImportError: dynamic module does not define init function (initstrxor) 

- 또는 -

Traceback (most recent call last): 
    ... 
    File "build/bdist.linux-x86_64/egg/paramiko/__init__.py", line 65, in <module> 
    File "build/bdist.linux-x86_64/egg/paramiko/transport.py", line 53, in <module> 
    File "build/bdist.linux-x86_64/egg/Crypto/Cipher/ARC4.py", line 66, in <module> 
    File "build/bdist.linux-x86_64/egg/Crypto/Cipher/_ARC4.py", line 7, in <module> 
    File "build/bdist.linux-x86_64/egg/Crypto/Cipher/_ARC4.py", line 6, in __bootstrap__ 
ImportError: dynamic module does not define init function (init_ARC4) 

나는이 문제를 보았다 때마다, 단순히 스크립트를 다시 실행하기에 paramiko 수 있습니다 올바르게 가져 오기하고 스크립트를 완료하십시오.

이 문제의 원인은 무엇입니까? 어떤 도움이라도 대단히 감사합니다.

답변

0

내가 오류를 일으킬 수있는 어떤 생각이 없지만, pycrypto의 기본 부품에 실패한 것 같다, 그래서 당신은 몇 번을 다시 시도 할 수 있습니다 :

from time import sleep 
n_tries= 3 
import_success= False 

while not import_success: 
    try: 
     from Crypto.Cipher import Blowfish, AES, DES3, ARC4 
     from Crypto.Hash import MD5, SHA, SHA256, HMAC 
     from Crypto import Random 
     from Crypto.PublicKey import DSA, RSA 
     from Crypto.Util import Counter, number 
     import_success= True 
    except ImportError: 
     if not n_tries: 
      raise #re-raise ImportError 
     n_tries-=1 
     sleep(1) 
+0

내가 뭔가를 피하기 위해 기대했다 이런 식으로,하지만 적어도 그것은 대체 계획입니다. 감사! – Valdogg21