2016-07-31 10 views
-5

ませんPythonで私のコードを実行しようとしたとき、私は、次のエラーを取得しています:ここでjenv.bash:そのようなファイルやディレクトリは

-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 by /u/haykam821' 
r = praw.Reddit(user_agent=UA) 

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

r.set_oauth_app_info(client_id='IMxZ8r9eTEJk1A', 
        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('haykam821') 
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/MuchMeme.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/MuchMeme.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] 
+0

「これは、あなたはこれらのエラーを解決してくださいすることができ、動作しないのだろうか?」どのようなエラー?私はどんな誤りも見ない。 – DeepSpace

+0

@DeepSpace、それを自分で実行してみてください。 – haykam

+0

いいえ、あなたはどのようにあなたが得るエラーを投稿しますか? – DeepSpace

答えて

1

変更この行:

これに
for comment in comments: 

for comment in flat_comments: 

commentsは、発電機で、あなたはすでにそれが平坦化によって生成すべてのコメントを消費してきました。それ以降に反復しようとすると結果が得られません。

(おそらく、とにかく平坦化バージョンを使用するためのもの。)

+0

これは 'ImportError:prawという名前のモジュールはありません。 'と書いてあります。 – haykam

+0

この変更でそのエラーが発生する可能性はありません。 – smarx

+0

それはなぜ起こっているのですか? – haykam

関連する問題