2016-12-03 62 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。这消除了错误。