processing twitter4j no files added to sketch

edited December 2013 in Library Questions

Im getting this error for processing, when I use Twitter4j 3 and processing 2.Screen Shot 2013-12-02 at 16.04.58 Ive tried browsing the error, but no one has resolved it. When ever I run my program for a period of time(30 seconds), it halts and gives this error. Im using the streaming API in my code.

Im running processing on a MacOSX.

Has anyone got any suggestions on how to fix this?

Thanks in advance!

Answers

  • Can you show your code? Ideally try and reduce it to the smallest program that still exhibits the bug.

  • And when you have text in the console, you can copy & paste it, instead of showing screen shots with partial information, unreadable and not searchable.

  • edited December 2013

    here is my code, it works fine but after a bit i get the error

    void setup() {
      size(600, 600); 
      smooth();
      noStroke();
    }
    
    void draw() 
    {
    
      GetTweets();
    }
    
    void method1()
    {
        System.out.println("method1 can be called and it works!!");
    
    }
    void method2()
    {
        System.out.println("method2 can be called and it works!!");
    
    }
    
    void method3()
    {
        System.out.println("method3 can be called and it works!!");
    
    }
    
    void GetTweets()
    {
    
          ConfigurationBuilder cb = new ConfigurationBuilder();
          cb.setOAuthConsumerKey("xxxxxxxxxxxxxx");
          cb.setOAuthConsumerSecret("xxxxxxxxxxxxxx");
          cb.setOAuthAccessToken("xxxxxxxxxxxxxx");
          cb.setOAuthAccessTokenSecret("xxxxxxxxxxxxxx");
    
          TwitterStream twitterStream = new TwitterStreamFactory(cb.build()).getInstance();
          StatusListener statusListener = new StatusListener() {
    
    
    
          @Override
          public void onStatus(Status status)
          {
          // Here do whatever you want with the status object that is the       
                               //  tweet you got
               System.out.println(status.getUser().getName() + " : " + status.getText());
               if(status.getText().contains("happy"))
               {
                 method1();
                 System.out.println("A happy tweet");
    
               }
               if(status.getText().contains("okay"))
               {
                  method2()
                  System.out.println("A okay tweet");
               }
               if (status.getText().contains("sad"))
               {
    
                 method3();
                 System.out.println("A sad tweet ");
    
               }
    
          } //en of the onStatus()
          public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) {
          // should really remove deleted tweets here ...
          }
    
          public void onTrackLimitationNotice(int numberOfLimitedStatuses) {
          }
    
          public void onScrubGeo(long userId, long upToStatusId) {
          // should really remove deleted location information here ...
          }
    
          public void onStallWarning(StallWarning stallWarning) {
          // should really do something about stalls here ...
          System.out.println(stallWarning);
          }
          @Override
          public void onException(Exception ex)
          {
             ex.printStackTrace();
          }
    
        }; //end of the listener
        String keywords[] = {"happy","sad","okay"};
    
            FilterQuery fq = new FilterQuery();
            fq.track(keywords);
            twitterStream.addListener(statusListener);
            twitterStream.filter(fq);
    
    
     }
    
Sign In or Register to comment.