Reading .txt .pdf and .png files from Google Drive using Processing

edited June 2017 in Python Mode

Hello all,

I'm working on an IoT project where I am capturing measurements with Arduino UNO WiFi, sending them to Raspberry Pi 3 where they get analyzed and the so produced report files are sent to Google Drive. As a result from Python analysis, a txt, pdf and 2 png files are produced.

I would like to be able to read these files with Processing directly from Google Drive... Is something like this possible? Since I know how to do it with Python, is it possible to use Python coding inside Java interface?

Kind regards and thank you for any given help! Regards,

L

Answers

  • Since I know how to do it with Python, ...

    Processing's Python Mode is based on Jython. And it can only use Java libraries.

  • edited June 2017 Answer ✓
    1. If the Google Drive account is synced to your desktop, you can simply access the files through the local file tree using loadStrings and loadImage. If you have a public URL for those files you can similarly simply use loadStrings and loadImage ... but I don't think (?) that Google Drive exposes public URLs for direct (no web interface) downloads of original files.

    2. You can't use Python inside Processing(Java) easily, but you could write a separate sketch in Processing.py, the Python Mode.

  • Would it be possible then to write a function in Processing Python mode and call it inside the main program in Java mode?

  • Answer ✓
  • This plan sounds like it might be a bad idea. If you can access Google Drive files directly via URL then this shouldn't be dependent on Python JavaScript Java etc. That method also may not last long, even if it works now -- Google could can change the API. So you are build a complicated thing in two languages that might break at any moment.

    If the goal is free shared web hosting for a few text and image files that isn't the best way to accomplish it.

Sign In or Register to comment.