我刚刚升级到Python 3.4.3并且在编写一段代码时遇到了这个错误:
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
答案 0 :(得分:1)
我能够通过纠正另一个错误来解决这个问题,正如@ Aurora0001所建议的那样。 因此,根据我的理解,当您忽略其他错误时,会出现此错误。在我的情况下,我停止使用tweepy并使用另一个API。这消除了错误。