Python jenv.bash:没有这样的文件或目录

Python jenv.bash:没有这样的文件或目录,python,praw,Python,Praw,尝试在Python中运行代码时出现以下错误: -bash: /usr/local/Cellar/jenv/0.2.0-201404260/libexec/../completions/jenv.bash: No such file or directory 这是我的密码: #!/usr/bin/python # -*- coding: utf-8 -*- import praw import pdb import re import os # Create the Reddit insta

尝试在Python中运行代码时出现以下错误:

-bash: /usr/local/Cellar/jenv/0.2.0-201404260/libexec/../completions/jenv.bash: No such file or directory
这是我的密码:

#!/usr/bin/python
# -*- coding: utf-8 -*-

import praw
import pdb
import re
import os

# Create the Reddit instance

UA = 'A Bot'
r = praw.Reddit(user_agent=UA)

REDDIT_USERNAME = '-snip-'
REDDIT_PASS = '-snip-'

r.set_oauth_app_info(client_id='-snip-',
                     client_secret='-snip-',
                     redirect_uri='http://127.0.0.1:65010/authorize_callback'
                     )

# and login

r.login(REDDIT_USERNAME, REDDIT_PASS)

subreddit = r.get_subreddit('all')
comments = subreddit.get_comments(limit=100)
flat_comments = praw.helpers.flatten_tree(comments)
already_done = set()
for comment in comments:
    if comment.body == 'Hello' and comment.id not in already_done:
        comment.reply(' world!')
        already_done.add(comment.id)
以下是尝试运行Python代码时发生的事件的完整控制台日志:

Last login: Sun Jul 31 02:45:28 on ttys001
cd '/Users/User/Desktop/' && '/usr/local/bin/pythonw'  '/Users/User/Desktop/PRAW_Script.py'  && echo Exit status: $? && exit 1
-bash: /usr/local/Cellar/jenv/0.2.0-201404260/libexec/../completions/jenv.bash: No such file or directory
MacBook-Pro:~ User$ cd '/Users/User/Desktop/' && '/usr/local/bin/pythonw'  '/Users/User/Desktop/PRAW_Script.py'  && echo Exit status: $? && exit 1
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/praw/decorators.py:77: DeprecationWarning: reddit intends to disable password-based authentication of API clients sometime in the near future. As a result this method will be removed in a future major version of PRAW.

For more information please see:

* Original reddit deprecation notice: https://www.reddit.com/comments/2ujhkr/

* Updated delayed deprecation notice: https://www.reddit.com/comments/37e2mv/

Pass ``disable_warning=True`` to ``login`` to disable this warning.
  warn(msg, DeprecationWarning)
Exit status: 0
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]
更改此行:

for comment in comments:
为此:

for comment in flat_comments:
comments
是一个生成器,您已经使用了它通过展平生成的所有注释。在那之后尝试迭代将不会产生任何结果


(您可能打算使用展平版本。)

“这行不通,您能解决这些错误吗?”什么错误?“我没有看到任何错误。@DeepSpace,请自己试着运行它。没有。”。你把收到的错误发出去怎么样?@DeepSpace你为什么这么粗鲁?我甚至没有收到任何错误。如果您没有收到任何错误,那么您希望我们解决哪些错误?现在它显示
ImportError:没有名为praw的模块。
此更改不可能导致该错误。那么为什么会导致该错误?该错误意味着您的Python环境中没有安装
praw
模块。也许你卸载了它,或者现在正在使用另一个virtualenv,等等。它已经安装好了。