添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account
  • Create a Virtual Env in the same directory.
  • Pip install the dependencies from requirements.txt file (Updated)
  • Activate Virtual Env and then run python main.py
  • I create manually data folder, and positives.txt, negatives.txt and tokens.txt that's corrects?

    Then:

    python main.py
    Traceback (most recent call last):
    File "main.py", line 249, in
    consumer_secret = data[1]
    IndexError: list index out of range
    Exception KeyError: KeyError(140331210001456,) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored

    This error is because you have not created the tokens file correctly. write the four tokens value line seperated, like this:

    239492340-32433
    2394-2394932433
    285u2405u425243
    234234234234234

    and place in it in the same folder as main.py
    And in data folder keep positives.txt and negatives.txt

    root@ubuntu:/home/psegovias/Desktop/tweetengine# python main.py
    127.0.0.1 - - [2014-07-01 13:26:03] "GET / HTTP/1.1" 200 1334 0.029105
    127.0.0.1 - - [2014-07-01 13:26:03] "GET /static/css/bootstrap.min.css HTTP/1.1" 200 110602 0.011188
    127.0.0.1 - - [2014-07-01 13:26:03] "GET /static/css/bootstrap-responsive.min.css HTTP/1.1" 200 16249 0.003286
    127.0.0.1 - - [2014-07-01 13:26:03] "GET /static/css/style.css HTTP/1.1" 200 1687 0.003768
    127.0.0.1 - - [2014-07-01 13:26:03] "GET /static/img/header-footer.png HTTP/1.1" 200 545 0.001452
    127.0.0.1 - - [2014-07-01 13:26:03] "GET /favicon.ico HTTP/1.1" 404 342 0.001595
    127.0.0.1 - - [2014-07-01 13:26:22] "GET / HTTP/1.1" 200 1334 0.000741
    127.0.0.1 - - [2014-07-01 13:26:22] "GET /static/css/bootstrap.min.css HTTP/1.1" 304 189 0.007665
    127.0.0.1 - - [2014-07-01 13:26:22] "GET /static/css/bootstrap-responsive.min.css HTTP/1.1" 304 189 0.003232
    127.0.0.1 - - [2014-07-01 13:26:22] "GET /static/css/style.css HTTP/1.1" 304 188 0.000805
    127.0.0.1 - - [2014-07-01 13:26:22] "GET /static/img/header-footer.png HTTP/1.1" 304 186 0.001454
    127.0.0.1 - - [2014-07-01 13:26:23] "GET / HTTP/1.1" 200 1334 0.000656
    127.0.0.1 - - [2014-07-01 13:26:23] "GET /static/css/bootstrap.min.css HTTP/1.1" 304 189 0.001350
    127.0.0.1 - - [2014-07-01 13:26:23] "GET /static/css/bootstrap-responsive.min.css HTTP/1.1" 304 189 0.001382
    127.0.0.1 - - [2014-07-01 13:26:23] "GET /static/css/style.css HTTP/1.1" 304 188 0.000875
    127.0.0.1 - - [2014-07-01 13:26:23] "GET /static/img/header-footer.png HTTP/1.1" 304 186 0.001150
    127.0.0.1 - - [2014-07-01 13:26:33] "POST / HTTP/1.1" 200 9693 1.110272
    127.0.0.1 - - [2014-07-01 13:26:33] "GET /static/js/sc.js HTTP/1.1" 200 9415 0.002166
    127.0.0.1 - - [2014-07-01 13:26:33] "GET /static/js/jquery.min.js HTTP/1.1" 200 95126 0.002517
    127.0.0.1 - - [2014-07-01 13:26:33] "GET /static/js/bootstrap.min.js HTTP/1.1" 200 26000 0.003518
    127.0.0.1 - - [2014-07-01 13:26:33] "GET /static/js/boot-business.js HTTP/1.1" 200 1304 0.002394
    127.0.0.1 - - [2014-07-01 13:29:46] "POST / HTTP/1.1" 200 9693 1.645463
    127.0.0.1 - - [2014-07-01 13:29:46] "GET /static/css/bootstrap.min.css HTTP/1.1" 304 189 0.001150
    127.0.0.1 - - [2014-07-01 13:29:46] "GET /static/css/bootstrap-responsive.min.css HTTP/1.1" 304 189 0.001267
    127.0.0.1 - - [2014-07-01 13:29:46] "GET /static/css/style.css HTTP/1.1" 304 188 0.001609
    127.0.0.1 - - [2014-07-01 13:29:46] "GET /static/js/sc.js HTTP/1.1" 304 188 0.000965
    127.0.0.1 - - [2014-07-01 13:29:46] "GET /static/js/jquery.min.js HTTP/1.1" 304 189 0.000832
    127.0.0.1 - - [2014-07-01 13:29:46] "GET /static/js/bootstrap.min.js HTTP/1.1" 304 189 0.000738
    127.0.0.1 - - [2014-07-01 13:29:46] "GET /static/js/boot-business.js HTTP/1.1" 304 188 0.000805
    127.0.0.1 - - [2014-07-01 13:29:47] "GET /static/img/header-footer.png HTTP/1.1" 304 186 0.001001
    Client disconnected
    Exception in thread Thread-5:
    Traceback (most recent call last):
    File "/usr/lib/python2.7/threading.py", line 551, in * bootstrap_inner
    self.run()
    File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(_self.__args, _self.__kwargs)
    File "main.py", line 136, in background_thread
    for item in rpager:
    File "/usr/local/lib/python2.7/dist-packages/TwitterAPI/TwitterAPI.py", line 140, in __iter

    for item in self.get_iterator():
    File "/usr/local/lib/python2.7/dist-packages/TwitterAPI/TwitterAPI.py", line 198, in iter
    yield json.loads(item.decode('utf-8'))
    File "/usr/lib/python2.7/json/ init .py", line 326, in loads
    return _default_decoder.decode(s)
    File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
    ValueError: No JSON object could be decoded

    127.0.0.1 - - [2014-07-01 13:29:58] "POST / HTTP/1.1" 200 9694 1.161834
    Client disconnected
    Client disconnected
    Client disconnected

    Resource 'tokenizers/punkt/english.pickle' not found. Please
    use the NLTK Downloader to obtain the resource: >>>
    nltk.download()
    Searched in:
    - '/root/nltk_data'
    - '/usr/share/nltk_data'
    - '/usr/local/share/nltk_data'
    - '/usr/lib/nltk_data'
    - '/usr/local/lib/nltk_data'

    Exception in thread Thread-3:
    Traceback (most recent call last):
    File "/usr/lib/python2.7/threading.py", line 551, in * bootstrap_inner
    self.run()
    File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(_self.__args, _self.__kwargs)
    File "main.py", line 166, in background_thread
    word_count = len(blob.words)
    File "/usr/local/lib/python2.7/dist-packages/textblob/decorators.py", line 24, in __get

    value = obj. dict [self.func. name ] = self.func(obj)
    File "/usr/local/lib/python2.7/dist-packages/textblob/blob.py", line 607, in words
    return WordList(word_tokenize(self.raw, include_punc=False))
    File "/usr/local/lib/python2.7/dist-packages/textblob/tokenizers.py", line 74, in word_tokenize
    for sentence in sent_tokenize(text))
    File "/usr/local/lib/python2.7/dist-packages/textblob/base.py", line 65, in itokenize
    return (t for t in self.tokenize(text, _args, *_kwargs))
    File "/usr/local/lib/python2.7/dist-packages/textblob/decorators.py", line 38, in decorated
    raise MissingCorpusException()
    MissingCorpusException:
    Looks like you are missing some required data for this feature.

    To download the necessary data, simply run

    curl https://raw.github.com/sloria/TextBlob/master/download_corpora.py | python
    

    Or use the NLTK downloader to download the missing data: http://nltk.org/data.html
    If this doesn't fix the problem, file an issue at https://github.com/sloria/TextBlob/issues.

    Resource 'tokenizers/punkt/english.pickle' not found. Please
    use the NLTK Downloader to obtain the resource: >>>
    nltk.download()
    Searched in:
    - '/root/nltk_data'
    - '/usr/share/nltk_data'
    - '/usr/local/share/nltk_data'
    - '/usr/lib/nltk_data'
    - '/usr/local/lib/nltk_data'

    Exception in thread Thread-1:
    Traceback (most recent call last):
    File "/usr/lib/python2.7/threading.py", line 551, in *bootstrap_inner
    self.run()
    File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(_self.__args, _self.__kwargs)
    File "main.py", line 166, in background_thread
    word_count = len(blob.words)
    File "/usr/local/lib/python2.7/dist-packages/textblob/decorators.py", line 24, in __get

    value = obj.dict[self.func.name] = self.func(obj)
    File "/usr/local/lib/python2.7/dist-packages/textblob/blob.py", line 607, in words
    return WordList(word_tokenize(self.raw, include_punc=False))
    File "/usr/local/lib/python2.7/dist-packages/textblob/tokenizers.py", line 74, in word_tokenize
    for sentence in sent_tokenize(text))
    File "/usr/local/lib/python2.7/dist-packages/textblob/base.py", line 65, in itokenize
    return (t for t in self.tokenize(text, _args, *_kwargs))
    File "/usr/local/lib/python2.7/dist-packages/textblob/decorators.py", line 38, in decorated
    raise MissingCorpusException()
    MissingCorpusException:
    Looks like you are missing some required data for this feature.

    To download the necessary data, simply run

    curl https://raw.github.com/sloria/TextBlob/master/download_corpora.py | python
    

    Or use the NLTK downloader to download the missing data: http://nltk.org/data.html
    If this doesn't fix the problem, file an issue at https://github.com/sloria/TextBlob/issues.

    I install it, and now i get this:

    venv)root@ubuntu:/home/psegovias/Desktop/tweetengine# python main.py
    127.0.0.1 - - [2014-07-01 15:22:06] "GET / HTTP/1.1" 200 1334 0.035425
    127.0.0.1 - - [2014-07-01 15:22:06] "GET /static/css/bootstrap.min.css HTTP/1.1" 200 110602 0.007381
    127.0.0.1 - - [2014-07-01 15:22:06] "GET /static/css/style.css HTTP/1.1" 200 1687 0.003404
    127.0.0.1 - - [2014-07-01 15:22:06] "GET /static/css/bootstrap-responsive.min.css HTTP/1.1" 200 16249 0.001625
    127.0.0.1 - - [2014-07-01 15:22:06] "GET /static/img/header-footer.png HTTP/1.1" 200 545 0.001632
    127.0.0.1 - - [2014-07-01 15:22:06] "GET /favicon.ico HTTP/1.1" 404 342 0.002802
    127.0.0.1 - - [2014-07-01 15:22:10] "POST / HTTP/1.1" 200 9693 1.190393
    127.0.0.1 - - [2014-07-01 15:22:10] "GET /static/js/sc.js HTTP/1.1" 200 9415 0.001852
    127.0.0.1 - - [2014-07-01 15:22:10] "GET /static/js/boot-business.js HTTP/1.1" 200 1304 0.001065
    127.0.0.1 - - [2014-07-01 15:22:10] "GET /static/js/bootstrap.min.js HTTP/1.1" 200 26000 0.002684
    127.0.0.1 - - [2014-07-01 15:22:10] "GET /static/js/jquery.min.js HTTP/1.1" 200 95126 0.003810
    127.0.0.1 - - [2014-07-01 15:24:31] "POST / HTTP/1.1" 200 9689 1.110083
    Client disconnected
    Client disconnected
    Exception in thread Thread-5:
    Traceback (most recent call last):
    File "/usr/lib/python2.7/threading.py", line 551, in *bootstrap_inner
    self.run()
    File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(_self.__args, _self.__kwargs)
    File "main.py", line 136, in background_thread
    for item in rpager:
    File "/usr/local/lib/python2.7/dist-packages/TwitterAPI/TwitterAPI.py", line 140, in __iter

    for item in self.get_iterator():
    File "/usr/local/lib/python2.7/dist-packages/TwitterAPI/TwitterAPI.py", line 198, in iter
    yield json.loads(item.decode('utf-8'))
    File "/usr/lib/python2.7/json/init.py", line 326, in loads
    return _default_decoder.decode(s)
    File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
    ValueError: No JSON object could be decoded

    127.0.0.1 - - [2014-07-01 15:27:21] "POST / HTTP/1.1" 200 9689 1.164174
    Client disconnected
    Client disconnected