Read File (File) component not working

The Read File (File) component is throwing 2 errors in the latest Rhino for Mac WIP (5.2 5c95W).

The errors are:

  1. Before solution exception:Error running vbnc:Cannot find specified file
  2. There is no valid parser available

This is happening on OS X 10.10.5 trying to read a basic .txt file in both “per line” or “whole file” mode.

Thanks for reporting. This is a known issue: http://mcneel.myjetbrains.com/youtrack/issue/MR-2471

Oh, I checked the list of known issues but couldn’t find it there.

When you do implement it, can you make sure for it to support network paths (ie. UNC paths), because the Windows version is really rubbish at that. It works, but freezes GH for several minutes (same for image sampler).

2 years later and apparently the issue hasn’t been fixed yet…
In case anyone comes across this, here’s a really simple 2-line Python script that achieves the same thing for text files (i.e. non-binary, no parsing done):

with open(path, 'r') as fp:
    contents = fp.read()
  • just replace read() with readlines() for Per Line functionality)

2 Likes

Thanks for this! I just started using Grasshopper and I created an account just to thank you!

2 Likes

Hi @qythium

I’ve tried running exactly the script you mention but I get as an error:

  1. Runtime error (UnboundNameException): name ‘path’ is not defined
    Traceback:
    line 1, in script

What could be the problem…?

Thanks!

Did you rename the default ‘x’ input as ‘path’? And the ‘a’ output as ‘contents’?


rdFile.gh (4.4 KB)

1 Like

Thanks Joseph that was it.

Hi @fraguada any news about that, I see in your link that @dan fixed this, but in Rhino 6 wip, any update for Rhino 5?

Hi Thomas - That issue was fixed in Rhino 6, yes. Our top priority now is releasing Rhino 6 for Mac. As such, there are no updates to Rhino 5 on the table at this point.

Thanks for the quick response @wim, approximately when will Rhino 6 be released?

I’m afraid I can only answer with our standard reply to that question: when it’s ready. But, as I said, it has top priority.

Apologies for reviving an old thread. I am having difficulty in making this simple script work, but I have no experience with scripting in GH. Can anyone suggest what I am doing wrong? I can’t find any other solution to allow me to read file data.

Hi - are you using Rhino 6?
-wim

What script? An image that is barely readable won’t do.

3. Attach minimal versions of all the relevant files

Problem solved. I was using the compiler output messages instead of the program output connection.