Watson Studio

 View Only

Accessing asset in Watson Studio (.log file) notebook using 'open'

  • 1.  Accessing asset in Watson Studio (.log file) notebook using 'open'

    Posted Mon August 03, 2020 09:02 AM
    Hi all,

    this is probably a simple fix. I have a working Python notebook on my local machine but had to deploy it in WS. Accessing files is still confusing to me.

    I'm trying to read the messages.log that I stored in assets using
    log_file = open(project.get_file('messages.log'), 'r')

    the error message returns:
    TypeError: expected str, bytes or os.PathLike object, not _io.BytesIO

    Apart from telling me how to open/read the log-file, I'd also appreciate a short explanation on why project.get_file returns a BytesIO object.

    ------------------------------
    Peter Fox
    ------------------------------