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

10 years 1 month ago

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 :(

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 twitter4j.properties:
http.useSSL=true

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

10 years 1 month ago

Twitter fixed...

tested with text & picture - https://twitter.com/myrobotlab 

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

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

Its the Twitter.uploadfromOpenCV.py 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  - ------
java.lang.NullPointerException
    at org.myrobotlab.service.Twitter$1.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:744)
------

??

GroG

10 years 1 month ago

In reply to by SpenMarsden

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...

great!

BTW the code Twitter.uploadfromOpenCV.py needed

from time import sleep

to give:

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

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

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