2016-12-03 64 views
1

我剛剛升級到3.4.3的Python和而寫一段代碼,我已經收到此錯誤:的Python 3.4+ PendingDeprecationWarning

PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses 

這似乎是一個Python版本相關的問題。 謝謝!

編輯:這是整個錯誤是什麼樣子

/usr/lib/python3.4/imp.py:32: PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses 
    PendingDeprecationWarning) 
Traceback (most recent call last): 
    File "twitter_reddit_bot_2.py", line 139, in <module> 
    main() 
    File "twitter_reddit_bot_2.py", line 100, in main 
    tweeter(post_titles, post_links, post_ids) 
    File "twitter_reddit_bot_2.py", line 124, in tweeter 
    api.update_status(tweet_content) 
    File "/usr/local/lib/python3.4/dist-packages/tweepy/api.py", line 194, in update_status 
    )(post_data=post_data, *args, **kwargs) 
    File "/usr/local/lib/python3.4/dist-packages/tweepy/binder.py", line 245, in _call 
    return method.execute() 
    File "/usr/local/lib/python3.4/dist-packages/tweepy/binder.py", line 229, in execute 
    raise TweepError(error_msg, resp, api_code=api_error_code) 
tweepy.error.TweepError: [{'message': 'Status is a duplicate.', 'code': 187}] 
sys:1: ResourceWarning: unclosed <ssl.SSLSocket fd=5, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('192.168.1.10', 50066), raddr=('104.244.42.2', 443)> 
/usr/lib/python3.4/importlib/_bootstrap.py:2150: ImportWarning: sys.meta_path is empty 
+2

以及'imp'模塊已被棄用,以支持'importlib';或者用'importlib'的相應函數替換'imp'的所有用法,或者稍後當它最終被刪除時被強制執行它 –

+0

對不起,我不明白你的意思是'使用它改變模塊現在'。 –

+0

我更新了我的評論以更好地解釋我自己。什麼是你正在執行的是拋出這個警告? –

回答

1

我能夠糾正另一個錯誤來解決這個問題,通過@ Aurora0001的建議。 因此,從我所瞭解的情況來看,當有一些其他錯誤被忽視時,這個錯誤就會出現。就我而言,我停止使用tweepy並使用另一個API。這消除了錯誤。