Twitter implementation and general python question

Hello again-

I have been working with sending tweets from MRL 1966 and due to changes in twitter authorisation it requires upgrading the twitter4j to version 3.0.5. I've made an attempt at this by copying over matching files from 3.0.5 to myrobotlab>libraries>jar but thats not worked, giving an error of:

java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: twitter4j/TwitterException

and there are no twitter jar files at all in MRL1969..


so my first question is

how can I upgrade the twitter4j files in MRL1966?

amd my second is

is it possible to import new modules into the jython python like you can in alfresco python?


many thanks

Alessandruino's picture

So twitter scripts are no

So twitter scripts are no worky for you? You need twitter for a particolar project or you are just having a general look of the MRL world?

In order to upgrade twitter4j we have to modify the java part of MRL... We use eclipse...

We tried adding external libraries to jython time ago but with no luck :(

SpenMarsden's picture

Yes thats right the twitter

Yes thats right the twitter scripts no worky- giving a 403 error. twitter has changed to prevent plain http requests. From the Twitter forum a solution:

two ways: upgrade to twitter4j 3.0.5, or, add following line to your

so I'm wondering how to do either of those. I have eclipse but at the moment Im a caveman with a raygun..
I will post any fix I find. thanks for your reply- and yes I have a project that requires twitter.
 I wanted to use beautiful soup via a module but that looks undoable at the moment, within MRL in any case. I imagine I could call an external python script from MRL but I'm not yet sure how I could pass data.


GroG's picture

Twitter fixed...tested with

Twitter fixed...

tested with text & picture - 

Had to upgrade to Twitter4j 3.0.5 - repo now has it with definition - delete your .ivy directory or download a fresh version....  there used to be a "upgrade" which would look for updates in the repo, but I haven't tried that .. might be borked

SpenMarsden's picture


Thanks! I have an obstacle with the twitter upload image from opencv. The other twitter scripts work great.

Its the script

Once I had hunted down all the hidden carriage returns (hidden by elves probably) and got it to be read by jython,after the (sleep)5 seconds have elapsed the java console gives:


1049453 [Thread-17] ERROR class org.myrobotlab.logging.Logging  - ------
    at org.myrobotlab.service.Twitter$ Source)


GroG's picture

Wow .. well, you found where

Wow .. well, you found where the elves have made a big mess in OpenCV...  Thanks for that, now I have to go tell them to clean it up.  ...  

Although disappointing to see the mess, its important that they learn a lesson - and they will be better elves in the future.  

I'll keep you posted of their progress - they have mops, and brushes in their little hands now...

SpenMarsden's picture

great!BTW the code


BTW the code needed

from time import sleep

to give:

from time import sleep
twitter = Runtime.createAndStart("twitter","Twitter")
opencv = Runtime.createAndStart("opencv","OpenCV")
twitter.setSecurity("yourConsumerKey","yourConsumerSecret", "yourAccessToken", "yourAccessTokenSecret")

twitter.uploadImage(opencv.getDisplay() , "pic included");

for anyone following this. Also you may have to get busy with carriage return hoovering..

GroG's picture

Fixed in build

Fixed in build 1973

You'll notice the Python script has changed too...

SpenMarsden's picture

By Asimov's beard! thanks!

By Asimov's beard!